18 10 11 12 13 14 15 16 17 18 19 \
39 @echo remove all binaries
40 @rm $(targets) *.gcno *.gcda *.o 2>/dev/null || true
42 #======================================================================================
44 #======================================================================================
46 incdir = $(basedir)/include
47 srcdir = $(basedir)/src
48 tstdir = $(basedir)/src/tests
49 samdir = $(basedir)/bindings/samples
51 bindir = $(heredir)/bin
53 deps = openssl libmicrohttpd json-c libsystemd uuid
58 $(shell pkg-config --cflags $(deps))
60 ldflags = -ldl -lrt -lpthread \
61 $(shell pkg-config --libs $(deps))
63 cflags = $(ccflags) $(ldflags)
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 \
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\"
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))
85 afb_lib_defs = $(defs)
87 afb_daemon_srcs = $(srcdir)/main-afb-daemon.c
88 afb_daemon_defs = $(afb_lib_defs)
90 afb_client_srcs = $(srcdir)/main-afb-client-demo.c $(srcdir)/afb-ws-client.c $(afb_lib_src)
91 afb_client_defs = $(defs)
94 tst_flags = $(cflags) \
96 $(shell pkg-config --cflags --libs check)
98 tst_defs = '-DAFB_VERSION="cov"' '-DINTRINSIC_BINDING_DIR="fake"'
99 tst_flags = $(cflags) \
101 $(shell pkg-config --cflags --libs check)
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
108 #======================================================================================
109 # creates the targets
110 #======================================================================================
114 @gcc -c -o $@ $< --coverage $(afb_lib_defs) $(ccflags)
116 afb-daemon-cov: $(afb_daemon_srcs) $(afb_lib_obj)
118 @gcc -o $@ $(afb_daemon_srcs) $(afb_lib_obj) --coverage $(afb_daemon_defs) $(cflags)
120 afb-daemon-nocov: $(afb_daemon_srcs) $(afb_lib_src)
122 @gcc -o $@ $(afb_daemon_srcs) $(afb_lib_src) $(afb_daemon_defs) $(cflags)
124 afb-client: $(afb_client_srcs)
126 @gcc -o $@ $(afb_client_srcs) $(afb_client_defs) $(cflags)
128 #======================================================================================
130 #======================================================================================
132 test-apiset: $(tstdir)/apiset/test-apiset.c $(afb_lib_obj)
134 @gcc -o $@ $(tstdir)/apiset/test-apiset.c $(afb_lib_obj) --coverage $(tst_defs) $(tst_flags)
136 test-session: $(tstdir)/session/test-session.c $(afb_lib_obj)
138 @gcc -o $@ $(tstdir)/session/test-session.c $(afb_lib_obj) --coverage $(tst_defs) $(tst_flags)
140 test-wrap-json: $(tstdir)/session/test-session.c $(afb_lib_obj)
142 @gcc -o $@ $(tstdir)/wrap-json/test-wrap-json.c $(afb_lib_obj) --coverage $(tst_defs) $(tst_flags)
144 test-u16id: $(tstdir)/u16id/test-u16id.c $(afb_lib_obj)
146 @gcc -o $@ $(tstdir)/u16id/test-u16id.c $(afb_lib_obj) --coverage $(tst_defs) $(tst_flags)
148 #======================================================================================
150 #======================================================================================
154 @gcc -o $@ $(hi3_src) $(binding_flags) $(cflags)
156 hello.so: $(hello3_src)
158 @gcc -o $@ $(hello3_src) '-DAPINAME="hello"' '-DPREINIT_PROVIDE_CLASS="class1 class2"' $(binding_flags) $(cflags)
160 salut.so: $(hello3_src)
162 @gcc -o $@ $(hello3_src) '-DAPINAME="salut"' '-DPREINIT_REQUIRE_CLASS="class2"' $(binding_flags) $(cflags)
164 salam.so: $(hello3_src)
166 @gcc -o $@ $(hello3_src) '-DAPINAME="salam"' '-DINIT_REQUIRE_API="hello salut"' $(binding_flags) $(cflags)
168 shalom.so: $(hello3_src)
170 @gcc -o $@ $(hello3_src) '-DAPINAME="shalom"' $(binding_flags) $(cflags)
172 demat.so: $(hello3_src)
174 @gcc -o $@ $(hello3_src) '-DAPINAME="demat"' $(binding_flags) $(cflags)
176 hellov2.so: $(hello2_src)
178 @gcc -o $@ $(hello2_src) '-DAPINAME="hello-v2"' $(binding_flags) $(cflags)
180 #======================================================================================
182 #======================================================================================
185 @echo creation of directory bugs
188 bugs/bug%.so: bug.c bugs
190 @gcc -o $@ bug.c $(binding_flags) $(cflags) -D$(patsubst bugs/bug%.so,BUG%,$@)