Allow to tune installation directories
[src/app-framework-binder.git] / coverage / bin / Makefile
1
2 .PHONY: clean binaries
3
4 heredir = .
5 basedir = ../..
6
7 bindings = \
8         hi3.so \
9         hello.so \
10         salut.so \
11         salam.so \
12         shalom.so \
13         demat.so \
14         hellov2.so
15
16 bugs = $(foreach i,\
17         1 2 3 4 5 6 7 8 9 \
18         10 11 12 13 14 15 16 17 18 19 \
19         20 21, \
20         bugs/bug$i.so)
21
22 tests = \
23         test-apiset \
24         test-session \
25         test-wrap-json
26
27 targets = \
28         afb-daemon-cov \
29         afb-client \
30         $(tests) \
31         $(bindings) \
32         $(bugs)
33
34 binaries: $(targets)
35
36 clean:
37         @echo remove all binaries
38         @rm $(targets) *.gcno *.gcda *.o  2>/dev/null || true
39
40 #======================================================================================
41 # definitions
42 #======================================================================================
43
44 incdir = $(basedir)/include
45 srcdir = $(basedir)/src
46 tstdir = $(basedir)/src/tests
47 samdir = $(basedir)/bindings/samples
48
49 bindir = $(heredir)/bin
50
51 deps = openssl libmicrohttpd json-c libsystemd uuid
52
53 ccflags = \
54         -g \
55         -I$(incdir) \
56         $(shell pkg-config --cflags $(deps))
57
58 ldflags = -ldl -lrt -lpthread \
59         $(shell pkg-config --libs $(deps))
60
61 cflags = $(ccflags) $(ldflags)
62
63 defs =  -DAGL_DEVEL=1 \
64         -DWITH_MONITORING_OPTION \
65         -DAFB_VERSION=\"cov\" \
66         -DUSE_SIG_MONITOR_DUMPSTACK=1 \
67         -DUSE_SIG_MONITOR_SIGNALS=1 \
68         -DUSE_SIG_MONITOR_FOR_CALL=1 \
69         -DUSE_SIG_MONITOR_TIMERS=1 \
70         -DWITH_AFB_HOOK=1 \
71         -DWITH_AFB_TRACE=1 \
72         -DWITH_LEGACY_BINDING_V1=0 \
73         -DWITH_LEGACY_BINDING_V2=1 \
74         -DWITH_LEGACY_BINDING_VDYN=0 \
75         -DWITH_DBUS_TRANSPARENCY=0 \
76         -DWITH_SUPERVISION=0 \
77         -DWITH_DYNAMIC_BINDING=1 \
78         -DINTRINSIC_BINDING_DIR=\"$(shell pwd)/fake\"
79
80 afb_lib_src = $(shell ls $(srcdir)/*.c | egrep -v '/afs-|/main-|/fdev-epoll.c|/afb-ws-client.c' )
81 afb_lib_obj = $(patsubst $(srcdir)/%.c,%.o,$(afb_lib_src))
82 afb_lib = afb-lib.a
83 afb_lib_defs = $(defs)
84
85 afb_daemon_srcs = $(srcdir)/main-afb-daemon.c $(afb_lib_obj)
86 afb_daemon_defs = $(afb_lib_defs)
87
88 afb_client_srcs = $(srcdir)/main-afb-client-demo.c $(srcdir)/afb-ws-client.c $(afb_lib_src)
89 afb_client_defs = $(defs)
90
91 tst_defs = $(defs)
92 tst_flags = $(cflags) \
93         -I$(srcdir) \
94         $(shell pkg-config --cflags --libs check)
95
96 tst_defs = '-DAFB_VERSION="cov"' '-DINTRINSIC_BINDING_DIR="fake"'
97 tst_flags = $(cflags) \
98         -I$(srcdir) \
99         $(shell pkg-config --cflags --libs check)
100
101 hello2_src = $(samdir)/hello2.c
102 hello3_src = $(samdir)/hello3.c
103 hi_src = $(samdir)/hi3.c
104 binding_flags = -shared -fPIC -Wl,--version-script=$(samdir)/export.map
105
106 #======================================================================================
107 # creates the targets
108 #======================================================================================
109
110 %.o: $(srcdir)/%.c
111         @echo creation of $@
112         @gcc -c -o $@ $< --coverage $(afb_lib_defs) $(ccflags)
113
114 afb-daemon-cov: $(afb_daemon_srcs)
115         @echo creation of $@
116         @gcc -o $@ $(afb_daemon_srcs) --coverage $(afb_daemon_defs) $(cflags)
117
118 afb-client: $(afb_client_srcs)
119         @echo creation of $@
120         @gcc -o $@ $(afb_client_srcs) $(afb_client_defs) $(cflags)
121
122 #======================================================================================
123 # create test
124 #======================================================================================
125
126 test-apiset: $(tstdir)/apiset/test-apiset.c $(afb_lib_obj)
127         @echo creation of $@
128         @gcc -o $@ $(tstdir)/apiset/test-apiset.c $(afb_lib_obj) --coverage $(tst_defs) $(tst_flags)
129
130 test-session: $(tstdir)/session/test-session.c $(afb_lib_obj)
131         @echo creation of $@
132         @gcc -o $@ $(tstdir)/session/test-session.c $(afb_lib_obj) --coverage $(tst_defs) $(tst_flags)
133
134 test-wrap-json: $(tstdir)/session/test-session.c $(afb_lib_obj)
135         @echo creation of $@
136         @gcc -o $@ $(tstdir)/wrap-json/test-wrap-json.c $(afb_lib_obj) --coverage $(tst_defs) $(tst_flags)
137
138 #======================================================================================
139 # create bindings
140 #======================================================================================
141
142 hi3.so: $(hi3_src)
143         @echo creation of $@
144         @gcc -o $@ $(hi3_src) $(binding_flags) $(cflags)
145
146 hello.so: $(hello3_src)
147         @echo creation of $@
148         @gcc -o $@ $(hello3_src) '-DAPINAME="hello"' '-DPREINIT_PROVIDE_CLASS="class1 class2"' $(binding_flags) $(cflags)
149
150 salut.so: $(hello3_src)
151         @echo creation of $@
152         @gcc -o $@ $(hello3_src) '-DAPINAME="salut"' '-DPREINIT_REQUIRE_CLASS="class2"' $(binding_flags) $(cflags)
153
154 salam.so: $(hello3_src)
155         @echo creation of $@
156         @gcc -o $@ $(hello3_src) '-DAPINAME="salam"' '-DINIT_REQUIRE_API="hello salut"' $(binding_flags) $(cflags)
157
158 shalom.so: $(hello3_src)
159         @echo creation of $@
160         @gcc -o $@ $(hello3_src) '-DAPINAME="shalom"' $(binding_flags) $(cflags)
161
162 demat.so: $(hello3_src)
163         @echo creation of $@
164         @gcc -o $@ $(hello3_src) '-DAPINAME="demat"' $(binding_flags) $(cflags)
165
166 hellov2.so: $(hello2_src)
167         @echo creation of $@
168         @gcc -o $@ $(hello2_src) '-DAPINAME="hello-v2"' $(binding_flags) $(cflags)
169
170 #======================================================================================
171 # create bugs
172 #======================================================================================
173
174 bugs:
175         @echo creation of directory bugs
176         @mkdir bugs
177
178 bugs/bug%.so: bug.c bugs
179         @echo creation of $@
180         @gcc -o $@ bug.c $(binding_flags) $(cflags) -D$(patsubst bugs/bug%.so,BUG%,$@)