1 GWORM_DIRS := $(shell cd $(TOP) && find src -type d)
2 GWORM_SRCS := $(shell cd $(TOP) && find src -type f -name '*.cpp')
3 GWORM_DEPS = $(GWORM_SRCS:%.cpp=%.d)
4 GWORM_OBJS = $(GWORM_SRCS:%.cpp=%.o)
7 GWORM_TEST_DIRS := $(shell cd $(TOP) && find tests -type d)
8 GWORM_TEST_SRCS := $(shell cd $(TOP) && find tests -type f -name '*.cpp')
9 GWORM_TEST_DEPS := $(GWORM_TEST_SRCS:%.cpp=%.d)
10 GWORM_TEST_OBJS := $(GWORM_TEST_SRCS:%.cpp=%.o)
11 GWORM_TEST_EXES := test-all
13 GWORM_FLAGS = $(strip \
16 GWORM_LIBS = $(strip \
20 GWORM_TEST_FLAGS = $(GWORM_FLAGS) $(CPPUNIT_FLAGS)
21 GWORM_TEST_LIBS = $(GWORM_LIBS) $(CPPUNIT_LIBS)
23 -include $(GWORM_DEPS)
24 -include $(GWORM_TEST_DEPS)
26 $(GWORM_OBJS): %.o: $(TOP)/%.cpp
29 $(VERBOSE) $(CXX) -c -o "$@" -MMD -MP -MF"$*.d" -MT"$@" "$<" \
30 $(GWORM_FLAGS) $(CPPFLAGS) $(CXXFLAGS)
32 $(GWORM_EXES): $(GWORM_OBJS)
35 $(VERBOSE) $(CXX) -o "$@" $^ \
36 $(GWORM_FLAGS) $(GWORM_LIBS) $(LDFLAGS)
38 $(GWORM_TEST_OBJS): %.o: $(TOP)/%.cpp
41 $(VERBOSE) $(CXX) -c -o "$@" -MMD -MP -MF"$*.d" -MT"$@" "$<" \
42 $(GWORM_TEST_FLAGS) $(CPPFLAGS) $(CXXFLAGS)
44 $(GWORM_TEST_EXES): $(GWORM_TEST_OBJS) $(filter-out src/main.o, $(GWORM_OBJS))
47 $(VERBOSE) $(CXX) -o "$@" $^ \
48 $(GWORM_TEST_FLAGS) $(GWORM_TEST_LIBS) $(LDFLAGS)
50 gworm-all: $(GWORM_EXES)
53 $(VERBOSE) -$(RM) $(GWORM_DEPS)
54 $(VERBOSE) -$(RM) $(GWORM_OBJS)
55 $(VERBOSE) -$(RM) $(GWORM_EXES)
56 $(VERBOSE) -$(RM) $(GWORM_TEST_DEPS)
57 $(VERBOSE) -$(RM) $(GWORM_TEST_OBJS)
58 $(VERBOSE) -$(RM) $(GWORM_TEST_EXES)
59 $(VERBOSE) -$(RMDIR) $(GWORM_DIRS)
60 $(VERBOSE) -$(RMDIR) $(GWORM_TEST_DIRS)
62 gworm-tests: $(GWORM_TEST_EXES)
64 gworm-test-all: test-all
65 @echo "test: test-all"
73 .PHONY: gworm-all gworm-clean gworm-tests gworm-test-all
75 -include $(BUILD)gworm-local.mk