18 10 11 12 13 14 15 16 17 18 19 \
37 @echo remove all binaries
38 @rm $(targets) *.gcno *.gcda *.o 2>/dev/null || true
40 #======================================================================================
42 #======================================================================================
44 incdir = $(basedir)/include
45 srcdir = $(basedir)/src
46 tstdir = $(basedir)/src/tests
47 samdir = $(basedir)/bindings/samples
49 bindir = $(heredir)/bin
51 deps = openssl libmicrohttpd json-c libsystemd uuid
56 $(shell pkg-config --cflags $(deps))
58 ldflags = -ldl -lrt -lpthread \
59 $(shell pkg-config --libs $(deps))
61 cflags = $(ccflags) $(ldflags)
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 \
72 -DBINDING_INSTALL_DIR=\"$(shell pwd)/fake\"
74 afb_lib_src = $(shell ls $(srcdir)/*.c | egrep -v '/afs-|/main-|/fdev-epoll.c|/afb-ws-client.c' )
75 afb_lib_obj = $(patsubst $(srcdir)/%.c,%.o,$(afb_lib_src))
77 afb_lib_defs = $(defs)
79 afb_daemon_srcs = $(srcdir)/main-afb-daemon.c $(afb_lib_obj)
80 afb_daemon_defs = $(afb_lib_defs)
82 afb_client_srcs = $(srcdir)/main-afb-client-demo.c $(srcdir)/afb-ws-client.c $(afb_lib_src)
83 afb_client_defs = $(defs)
86 tst_flags = $(cflags) \
88 $(shell pkg-config --cflags --libs check)
90 tst_defs = '-DAFB_VERSION="cov"' '-DBINDING_INSTALL_DIR="fake"'
91 tst_flags = $(cflags) \
93 $(shell pkg-config --cflags --libs check)
95 hello2_src = $(samdir)/hello2.c
96 hello3_src = $(samdir)/hello3.c
97 hi_src = $(samdir)/hi3.c
98 binding_flags = -shared -fPIC -Wl,--version-script=$(samdir)/export.map
100 #======================================================================================
101 # creates the targets
102 #======================================================================================
106 @gcc -c -o $@ $< --coverage $(afb_lib_defs) $(ccflags)
108 afb-daemon-cov: $(afb_daemon_srcs)
110 @gcc -o $@ $(afb_daemon_srcs) --coverage $(afb_daemon_defs) $(cflags)
112 afb-client: $(afb_client_srcs)
114 @gcc -o $@ $(afb_client_srcs) $(afb_client_defs) $(cflags)
116 #======================================================================================
118 #======================================================================================
120 test-apiset: $(tstdir)/apiset/test-apiset.c $(afb_lib_obj)
122 @gcc -o $@ $(tstdir)/apiset/test-apiset.c $(afb_lib_obj) --coverage $(tst_defs) $(tst_flags)
124 test-session: $(tstdir)/session/test-session.c $(afb_lib_obj)
126 @gcc -o $@ $(tstdir)/session/test-session.c $(afb_lib_obj) --coverage $(tst_defs) $(tst_flags)
128 test-wrap-json: $(tstdir)/session/test-session.c $(afb_lib_obj)
130 @gcc -o $@ $(tstdir)/wrap-json/test-wrap-json.c $(afb_lib_obj) --coverage $(tst_defs) $(tst_flags)
132 #======================================================================================
134 #======================================================================================
138 @gcc -o $@ $(hi3_src) $(binding_flags) $(cflags)
140 hello.so: $(hello3_src)
142 @gcc -o $@ $(hello3_src) '-DAPINAME="hello"' '-DPREINIT_PROVIDE_CLASS="class1 class2"' $(binding_flags) $(cflags)
144 salut.so: $(hello3_src)
146 @gcc -o $@ $(hello3_src) '-DAPINAME="salut"' '-DPREINIT_REQUIRE_CLASS="class2"' $(binding_flags) $(cflags)
148 salam.so: $(hello3_src)
150 @gcc -o $@ $(hello3_src) '-DAPINAME="salam"' '-DINIT_REQUIRE_API="hello salut"' $(binding_flags) $(cflags)
152 shalom.so: $(hello3_src)
154 @gcc -o $@ $(hello3_src) '-DAPINAME="shalom"' $(binding_flags) $(cflags)
156 demat.so: $(hello3_src)
158 @gcc -o $@ $(hello3_src) '-DAPINAME="demat"' $(binding_flags) $(cflags)
160 hellov2.so: $(hello2_src)
162 @gcc -o $@ $(hello2_src) '-DAPINAME="hello-v2"' $(binding_flags) $(cflags)
164 #======================================================================================
166 #======================================================================================
169 @echo creation of directory bugs
172 bugs/bug%.so: bug.c bugs
174 @gcc -o $@ bug.c $(binding_flags) $(cflags) -D$(patsubst bugs/bug%.so,BUG%,$@)