blob: a66a72c35dc06ee51d3b2daaa9fd68f2cc29011c [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
Damjan Marion164e5f82018-04-25 19:11:15 +020011VAPI_LIBS = \
12 -L$(VPP_TEST_INSTALL_PATH)/vpp/lib64 \
13 -lvppinfra -lvlibmemoryclient -lsvm -lpthread -lcheck -lrt -lm -lvapiclient
14
Marco Varlese7220f422018-05-07 15:40:45 +020015ifneq ($(filter centos opensuse opensuse-tumbleweed opensuse-leap,$(OS_ID)),$(OS_ID))
Neale Ranns812ed392017-10-16 04:20:13 -070016VAPI_LIBS += -lsubunit
Marco Varlese5f1231c2017-10-10 16:43:14 +020017endif
Klement Sekeradc15be22017-06-12 06:49:33 +020018
Sirshak Das41141d52018-05-18 13:14:52 -050019FLAGS = -g -Wall -lstdc++ -pthread -I$(WS_ROOT)/src -I$(VPP_TEST_INSTALL_PATH)/vpp/include -I$(VAPI_BINDIR)
Damjan Marion164e5f82018-04-25 19:11:15 +020020CFLAGS = -std=gnu99 $(FLAGS)
21CPPFLAGS = -std=c++11 $(FLAGS) -I$(WS_ROOT)/extras/vom
22
23all: $(VAPI_CBIN) $(VAPI_CPPBIN) $(VOM_BIN)
Klement Sekera8f2a4ea2017-05-04 06:15:18 +020024
Neale Ranns812ed392017-10-16 04:20:13 -070025$(VAPI_BINDIR):
26 mkdir -p $(VAPI_BINDIR)
Klement Sekera8f2a4ea2017-05-04 06:15:18 +020027
Klement Sekeradc15be22017-06-12 06:49:33 +020028CSRC = vapi_c_test.c
Klement Sekera8f2a4ea2017-05-04 06:15:18 +020029
Neale Ranns812ed392017-10-16 04:20:13 -070030$(VAPI_BINDIR)/fake.api.vapi.h: fake.api.json $(WS_ROOT)/src/vpp-api/vapi/vapi_c_gen.py | $(VAPI_BINDIR)
31 $(WS_ROOT)/src/vpp-api/vapi/vapi_c_gen.py --prefix $(VAPI_BINDIR) $<
Klement Sekeradc15be22017-06-12 06:49:33 +020032
Neale Ranns812ed392017-10-16 04:20:13 -070033$(VAPI_BINDIR)/fake.api.vapi.hpp: fake.api.json $(WS_ROOT)/src/vpp-api/vapi/vapi_cpp_gen.py | $(VAPI_BINDIR)
34 $(WS_ROOT)/src/vpp-api/vapi/vapi_cpp_gen.py --prefix $(VAPI_BINDIR) $<
Klement Sekeradc15be22017-06-12 06:49:33 +020035
Damjan Marion164e5f82018-04-25 19:11:15 +020036$(VAPI_CBIN): $(CSRC) $(VAPI_BINDIR)/fake.api.vapi.h
Neale Ranns812ed392017-10-16 04:20:13 -070037 $(CC) -o $@ $(CFLAGS) $(CSRC) $(VAPI_LIBS)
Klement Sekeradc15be22017-06-12 06:49:33 +020038
Sirshak Das41141d52018-05-18 13:14:52 -050039$(VAPI_CBIN).d: $(CSRC) $(VAPI_BINDIR)/fake.api.vapi.h
Damjan Marion164e5f82018-04-25 19:11:15 +020040 $(CC) -o $@ $(CFLAGS) -MM -MT '$(VAPI_CBIN)' $(CSRC) > $@
41
42
Klement Sekeradc15be22017-06-12 06:49:33 +020043CPPSRC = vapi_cpp_test.cpp
44
Damjan Marion164e5f82018-04-25 19:11:15 +020045$(VAPI_CPPBIN): $(CPPSRC) $(VAPI_BINDIR)/fake.api.vapi.hpp
Neale Ranns812ed392017-10-16 04:20:13 -070046 $(CXX) -o $@ $(CPPFLAGS) $(CPPSRC) $(VAPI_LIBS)
47
Sirshak Das41141d52018-05-18 13:14:52 -050048$(VAPI_CPPBIN).d: $(CPPSRC) $(VAPI_BINDIR)/fake.api.vapi.hpp
Damjan Marion164e5f82018-04-25 19:11:15 +020049 $(CXX) -o $@ $(CPPFLAGS) -MM -MT '$(VAPI_CPPBIN)' $(CPPSRC) > $@
50
Neale Ranns812ed392017-10-16 04:20:13 -070051VOM_CPPSRC = vom_test.cpp
52
53$(VOM_BINDIR):
54 mkdir -p $(VOM_BINDIR)
55
Damjan Marion164e5f82018-04-25 19:11:15 +020056LIB_VOM = -lvom
57VOM_LIBS = \
58 -L$(VPP_TEST_INSTALL_PATH)/vom/lib64 \
59 -lvom \
Neale Ranns812ed392017-10-16 04:20:13 -070060 -lboost_thread \
61 -lboost_system \
62 -lboost_filesystem \
63 -lboost_unit_test_framework \
64 $(VAPI_LIBS)
65
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070066VOM_CPPFLAGS = \
67 -I $(WS_ROOT)/src/vpp-api/ \
Damjan Marion164e5f82018-04-25 19:11:15 +020068 -DBOOST_LOG_DYN_LINK \
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070069 $(CPPFLAGS)
70
Damjan Marion164e5f82018-04-25 19:11:15 +020071$(VOM_BIN): $(VOM_CPPSRC) $(VOM_BINDIR)
72 $(CXX) -o $@ $(VOM_CPPFLAGS) -O0 -g $(VOM_CPPSRC) $(VOM_LIBS) -Wl,-rpath,$(VPP_TEST_INSTALL_PATH)/vom/lib64
73
74$(VOM_BIN).d: $(VOM_CPPSRC) $(VOM_BINDIR)
75 $(CXX) -o $@ $(VOM_CPPFLAGS) -MM -MT '$(VOM_BIN)' $(VOM_CPPSRC) > $@
76
Klement Sekera8f2a4ea2017-05-04 06:15:18 +020077
78clean:
Neale Ranns812ed392017-10-16 04:20:13 -070079 rm -rf $(VAPI_BINDIR) $(VOM_BINDIR)
Damjan Marion164e5f82018-04-25 19:11:15 +020080
81ifneq ($(MAKECMDGOALS),clean)
82-include $(VAPI_CPPBIN).d
83-include $(VAPI_CBIN).d
84-include $(VOM_BIN).d
85endif
86