forked from cgreen-devs/cgreen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·127 lines (104 loc) · 3.42 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# This Makefile ensures that the build is made out of source in a
# subdirectory called 'build' If it doesn't exist, it is created.
#
# This Makefile also contains delegation of the most common make commands
#
# If you have cmake installed you should be able to do:
#
# make
# make test
# make install
# make package
#
# That should build Cgreen in the build directory, run some tests,
# install it locally and generate a distributable package.
all: build
cd build; make
.PHONY:debug
debug: build
cd build; cmake -DCMAKE_BUILD_TYPE:string=Debug ..; make
# TODO: verify that we're not already on CygwinXX, in that case "make" should suffice
.PHONY:cygwin32
cygwin32: build
cd build; cmake -DCMAKE_C_COMPILER=i686-pc-cygwin-gcc -DCMAKE_CXX_COMPILER=i686-pc-cygwin-g++ -DCMAKE_INSTALL_BINDIR:string=bin32 -DCMAKE_INSTALL_LIBDIR:string=lib32 ..; make
.PHONY:cygwin64
cygwin64: build
cd build; cmake -DCMAKE_C_COMPILER=i686-pc-cygwin-gcc -DCMAKE_CXX_COMPILER=i686-pc-cygwin-g++ ..; make
.PHONY:test
test: build
cd build; make check
.PHONY:clean
clean: build
cd build; make clean
.PHONY:package
package: build
cd build; make package
.PHONY:install
install:
cd build; make install
# This is kind of a hack to get a quicker and clearer feedback when
# developing Cgreen by using 'make unit'. Should be updated when new
# test libraries or output comparisons are added.
# Find out if 'uname -o' works, if it does - use it, otherwise use 'uname -s'
UNAMEOEXISTS=$(shell uname -o 1>&2 2>/dev/null; echo $$?)
ifeq ($(UNAMEOEXISTS),0)
OS=$(shell uname -o)
else
OS=$(shell uname -s)
endif
ifeq ($(OS),Darwin)
PREFIX=lib
SUFFIX=.dylib
else ifeq ($(OS),Cygwin)
PREFIX=cyg
SUFFIX=.dll
else
PREFIX=lib
SUFFIX=.so
endif
OUTPUT_DIFF=../../tools/cgreen_runner_output_diff
OUTPUT_DIFF_ARGUMENTS = $(1)_tests \
../../tests \
$(1)_tests.expected
unit: build-it
# Ensure the dynamic libraries can be found even on DLL-platforms without altering
# user process PATH
export PATH=$$PWD/build/src:$$PATH ; \
SOURCEDIR=$$PWD/tests/ ; \
cd build ; \
tools/cgreen-runner -c `find tests -name $(PREFIX)cgreen_c_tests$(SUFFIX)` ; \
r=$$((r + $$?)) ; \
tools/cgreen-runner -c `find tests -name $(PREFIX)cgreen_cpp_tests$(SUFFIX)` ; \
r=$$((r + $$?)) ; \
tools/cgreen-runner -c `find tools/tests -name $(PREFIX)cgreen_runner_tests$(SUFFIX)` ; \
r=$$((r + $$?)) ; \
cd tests ; \
../../tools/cgreen_xml_output_diff $(call OUTPUT_DIFF_ARGUMENTS,xml_output) ; \
r=$$((r + $$?)) ; \
$(OUTPUT_DIFF) $(call OUTPUT_DIFF_ARGUMENTS,mock_messages) ; \
r=$$((r + $$?)) ; \
$(OUTPUT_DIFF) $(call OUTPUT_DIFF_ARGUMENTS,constraint_messages) ; \
r=$$((r + $$?)) ; \
$(OUTPUT_DIFF) $(call OUTPUT_DIFF_ARGUMENTS,assertion_messages) ; \
r=$$((r + $$?)) ; \
$(OUTPUT_DIFF) $(call OUTPUT_DIFF_ARGUMENTS,ignore_messages) ; \
r=$$((r + $$?)) ; \
CGREEN_PER_TEST_TIMEOUT=1 $(OUTPUT_DIFF) $(call OUTPUT_DIFF_ARGUMENTS,failure_messages) ; \
r=$$((r + $$?)) ; \
exit $$r
.PHONY: doc
doc: build
cd build; cmake -DCGREEN_WITH_HTML_DOCS:bool=TRUE ..; make; cmake -DCGREEN_WITH_HTML_DOCS:bool=False ..; echo open $(PWD)/build/doc/cgreen-guide-en.html
pdf: build
cd build; cmake -DCGREEN_WITH_PDF_DOCS:bool=TRUE ..; make; cmake -DCGREEN_WITH_PDF_DOCS:bool=False ..; echo open $(PWD)/build/doc/cgreen-guide-en.pdf
############# Internal
ifeq ($(OS),Darwin)
ARCHS=-DCMAKE_OSX_ARCHITECTURES:string="x86_64;i386"
endif
build-it: build
cd build
make
build:
mkdir build
cd build; cmake $(ARCHS) ..
.SILENT: