blob: 3959ac6bf2f82201a62a029846d8a3a12fb13ac2 [file] [log] [blame]
Neale Ranns812ed392017-10-16 04:20:13 -07001VAPI_BINDIR = $(BR)/vapi_test/
2VAPI_CBIN = $(addprefix $(VAPI_BINDIR), vapi_c_test)
3VAPI_CPPBIN = $(addprefix $(VAPI_BINDIR), vapi_cpp_test)
4VOM_BINDIR = $(BR)/vom_test/
5VOM_BIN = $(addprefix $(VOM_BINDIR), vom_test)
Klement Sekera8f2a4ea2017-05-04 06:15:18 +02006
Gabriel Ganne0e789422017-12-15 10:47:09 +01007ifeq ($(filter rhel centos,$(OS_ID)),$(OS_ID))
Neale Ranns812ed392017-10-16 04:20:13 -07008VAPI_CPPBIN=
Klement Sekerad3e671e2017-09-29 12:36:37 +02009endif
10
Neale Ranns812ed392017-10-16 04:20:13 -070011VAPI_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
Klement Sekerab6866042018-03-22 11:50:42 +010012ifneq ($(filter centos opensuse,$(OS_ID)),$(OS_ID))
Neale Ranns812ed392017-10-16 04:20:13 -070013VAPI_LIBS += -lsubunit
Marco Varlese5f1231c2017-10-10 16:43:14 +020014endif
Neale Ranns812ed392017-10-16 04:20:13 -070015CFLAGS = -std=gnu99 -g -Wall -pthread -I$(WS_ROOT)/src -I$(VPP_TEST_INSTALL_PATH)/vpp/include -I$(VAPI_BINDIR)
16CPPFLAGS = -std=c++11 -g -Wall -pthread -I$(WS_ROOT)/src -I$(VPP_TEST_INSTALL_PATH)/vpp/include -I$(VAPI_BINDIR)
Klement Sekeradc15be22017-06-12 06:49:33 +020017
Neale Ranns812ed392017-10-16 04:20:13 -070018all: $(VAPI_CBIN) $(VAPI_CPPBIN) $(VOM_BINDIR) $(VOM_BIN)
Klement Sekera8f2a4ea2017-05-04 06:15:18 +020019
Neale Ranns812ed392017-10-16 04:20:13 -070020$(VAPI_BINDIR):
21 mkdir -p $(VAPI_BINDIR)
Klement Sekera8f2a4ea2017-05-04 06:15:18 +020022
Klement Sekeradc15be22017-06-12 06:49:33 +020023CSRC = vapi_c_test.c
Klement Sekera8f2a4ea2017-05-04 06:15:18 +020024
Neale Ranns812ed392017-10-16 04:20:13 -070025$(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) $<
Klement Sekeradc15be22017-06-12 06:49:33 +020027
Neale Ranns812ed392017-10-16 04:20:13 -070028$(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) $<
Klement Sekeradc15be22017-06-12 06:49:33 +020030
Neale Ranns812ed392017-10-16 04:20:13 -070031$(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)
Klement Sekeradc15be22017-06-12 06:49:33 +020033
34CPPSRC = vapi_cpp_test.cpp
35
Neale Ranns812ed392017-10-16 04:20:13 -070036$(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
39VOM_CPPSRC = vom_test.cpp
40
41$(VOM_BINDIR):
42 mkdir -p $(VOM_BINDIR)
43
44LIB_VOM = $(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vom/.libs/libvom.so
45VOM_LIBS = $(LIB_VOM) \
Neale Ranns812ed392017-10-16 04:20:13 -070046 -lboost_thread \
47 -lboost_system \
48 -lboost_filesystem \
49 -lboost_unit_test_framework \
50 $(VAPI_LIBS)
51
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070052VOM_CPPFLAGS = \
53 -I $(WS_ROOT)/src/vpp-api/ \
54 $(CPPFLAGS)
55
Neale Ranns812ed392017-10-16 04:20:13 -070056$(VOM_BIN): $(VOM_CPPSRC) $(VOM_BINDIR) $(LIB_VOM) $(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vapi/.libs/libvapiclient.so
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070057 $(CXX) -o $@ $(VOM_CPPFLAGS) -DBOOST_LOG_DYN_LINK -O0 -g $(VOM_CPPSRC) $(VOM_LIBS)
Klement Sekera8f2a4ea2017-05-04 06:15:18 +020058
59clean:
Neale Ranns812ed392017-10-16 04:20:13 -070060 rm -rf $(VAPI_BINDIR) $(VOM_BINDIR)