Cosmetic: Commentary spelling corrections by Max Seidenstücker
[ode.git] / tests / UnitTest++ / Makefile.ori
blob97809d357fa22323e8c8a98158f294d14093e168
1 CC = g++
2 CCFLAGS = -g -ansi -Wall -W -ansi # -pedantic
3 SED = sed
4 MV = mv
5 RM = rm
7 .SUFFIXES: .o .cpp
9 lib = libUnitTest++.a
10 test = TestUnitTest++
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
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
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))
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
68 all: $(test)
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)
81 clean:
82         -@$(RM) $(objects) $(test_objects) $(dependencies) $(test_dependencies) $(test) $(lib) 2> /dev/null
84 %.o : %.cpp
85         @echo $<
86         @$(call make-depend,$<,$@,$(subst .o,.d,$@))
87         @$(CC) $(CCFLAGS) -c $< -o $(patsubst %.cpp, %.o, $<)
90 ifneq "$(MAKECMDGOALS)" "clean"
91 -include $(dependencies)
92 -include $(test_dependencies)
93 endif