source: trunk/icedtea-web/tests/UnitTest++/Makefile

Last change on this file was 427, checked in by dmik, 11 years ago

icedtea-web: Import version 1.5.1 from vendor.

File size: 2.2 KB
Line 
1CXX = g++
2CXXFLAGS ?= -g -Wall -W -ansi # -pedantic
3LDFLAGS ?=
4SED = sed
5MV = mv
6RM = rm
7
8.SUFFIXES: .o .cpp
9
10lib = libUnitTest++.a
11test = TestUnitTest++
12
13src = src/AssertException.cpp \
14 src/Test.cpp \
15 src/Checks.cpp \
16 src/TestRunner.cpp \
17 src/TestResults.cpp \
18 src/TestReporter.cpp \
19 src/TestReporterStdout.cpp \
20 src/ReportAssert.cpp \
21 src/TestList.cpp \
22 src/TimeConstraint.cpp \
23 src/TestDetails.cpp \
24 src/MemoryOutStream.cpp \
25 src/DeferredTestReporter.cpp \
26 src/DeferredTestResult.cpp \
27 src/XmlTestReporter.cpp \
28 src/CurrentTest.cpp
29
30ifeq ($(MSYSTEM), MINGW32)
31 src += src/Win32/TimeHelpers.cpp
32else
33 src += src/Posix/SignalTranslator.cpp \
34 src/Posix/TimeHelpers.cpp
35endif
36
37test_src = src/tests/Main.cpp \
38 src/tests/TestAssertHandler.cpp \
39 src/tests/TestChecks.cpp \
40 src/tests/TestUnitTest++.cpp \
41 src/tests/TestTest.cpp \
42 src/tests/TestTestResults.cpp \
43 src/tests/TestTestRunner.cpp \
44 src/tests/TestCheckMacros.cpp \
45 src/tests/TestTestList.cpp \
46 src/tests/TestTestMacros.cpp \
47 src/tests/TestTimeConstraint.cpp \
48 src/tests/TestTimeConstraintMacro.cpp \
49 src/tests/TestMemoryOutStream.cpp \
50 src/tests/TestDeferredTestReporter.cpp \
51 src/tests/TestXmlTestReporter.cpp \
52 src/tests/TestCurrentTest.cpp
53
54objects = $(patsubst %.cpp, %.o, $(src))
55test_objects = $(patsubst %.cpp, %.o, $(test_src))
56dependencies = $(subst .o,.d,$(objects))
57test_dependencies = $(subst .o,.d,$(test_objects))
58
59define make-depend
60 $(CXX) $(CXXFLAGS) -M $1 | \
61 $(SED) -e 's,\($(notdir $2)\) *:,$(dir $2)\1: ,' > $3.tmp
62 $(SED) -e 's/#.*//' \
63 -e 's/^[^:]*: *//' \
64 -e 's/ *\\$$//' \
65 -e '/^$$/ d' \
66 -e 's/$$/ :/' $3.tmp >> $3.tmp
67 $(MV) $3.tmp $3
68endef
69
70
71all: $(lib)
72
73
74$(lib): $(objects)
75 @echo Creating $(lib) library...
76 @ar cr $(lib) $(objects)
77
78$(test): $(lib) $(test_objects)
79 @echo Linking $(test)...
80 @$(CXX) $(LDFLAGS) -o $(test) $(test_objects) $(lib)
81 @echo Running unit tests...
82 @./$(test)
83
84clean:
85 -@$(RM) $(objects) $(test_objects) $(dependencies) $(test_dependencies) $(test) $(lib) 2> /dev/null
86
87%.o : %.cpp
88 @echo $<
89 @$(call make-depend,$<,$@,$(subst .o,.d,$@))
90 @$(CXX) $(CXXFLAGS) -c $< -o $(patsubst %.cpp, %.o, $<)
91
92
93ifneq "$(MAKECMDGOALS)" "clean"
94-include $(dependencies)
95-include $(test_dependencies)
96endif
Note: See TracBrowser for help on using the repository browser.