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 -DBINDING_INSTALL_DIR=\"$(shell pwd)/fake\"
68 afb_lib_src = $(shell ls $(srcdir)/*.c | egrep -v '/afs-|/main-|/fdev-epoll.c|/afb-ws-client.c' )
69 afb_lib_obj = $(patsubst $(srcdir)/%.c,%.o,$(afb_lib_src))
71 afb_lib_defs = $(defs)
73 afb_daemon_srcs = $(srcdir)/main-afb-daemon.c $(afb_lib_obj)
74 afb_daemon_defs = $(afb_lib_defs)
76 afb_client_srcs = $(srcdir)/main-afb-client-demo.c $(srcdir)/afb-ws-client.c $(afb_lib_src)
77 afb_client_defs = $(defs)
80 tst_flags = $(cflags) \
82 $(shell pkg-config --cflags --libs check)
84 tst_defs = '-DAFB_VERSION="cov"' '-DBINDING_INSTALL_DIR="fake"'
85 tst_flags = $(cflags) \
87 $(shell pkg-config --cflags --libs check)
89 hello2_src = $(samdir)/hello2.c
90 hello3_src = $(samdir)/hello3.c
91 hi_src = $(samdir)/hi3.c
92 binding_flags = -shared -fPIC -Wl,--version-script=$(samdir)/export.map
94 #======================================================================================
96 #======================================================================================
100 @gcc -c -o $@ $< --coverage $(afb_lib_defs) $(ccflags)
102 afb-daemon-cov: $(afb_daemon_srcs)
104 @gcc -o $@ $(afb_daemon_srcs) --coverage $(afb_daemon_defs) $(cflags)
106 afb-client: $(afb_client_srcs)
108 @gcc -o $@ $(afb_client_srcs) $(afb_client_defs) $(cflags)
110 #======================================================================================
112 #======================================================================================
114 test-apiset: $(tstdir)/apiset/test-apiset.c $(afb_lib_obj)
116 @gcc -o $@ $(tstdir)/apiset/test-apiset.c $(afb_lib_obj) --coverage $(tst_defs) $(tst_flags)
118 test-session: $(tstdir)/session/test-session.c $(afb_lib_obj)
120 @gcc -o $@ $(tstdir)/session/test-session.c $(afb_lib_obj) --coverage $(tst_defs) $(tst_flags)
122 test-wrap-json: $(tstdir)/session/test-session.c $(afb_lib_obj)
124 @gcc -o $@ $(tstdir)/wrap-json/test-wrap-json.c $(afb_lib_obj) --coverage $(tst_defs) $(tst_flags)
126 #======================================================================================
128 #======================================================================================
132 @gcc -o $@ $(hi3_src) $(binding_flags) $(cflags)
134 hello.so: $(hello3_src)
136 @gcc -o $@ $(hello3_src) '-DAPINAME="hello"' '-DPREINIT_PROVIDE_CLASS="class1 class2"' $(binding_flags) $(cflags)
138 salut.so: $(hello3_src)
140 @gcc -o $@ $(hello3_src) '-DAPINAME="salut"' '-DPREINIT_REQUIRE_CLASS="class2"' $(binding_flags) $(cflags)
142 salam.so: $(hello3_src)
144 @gcc -o $@ $(hello3_src) '-DAPINAME="salam"' '-DINIT_REQUIRE_API="hello salut"' $(binding_flags) $(cflags)
146 shalom.so: $(hello3_src)
148 @gcc -o $@ $(hello3_src) '-DAPINAME="shalom"' $(binding_flags) $(cflags)
150 demat.so: $(hello3_src)
152 @gcc -o $@ $(hello3_src) '-DAPINAME="demat"' $(binding_flags) $(cflags)
154 hellov2.so: $(hello2_src)
156 @gcc -o $@ $(hello2_src) '-DAPINAME="hello-v2"' $(binding_flags) $(cflags)
158 #======================================================================================
160 #======================================================================================
163 @echo creation of directory bugs
166 bugs/bug%.so: bug.c bugs
168 @gcc -o $@ bug.c $(binding_flags) $(cflags) -D$(patsubst bugs/bug%.so,BUG%,$@)