18 10 11 12 13 14 15 16 17 18 19 \
38 @echo remove all binaries
39 @rm $(targets) *.gcno *.gcda *.o 2>/dev/null || true
41 #======================================================================================
43 #======================================================================================
45 incdir = $(basedir)/include
46 srcdir = $(basedir)/src
47 tstdir = $(basedir)/src/tests
48 samdir = $(basedir)/bindings/samples
50 bindir = $(heredir)/bin
52 deps = openssl libmicrohttpd json-c libsystemd uuid
57 $(shell pkg-config --cflags $(deps))
59 ldflags = -ldl -lrt -lpthread \
60 $(shell pkg-config --libs $(deps))
62 cflags = $(ccflags) $(ldflags)
64 defs = -DAGL_DEVEL=1 \
65 -DWITH_MONITORING_OPTION \
66 -DAFB_VERSION=\"cov\" \
67 -DUSE_SIG_MONITOR_DUMPSTACK=1 \
68 -DUSE_SIG_MONITOR_SIGNALS=1 \
69 -DUSE_SIG_MONITOR_FOR_CALL=1 \
70 -DUSE_SIG_MONITOR_TIMERS=1 \
73 -DWITH_LEGACY_BINDING_V1=0 \
74 -DWITH_LEGACY_BINDING_V2=1 \
75 -DWITH_LEGACY_BINDING_VDYN=0 \
76 -DWITH_DBUS_TRANSPARENCY=0 \
77 -DWITH_SUPERVISION=0 \
78 -DWITH_DYNAMIC_BINDING=1 \
79 -DINTRINSIC_BINDING_DIR=\"$(shell pwd)/fake\"
81 afb_lib_src = $(shell ls $(srcdir)/*.c | egrep -v '/afs-|/main-|/fdev-epoll.c|/afb-ws-client.c' )
82 afb_lib_obj = $(patsubst $(srcdir)/%.c,%.o,$(afb_lib_src))
84 afb_lib_defs = $(defs)
86 afb_daemon_srcs = $(srcdir)/main-afb-daemon.c
87 afb_daemon_defs = $(afb_lib_defs)
89 afb_client_srcs = $(srcdir)/main-afb-client-demo.c $(srcdir)/afb-ws-client.c $(afb_lib_src)
90 afb_client_defs = $(defs)
93 tst_flags = $(cflags) \
95 $(shell pkg-config --cflags --libs check)
97 tst_defs = '-DAFB_VERSION="cov"' '-DINTRINSIC_BINDING_DIR="fake"'
98 tst_flags = $(cflags) \
100 $(shell pkg-config --cflags --libs check)
102 hello2_src = $(samdir)/hello2.c
103 hello3_src = $(samdir)/hello3.c
104 hi_src = $(samdir)/hi3.c
105 binding_flags = -shared -fPIC -Wl,--version-script=$(samdir)/export.map
107 #======================================================================================
108 # creates the targets
109 #======================================================================================
113 @gcc -c -o $@ $< --coverage $(afb_lib_defs) $(ccflags)
115 afb-daemon-cov: $(afb_daemon_srcs) $(afb_lib_obj)
117 @gcc -o $@ $(afb_daemon_srcs) $(afb_lib_obj) --coverage $(afb_daemon_defs) $(cflags)
119 afb-daemon-nocov: $(afb_daemon_srcs) $(afb_lib_src)
121 @gcc -o $@ $(afb_daemon_srcs) $(afb_lib_src) $(afb_daemon_defs) $(cflags)
123 afb-client: $(afb_client_srcs)
125 @gcc -o $@ $(afb_client_srcs) $(afb_client_defs) $(cflags)
127 #======================================================================================
129 #======================================================================================
131 test-apiset: $(tstdir)/apiset/test-apiset.c $(afb_lib_obj)
133 @gcc -o $@ $(tstdir)/apiset/test-apiset.c $(afb_lib_obj) --coverage $(tst_defs) $(tst_flags)
135 test-session: $(tstdir)/session/test-session.c $(afb_lib_obj)
137 @gcc -o $@ $(tstdir)/session/test-session.c $(afb_lib_obj) --coverage $(tst_defs) $(tst_flags)
139 test-wrap-json: $(tstdir)/session/test-session.c $(afb_lib_obj)
141 @gcc -o $@ $(tstdir)/wrap-json/test-wrap-json.c $(afb_lib_obj) --coverage $(tst_defs) $(tst_flags)
143 #======================================================================================
145 #======================================================================================
149 @gcc -o $@ $(hi3_src) $(binding_flags) $(cflags)
151 hello.so: $(hello3_src)
153 @gcc -o $@ $(hello3_src) '-DAPINAME="hello"' '-DPREINIT_PROVIDE_CLASS="class1 class2"' $(binding_flags) $(cflags)
155 salut.so: $(hello3_src)
157 @gcc -o $@ $(hello3_src) '-DAPINAME="salut"' '-DPREINIT_REQUIRE_CLASS="class2"' $(binding_flags) $(cflags)
159 salam.so: $(hello3_src)
161 @gcc -o $@ $(hello3_src) '-DAPINAME="salam"' '-DINIT_REQUIRE_API="hello salut"' $(binding_flags) $(cflags)
163 shalom.so: $(hello3_src)
165 @gcc -o $@ $(hello3_src) '-DAPINAME="shalom"' $(binding_flags) $(cflags)
167 demat.so: $(hello3_src)
169 @gcc -o $@ $(hello3_src) '-DAPINAME="demat"' $(binding_flags) $(cflags)
171 hellov2.so: $(hello2_src)
173 @gcc -o $@ $(hello2_src) '-DAPINAME="hello-v2"' $(binding_flags) $(cflags)
175 #======================================================================================
177 #======================================================================================
180 @echo creation of directory bugs
183 bugs/bug%.so: bug.c bugs
185 @gcc -o $@ bug.c $(binding_flags) $(cflags) -D$(patsubst bugs/bug%.so,BUG%,$@)