blob: 1bd035daa13cfe1316aad9d565d31ffd20049e82 [file] [log] [blame]
Klement Sekera8f2a4ea2017-05-04 06:15:18 +02001BINDIR = $(BR)/vapi_test/
Klement Sekeradc15be22017-06-12 06:49:33 +02002CBIN = $(addprefix $(BINDIR), vapi_c_test)
3CPPBIN = $(addprefix $(BINDIR), vapi_cpp_test)
Klement Sekera8f2a4ea2017-05-04 06:15:18 +02004
Klement Sekerad3e671e2017-09-29 12:36:37 +02005ifeq ($(filter centos,$(OS_ID)),$(OS_ID))
6CPPBIN=
7endif
8
Marco Varlese5f1231c2017-10-10 16:43:14 +02009LIBS = -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
10ifneq ($(filter opensuse,$(OS_ID)),$(OS_ID))
11LIBS += -lsubunit
12endif
Klement Sekeradc15be22017-06-12 06:49:33 +020013CFLAGS = -std=gnu99 -g -Wall -pthread -I$(WS_ROOT)/src -I$(VPP_TEST_INSTALL_PATH)/vpp/include -I$(BINDIR)
14CPPFLAGS = -std=c++11 -g -Wall -pthread -I$(WS_ROOT)/src -I$(VPP_TEST_INSTALL_PATH)/vpp/include -I$(BINDIR)
15
16all: $(CBIN) $(CPPBIN)
Klement Sekera8f2a4ea2017-05-04 06:15:18 +020017
18$(BINDIR):
19 mkdir -p $(BINDIR)
20
Klement Sekeradc15be22017-06-12 06:49:33 +020021CSRC = vapi_c_test.c
Klement Sekera8f2a4ea2017-05-04 06:15:18 +020022
Klement Sekerad94c3e52017-09-26 09:21:24 +020023$(BINDIR)/fake.api.vapi.h: fake.api.json $(WS_ROOT)/src/vpp-api/vapi/vapi_c_gen.py | $(BINDIR)
Klement Sekeradc15be22017-06-12 06:49:33 +020024 $(WS_ROOT)/src/vpp-api/vapi/vapi_c_gen.py --prefix $(BINDIR) $<
25
Klement Sekerad94c3e52017-09-26 09:21:24 +020026$(BINDIR)/fake.api.vapi.hpp: fake.api.json $(WS_ROOT)/src/vpp-api/vapi/vapi_cpp_gen.py | $(BINDIR)
Klement Sekeradc15be22017-06-12 06:49:33 +020027 $(WS_ROOT)/src/vpp-api/vapi/vapi_cpp_gen.py --prefix $(BINDIR) $<
28
Klement Sekerad94c3e52017-09-26 09:21:24 +020029$(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 $(BINDIR)/fake.api.vapi.h
Klement Sekeradc15be22017-06-12 06:49:33 +020030 $(CC) -o $@ $(CFLAGS) $(CSRC) $(LIBS)
31
32CPPSRC = vapi_cpp_test.cpp
33
Klement Sekerad94c3e52017-09-26 09:21:24 +020034$(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 $(BINDIR)/fake.api.vapi.hpp
Klement Sekeradc15be22017-06-12 06:49:33 +020035 $(CXX) -o $@ $(CPPFLAGS) $(CPPSRC) $(LIBS)
Klement Sekera8f2a4ea2017-05-04 06:15:18 +020036
37clean:
38 rm -rf $(BINDIR)