forked from cgreen-devs/cgreen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·83 lines (69 loc) · 2.03 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
# This Makefile ensures that the build is made out of source in a subdirectory called 'build'
# If it doesn't exist, it is created and a Makefile created there (from Makefile.build)
#
# 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 for C and C++, run some tests, install it locally and
# generate two distributable packages.
all: build
cd build; make
test: build
cd build; make test
clean: build
cd build; make clean
package: build
cd build; make package
install:
cd build; make install
# This is kind of a hack to get a quicker and clearer feedback when developing Cgreen
# 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)_messages_tests \
../../../tests \
$(1)_messages_tests.$$d.expected \
s%$$SOURCEDIR%%g
unit: build
SOURCEDIR=$$PWD/tests/ ; \
for d in c c++ ; do \
cd build/build-$$d ; \
make ; \
export PATH=src:$$PATH ; \
tools/cgreen-runner -c `find tests -name $(PREFIX)cgreen_tests$(SUFFIX)` ; \
tools/cgreen-runner -c `find tools/tests -name $(PREFIX)cgreen_runner_tests$(SUFFIX)` ; \
cd tests ; \
$(OUTPUT_DIFF) $(call OUTPUT_DIFF_ARGUMENTS,mock) ; \
$(OUTPUT_DIFF) $(call OUTPUT_DIFF_ARGUMENTS,constraint) ; \
$(OUTPUT_DIFF) $(call OUTPUT_DIFF_ARGUMENTS,assertion) ; \
CGREEN_PER_TEST_TIMEOUT=2 $(OUTPUT_DIFF) $(call OUTPUT_DIFF_ARGUMENTS,failure) ; \
cd ../../.. ; \
done
############# Internal
build:
mkdir build
cp Makefile.build build/Makefile
cd build; make dirs
.SILENT: