/[projet1]/public/pc/shared_libraries/unittestcpp/v1.4/Makefile
Defence Force logotype

Contents of /public/pc/shared_libraries/unittestcpp/v1.4/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 893 - (show annotations)
Wed Sep 26 00:33:25 2012 UTC (7 years, 1 month ago) by mmu_man
File size: 2601 byte(s)
Only run test when target and host OS are the same.

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

  ViewVC Help
Powered by ViewVC 1.1.26