/[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 886 - (show annotations)
Wed Sep 26 00:18:23 2012 UTC (7 years, 4 months ago) by mmu_man
File size: 2506 byte(s)
Make unittest lib buildable with mingw on linux.

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

  ViewVC Help
Powered by ViewVC 1.1.26