blob: 6ec1213d532bb43add3bd12689b08b14d2e45936 [file] [log] [blame]
Klement Sekerab8c72a42018-11-08 11:21:39 +01001VAPI_BINDIR = $(TEST_DIR)/build/vapi_test/
Neale Ranns812ed392017-10-16 04:20:13 -07002VAPI_CBIN = $(addprefix $(VAPI_BINDIR), vapi_c_test)
3VAPI_CPPBIN = $(addprefix $(VAPI_BINDIR), vapi_cpp_test)
Klement Sekerab8c72a42018-11-08 11:21:39 +01004VOM_BINDIR = $(TEST_DIR)/build/vom_test/
Neale Ranns812ed392017-10-16 04:20:13 -07005VOM_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
Klement Sekerabe2c2a82019-09-02 15:19:41 +000011ifeq ($(filter yes,$(EXTENDED_TESTS)),$(EXTENDED_TESTS))
12VOM_BIN=
13endif
14
Damjan Marion164e5f82018-04-25 19:11:15 +020015VAPI_LIBS = \
Klement Sekerab8c72a42018-11-08 11:21:39 +010016 -L$(VPP_INSTALL_PATH)/vpp/lib \
Damjan Marion164e5f82018-04-25 19:11:15 +020017 -lvppinfra -lvlibmemoryclient -lsvm -lpthread -lcheck -lrt -lm -lvapiclient
18
Marco Varlese7220f422018-05-07 15:40:45 +020019ifneq ($(filter centos opensuse opensuse-tumbleweed opensuse-leap,$(OS_ID)),$(OS_ID))
Neale Ranns812ed392017-10-16 04:20:13 -070020VAPI_LIBS += -lsubunit
Marco Varlese5f1231c2017-10-10 16:43:14 +020021endif
Klement Sekeradc15be22017-06-12 06:49:33 +020022
Klement Sekerab8c72a42018-11-08 11:21:39 +010023FLAGS = -g -Wall -lstdc++ -pthread -I$(WS_ROOT)/src -I$(VPP_INSTALL_PATH)/vpp/include -I$(VAPI_BINDIR)
Damjan Marion164e5f82018-04-25 19:11:15 +020024CFLAGS = -std=gnu99 $(FLAGS)
25CPPFLAGS = -std=c++11 $(FLAGS) -I$(WS_ROOT)/extras/vom
26
27all: $(VAPI_CBIN) $(VAPI_CPPBIN) $(VOM_BIN)
Klement Sekera8f2a4ea2017-05-04 06:15:18 +020028
Neale Ranns812ed392017-10-16 04:20:13 -070029$(VAPI_BINDIR):
30 mkdir -p $(VAPI_BINDIR)
Klement Sekera8f2a4ea2017-05-04 06:15:18 +020031
Klement Sekeradc15be22017-06-12 06:49:33 +020032CSRC = vapi_c_test.c
Klement Sekera8f2a4ea2017-05-04 06:15:18 +020033
Neale Ranns812ed392017-10-16 04:20:13 -070034$(VAPI_BINDIR)/fake.api.vapi.h: fake.api.json $(WS_ROOT)/src/vpp-api/vapi/vapi_c_gen.py | $(VAPI_BINDIR)
35 $(WS_ROOT)/src/vpp-api/vapi/vapi_c_gen.py --prefix $(VAPI_BINDIR) $<
Klement Sekeradc15be22017-06-12 06:49:33 +020036
Neale Ranns812ed392017-10-16 04:20:13 -070037$(VAPI_BINDIR)/fake.api.vapi.hpp: fake.api.json $(WS_ROOT)/src/vpp-api/vapi/vapi_cpp_gen.py | $(VAPI_BINDIR)
38 $(WS_ROOT)/src/vpp-api/vapi/vapi_cpp_gen.py --prefix $(VAPI_BINDIR) $<
Klement Sekeradc15be22017-06-12 06:49:33 +020039
Damjan Marion164e5f82018-04-25 19:11:15 +020040$(VAPI_CBIN): $(CSRC) $(VAPI_BINDIR)/fake.api.vapi.h
Neale Ranns812ed392017-10-16 04:20:13 -070041 $(CC) -o $@ $(CFLAGS) $(CSRC) $(VAPI_LIBS)
Klement Sekeradc15be22017-06-12 06:49:33 +020042
Sirshak Das41141d52018-05-18 13:14:52 -050043$(VAPI_CBIN).d: $(CSRC) $(VAPI_BINDIR)/fake.api.vapi.h
Damjan Marion164e5f82018-04-25 19:11:15 +020044 $(CC) -o $@ $(CFLAGS) -MM -MT '$(VAPI_CBIN)' $(CSRC) > $@
45
46
Klement Sekeradc15be22017-06-12 06:49:33 +020047CPPSRC = vapi_cpp_test.cpp
48
Damjan Marion164e5f82018-04-25 19:11:15 +020049$(VAPI_CPPBIN): $(CPPSRC) $(VAPI_BINDIR)/fake.api.vapi.hpp
Neale Ranns812ed392017-10-16 04:20:13 -070050 $(CXX) -o $@ $(CPPFLAGS) $(CPPSRC) $(VAPI_LIBS)
51
Sirshak Das41141d52018-05-18 13:14:52 -050052$(VAPI_CPPBIN).d: $(CPPSRC) $(VAPI_BINDIR)/fake.api.vapi.hpp
Damjan Marion164e5f82018-04-25 19:11:15 +020053 $(CXX) -o $@ $(CPPFLAGS) -MM -MT '$(VAPI_CPPBIN)' $(CPPSRC) > $@
54
Neale Ranns812ed392017-10-16 04:20:13 -070055VOM_CPPSRC = vom_test.cpp
56
57$(VOM_BINDIR):
58 mkdir -p $(VOM_BINDIR)
59
Damjan Marion164e5f82018-04-25 19:11:15 +020060LIB_VOM = -lvom
61VOM_LIBS = \
Klement Sekerab8c72a42018-11-08 11:21:39 +010062 -L$(VPP_INSTALL_PATH)/vom/lib \
Damjan Marion164e5f82018-04-25 19:11:15 +020063 -lvom \
Neale Ranns812ed392017-10-16 04:20:13 -070064 -lboost_thread \
65 -lboost_system \
66 -lboost_filesystem \
67 -lboost_unit_test_framework \
68 $(VAPI_LIBS)
69
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070070VOM_CPPFLAGS = \
71 -I $(WS_ROOT)/src/vpp-api/ \
Damjan Marion164e5f82018-04-25 19:11:15 +020072 -DBOOST_LOG_DYN_LINK \
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070073 $(CPPFLAGS)
74
Damjan Marion164e5f82018-04-25 19:11:15 +020075$(VOM_BIN): $(VOM_CPPSRC) $(VOM_BINDIR)
Klement Sekerab8c72a42018-11-08 11:21:39 +010076 $(CXX) -o $@ $(VOM_CPPFLAGS) -O0 -g $(VOM_CPPSRC) $(VOM_LIBS) -Wl,-rpath,$(VPP_INSTALL_PATH)/vom/lib
Damjan Marion164e5f82018-04-25 19:11:15 +020077
78$(VOM_BIN).d: $(VOM_CPPSRC) $(VOM_BINDIR)
79 $(CXX) -o $@ $(VOM_CPPFLAGS) -MM -MT '$(VOM_BIN)' $(VOM_CPPSRC) > $@
80
Klement Sekera8f2a4ea2017-05-04 06:15:18 +020081
82clean:
Neale Ranns812ed392017-10-16 04:20:13 -070083 rm -rf $(VAPI_BINDIR) $(VOM_BINDIR)
Damjan Marion164e5f82018-04-25 19:11:15 +020084
85ifneq ($(MAKECMDGOALS),clean)
86-include $(VAPI_CPPBIN).d
87-include $(VAPI_CBIN).d
88-include $(VOM_BIN).d
89endif
90