File tree Expand file tree Collapse file tree 5 files changed +22
-7
lines changed Expand file tree Collapse file tree 5 files changed +22
-7
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ PCH = ./pch/stdafx.h
66
66
67
67
PRECOMPILED_HEADERS = $(addsuffix .gch, $(PCH ) )
68
68
OBJECTS = $(addsuffix .$(MODE ) .o, $(basename $(SOURCES ) ) )
69
+ CPP_DEPENDENCIES = $(addsuffix .d, $(basename $(SOURCES ) ) )
69
70
70
71
# flags for the C++ compiler
71
72
@@ -90,9 +91,11 @@ all: $(LIBRARY_DST)
90
91
@echo " Building precompiled header $( @) "
91
92
@$(CXX ) -x c++-header $(CXXFLAGS ) -c $< -o $@
92
93
94
+ -include $(CPP_DEPENDENCIES )
95
+
93
96
% .$(MODE ) .o : % .cpp
94
97
@echo " Compiling $< -> $@ "
95
- @$(CXX ) $(CXXFLAGS ) -c $< -o $@
98
+ @$(CXX ) -MMD -MF $* .d $(CXXFLAGS ) -c $< -o $@
96
99
97
100
$(PRECOMPILED_HEADERS ) : $(HEADERS )
98
101
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ $(OUTPUT_DIR)/httpclient_test.so: $(OBJECTS)
37
37
@echo " Building library $@ "
38
38
@$(CXX ) -fPIC -shared $(CXXFLAGS ) $(shell pkg-config libxml++-2.6 --cflags) $(LDFLAGS ) $^ $(LDLIBS ) -o $@
39
39
40
+ -include *.$(MODE ) .d
41
+
40
42
$(OBJECTS ) : % .$(MODE ) .o: % .cpp
41
43
@echo " Compiling $< -> $@ "
42
- @$(CXX ) -fPIC $(CXXFLAGS ) -c $< -o $@
44
+ @$(CXX ) -fPIC $(CXXFLAGS ) -MMD -MF $* . $( MODE ) .d - c $< -o $@
Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ $(OUTPUT_DIR)/httplistener_test.so: $(OBJECTS)
27
27
@echo " Building library $@ "
28
28
@$(CXX ) -fPIC -shared $(CXXFLAGS ) $(shell pkg-config libxml++-2.6 --cflags) $(LDFLAGS ) $^ $(LDLIBS ) -o $@
29
29
30
+ -include *.$(MODE ) .d
31
+
30
32
$(OBJECTS ) : % .$(MODE ) .o: % .cpp
31
33
@echo " Compiling $< -> $@ "
32
- @$(CXX ) -fPIC $(CXXFLAGS ) -c $< -o $@
34
+ @$(CXX ) -fPIC $(CXXFLAGS ) -MMD -MF $* . $( MODE ) .d - c $< -o $@
Original file line number Diff line number Diff line change @@ -4,9 +4,11 @@ LDLIBS=-lcasablanca -lunittestpp -lboost_system -lboost_thread -lboost_locale -l
4
4
5
5
OUTPUT_DIR? =./$(MODE )
6
6
7
- $(OUTPUT_DIR ) /libhttptest_utilities.so : \
7
+ FILENAME = $(OUTPUT_DIR ) /libhttptest_utilities
8
+
9
+ $(FILENAME ) .so : \
8
10
http_asserts.cpp \
9
11
test_http_client.cpp \
10
12
test_http_server.cpp \
11
13
test_server_utilities.cpp
12
- $(CXX ) $(CXXFLAGS ) -fPIC -shared $(shell pkg-config libxml++-2.6 --cflags) $(LDFLAGS ) $^ $(LDLIBS ) -o $@
14
+ $(CXX ) $(CXXFLAGS ) -fPIC -shared $(shell pkg-config libxml++-2.6 --cflags) $(LDFLAGS ) -MMD -MF $( FILENAME ) .d $( filter % .cpp, $^ ) $(LDLIBS ) -o $@
Original file line number Diff line number Diff line change @@ -4,7 +4,13 @@ LDLIBS=-lcasablanca -lunittestpp -lboost_system -lboost_thread -lpthread -lstdc+
4
4
5
5
OUTPUT_DIR? =./$(MODE )
6
6
7
- $(OUTPUT_DIR ) /json_test.so : construction_tests.cpp negative_parsing_tests.cpp parsing_tests.cpp to_as_and_operators_tests.cpp
8
- $(CXX ) -fPIC -shared $(CXXFLAGS ) $(shell pkg-config libxml++-2.6 --cflags) $(LDFLAGS ) $^ $(LDLIBS ) -o $@
7
+ FILENAME = $(OUTPUT_DIR ) /json_test
8
+
9
+ $(FILENAME ) .so : \
10
+ construction_tests.cpp \
11
+ negative_parsing_tests.cpp \
12
+ parsing_tests.cpp \
13
+ to_as_and_operators_tests.cpp
14
+ $(CXX ) -fPIC -shared $(CXXFLAGS ) $(shell pkg-config libxml++-2.6 --cflags) $(LDFLAGS ) -MMD -MF $(FILENAME ) .d $(filter % .cpp, $^ ) $(LDLIBS ) -o $@
9
15
10
16
You can’t perform that action at this time.
0 commit comments