comparison ext/UnitTest++/Makefile @ 89:fa33cda75471

* Reverting back to 2543 as requested by sleek
author mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
date Sat, 19 Jul 2008 11:38:52 +0000
parents 0d325e9d5953
children
comparison
equal deleted inserted replaced
88:1c2842ebe393 89:fa33cda75471
1 CC = g++
2 CCFLAGS = -g -ansi -Wall -W -ansi # -pedantic
3 SED = sed
4 MV = mv
5 RM = rm
6
7 .SUFFIXES: .o .cpp
8
9 lib = libUnitTest++.a
10 test = TestUnitTest++
11
12 src = src/AssertException.cpp \
13 src/Test.cpp \
14 src/Checks.cpp \
15 src/TestRunner.cpp \
16 src/TestResults.cpp \
17 src/TestReporter.cpp \
18 src/TestReporterStdout.cpp \
19 src/ReportAssert.cpp \
20 src/TestList.cpp \
21 src/TimeConstraint.cpp \
22 src/TestDetails.cpp \
23 src/MemoryOutStream.cpp \
24 src/DeferredTestReporter.cpp \
25 src/DeferredTestResult.cpp \
26 src/XmlTestReporter.cpp
27
28 ifeq ($(MSYSTEM), MINGW32)
29 src += src/Win32/TimeHelpers.cpp
30 else
31 src += src/Posix/SignalTranslator.cpp \
32 src/Posix/TimeHelpers.cpp
33 endif
34
35 test_src = src/tests/Main.cpp \
36 src/tests/TestAssertHandler.cpp \
37 src/tests/TestChecks.cpp \
38 src/tests/TestUnitTest++.cpp \
39 src/tests/TestTest.cpp \
40 src/tests/TestTestResults.cpp \
41 src/tests/TestTestRunner.cpp \
42 src/tests/TestCheckMacros.cpp \
43 src/tests/TestTestList.cpp \
44 src/tests/TestTestMacros.cpp \
45 src/tests/TestTimeConstraint.cpp \
46 src/tests/TestTimeConstraintMacro.cpp \
47 src/tests/TestMemoryOutStream.cpp \
48 src/tests/TestDeferredTestReporter.cpp \
49 src/tests/TestXmlTestReporter.cpp
50
51 objects = $(patsubst %.cpp, %.o, $(src))
52 test_objects = $(patsubst %.cpp, %.o, $(test_src))
53 dependencies = $(subst .o,.d,$(objects))
54 test_dependencies = $(subst .o,.d,$(test_objects))
55
56 define make-depend
57 $(CC) $(CCFLAGS) -M $1 | \
58 $(SED) -e 's,\($(notdir $2)\) *:,$(dir $2)\1: ,' > $3.tmp
59 $(SED) -e 's/#.*//' \
60 -e 's/^[^:]*: *//' \
61 -e 's/ *\\$$//' \
62 -e '/^$$/ d' \
63 -e 's/$$/ :/' $3.tmp >> $3.tmp
64 $(MV) $3.tmp $3
65 endef
66
67
68 all: $(test)
69
70
71 $(lib): $(objects)
72 @echo Creating $(lib) library...
73 @ar cr $(lib) $(objects)
74
75 $(test): $(lib) $(test_objects)
76 @echo Linking $(test)...
77 @$(CC) -o $(test) $(test_objects) $(lib)
78 @echo Running unit tests...
79 @./$(test)
80
81 clean:
82 -@$(RM) $(objects) $(test_objects) $(dependencies) $(test_dependencies) $(test) $(lib) 2> /dev/null
83
84 %.o : %.cpp
85 @echo $<
86 @$(call make-depend,$<,$@,$(subst .o,.d,$@))
87 @$(CC) $(CCFLAGS) -c $< -o $(patsubst %.cpp, %.o, $<)
88
89
90 ifneq "$(MAKECMDGOALS)" "clean"
91 -include $(dependencies)
92 -include $(test_dependencies)
93 endif