VPPAPIGEN: Run tool directly from source tree.
[vpp.git] / test / ext / Makefile
1 VAPI_BINDIR = $(BR)/vapi_test/
2 VAPI_CBIN = $(addprefix $(VAPI_BINDIR), vapi_c_test)
3 VAPI_CPPBIN = $(addprefix $(VAPI_BINDIR), vapi_cpp_test)
4 VOM_BINDIR = $(BR)/vom_test/
5 VOM_BIN = $(addprefix $(VOM_BINDIR), vom_test)
6
7 ifeq ($(filter rhel centos,$(OS_ID)),$(OS_ID))
8 VAPI_CPPBIN=
9 endif
10
11 VAPI_LIBS = -L$(VPP_TEST_BUILD_DIR)/vpp/.libs/ -L$(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vapi/.libs/ -lvppinfra -lvlibmemoryclient -lsvm -lpthread -lcheck -lrt -lm -lvapiclient
12 ifneq ($(filter opensuse,$(OS_ID)),$(OS_ID))
13 VAPI_LIBS += -lsubunit
14 endif
15 CFLAGS = -std=gnu99 -g -Wall -pthread -I$(WS_ROOT)/src -I$(VPP_TEST_INSTALL_PATH)/vpp/include -I$(VAPI_BINDIR)
16 CPPFLAGS = -std=c++11 -g -Wall -pthread -I$(WS_ROOT)/src -I$(VPP_TEST_INSTALL_PATH)/vpp/include -I$(VAPI_BINDIR)
17
18 all: $(VAPI_CBIN) $(VAPI_CPPBIN) $(VOM_BINDIR) $(VOM_BIN)
19
20 $(VAPI_BINDIR):
21         mkdir -p $(VAPI_BINDIR)
22
23 CSRC = vapi_c_test.c
24
25 $(VAPI_BINDIR)/fake.api.vapi.h: fake.api.json $(WS_ROOT)/src/vpp-api/vapi/vapi_c_gen.py | $(VAPI_BINDIR)
26         $(WS_ROOT)/src/vpp-api/vapi/vapi_c_gen.py --prefix $(VAPI_BINDIR) $<
27
28 $(VAPI_BINDIR)/fake.api.vapi.hpp: fake.api.json $(WS_ROOT)/src/vpp-api/vapi/vapi_cpp_gen.py | $(VAPI_BINDIR)
29         $(WS_ROOT)/src/vpp-api/vapi/vapi_cpp_gen.py --prefix $(VAPI_BINDIR) $<
30
31 $(VAPI_CBIN): $(CSRC) $(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vapi/.libs/libvapiclient.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libvppinfra.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libvlibmemoryclient.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libsvm.so $(VAPI_BINDIR)/fake.api.vapi.h
32         $(CC) -o $@ $(CFLAGS) $(CSRC) $(VAPI_LIBS)
33
34 CPPSRC = vapi_cpp_test.cpp
35
36 $(VAPI_CPPBIN): $(CPPSRC) $(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vapi/.libs/libvapiclient.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libvppinfra.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libvlibmemoryclient.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libsvm.so $(VAPI_BINDIR)/fake.api.vapi.hpp
37         $(CXX) -o $@ $(CPPFLAGS) $(CPPSRC) $(VAPI_LIBS)
38
39 VOM_CPPSRC = vom_test.cpp
40
41 $(VOM_BINDIR):
42         mkdir -p $(VOM_BINDIR)
43
44 LIB_VOM = $(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vom/.libs/libvom.so
45 VOM_LIBS = $(LIB_VOM)   \
46         -lboost_thread                                  \
47         -lboost_system                                  \
48         -lboost_filesystem                              \
49         -lboost_unit_test_framework                     \
50         $(VAPI_LIBS)
51
52 VOM_CPPFLAGS = \
53         -I $(WS_ROOT)/src/vpp-api/ \
54         $(CPPFLAGS)
55
56 $(VOM_BIN): $(VOM_CPPSRC) $(VOM_BINDIR) $(LIB_VOM) $(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vapi/.libs/libvapiclient.so
57         $(CXX) -o $@ $(VOM_CPPFLAGS) -DBOOST_LOG_DYN_LINK -O0 -g $(VOM_CPPSRC) $(VOM_LIBS)
58
59 clean:
60         rm -rf $(VAPI_BINDIR) $(VOM_BINDIR)