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