-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakefile
More file actions
122 lines (85 loc) · 2.52 KB
/
makefile
File metadata and controls
122 lines (85 loc) · 2.52 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
##
# @file
#
# Linux makefile for the Brackets coding puzzle
#
# @author Emil Maskovsky
#
###############
# Setup #
###############
# the single threaded executable target
TARGET = brackets
# the multi threaded executable target
TARGET_MT = $(TARGET)_mt
# the unit test target
TEST_TARGET = $(TARGET)_test
# the object files
OBJS = \
StandardValidator.o \
StreamInputReader.o \
StreamResultWriter.o \
StandardProcessor.o \
VectorInputReader.o \
VectorResultWriter.o \
MultithreadProcessor.o \
MultithreadTask.o \
IResult.o \
StandardResult.o \
MultithreadResult.o
# the single threaded executable object files
OBJS_TARGET = \
$(TARGET).o
# the multi threaded executable object files
OBJS_TARGET_MT = \
$(TARGET_MT).o
# libraries linked within the executables
LIBS = \
-lboost_thread-mt \
-lboost_system-mt
# libraries linked within the test executables
LIBS_TEST = \
-lboost_unit_test_framework-mt
# the unit test executable object files
OBJS_TEST = $(OBJS) \
$(TEST_TARGET).o
# optimization and debugging settings
OPTFLAGS = -g -O0 -fno-inline
#OPTFLAGS = -O2 -DNDEBUG
# the compiler flags
CPPFLAGS = $(OPTFLAGS) -std=c++0x -Wall -Wextra -Werror -I inc -I src -I client
# the linker flags
LDFLAGS = $(OPTFLAGS)
# the source file paths
VPATH = src:client:test
#####################
# Build rules #
#####################
.PHONY: all test clean cleanall
all: $(TARGET) $(TARGET_MT)
test: all $(TEST_TARGET)
./$(TEST_TARGET) --log_level=test_suite
clean:
-rm -f $(OBJS) $(OBJS_TARGET) $(OBJS_TARGET_MT) $(OBJS_TEST) $(OBJS:.o=.d) $(OBJS_TARGET:.o=.d) $(OBJS_TARGET_MT:.o=.d) $(OBJS_TEST:.o=.d) $(TEST_TARGET)
cleanall: clean
-rm -f $(TARGET) $(TARGET_MT)
$(TARGET): $(OBJS) $(OBJS_TARGET)
$(CXX) $(LDFLAGS) -o $@ $^ $(LIBS)
$(TARGET_MT): $(OBJS) $(OBJS_TARGET_MT)
$(CXX) $(LDFLAGS) -o $@ $^ $(LIBS)
$(TEST_TARGET): $(OBJS) $(OBJS_TEST)
$(CXX) $(LDFLAGS) -o $@ $^ $(LIBS) $(LIBS_TEST)
.cpp.o:
$(CXX) -c $(CPPFLAGS) -o $@ $<
######################
# Dependencies #
######################
# autogenerate dependencies
.SUFFIXES: .d
.cpp.d:
$(CXX) -MM -MP $(CPPFLAGS) -MT $@ -MT $(@:.d=.o) -o $@ $<
-include $(OBJS:.o=.d) $(OBJS_TARGET:.o=.d) $(OBJS_TARGET_MT:.o=.d) $(OBJS_TEST:.o=.d)
# rebuild everything if the makefile changes (e.g. flags change)
$(OBJS) $(OBJS_TARGET) $(OBJS_TEST) $(OBJS:.o=.d) $(OBJS_TARGET:.o=.d) $(OBJS_TARGET_MT:.o=.d) $(OBJS_TEST:.o=.d): \
makefile
# EOF