-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (48 loc) · 1.11 KB
/
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Define executable name
BIN = sim
# Define source files
SRCS = simulation.cpp mersenne.cpp stoc1.cpp userintf.cpp
# Define header file paths
INCPATH = headers/*.h
# Define the -L library path(s)
LDFLAGS =
# Define the -l library name(s)
LIBS =
# Only in special cases should anything be edited below this line
#
OBJS = $(SRCS:.cpp=.o)
CXXFLAGS = -Wall -g -O0
DEP_FILE = .depend
.PHONY = all clean distclean
# Main entry point
#
all: depend $(BIN)
# For linking object file(s) to produce the executable
#
$(BIN): $(OBJS)
@echo Linking $@
@$(CXX) $^ $(LDFLAGS) $(LIBS) -o $@
# For compiling source file(s)
#
.cpp.o:
@echo Compiling $<
@$(CXX) -c $(CXXFLAGS) $(INCPATH) $<
# For cleaning up the project
#
clean:
$(RM) $(OBJS)
distclean: clean
$(RM) $(BIN)
$(RM) $(DEP_FILE)
# For determining source file dependencies
#
depend: $(DEP_FILE)
@touch $(DEP_FILE)
$(DEP_FILE):
@echo Generating dependencies in $@
@-$(CXX) -E -MM $(CXXFLAGS) $(INCPATH) $(SRCS) >> $(DEP_FILE)
ifeq (,$(findstring clean,$(MAKECMDGOALS)))
ifeq (,$(findstring distclean,$(MAKECMDGOALS)))
-include $(DEP_FILE)
endif
endif