-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (29 loc) · 861 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
CC = g++
OPT = -O3
#OPT = -g
WARN = -Wall
CFLAGS = $(OPT) $(WARN) $(INC) $(LIB)
# List all your .cc/.cpp files here (source files, excluding header files)
SIM_SRC = sim.cc GenericCache.cc
# List corresponding compiled object files here (.o files)
SIM_OBJ = sim.o GenericCache.o
#################################
# default rule
all: sim
@echo "Compiled the Simulator successfully."
# rule for making sim
sim: $(SIM_OBJ)
$(CC) -o sim $(CFLAGS) $(SIM_OBJ) -lm
@echo "Sim generated."
# generic rule for converting any .cc file to any .o file
.cc.o:
$(CC) $(CFLAGS) -c $*.cc
# generic rule for converting any .cpp file to any .o file
.cpp.o:
$(CC) $(CFLAGS) -c $*.cpp
# type "make clean" to remove all .o files plus the sim binary
clean:
rm -f *.o sim
# type "make clobber" to remove all .o files (leaves sim binary)
clobber:
rm -f *.o