Dave Wallace | f0797d1 | 2019-11-15 17:29:15 -0500 | [diff] [blame] | 1 | TEST_EXT_DIR=$(TEST_DIR)/ext |
| 2 | VAPI_BINDIR = $(TEST_BR)/vapi_test |
| 3 | VAPI_CBIN = $(addprefix $(VAPI_BINDIR), /vapi_c_test) |
| 4 | VAPI_CPPBIN = $(addprefix $(VAPI_BINDIR), /vapi_cpp_test) |
| 5 | VOM_BINDIR = $(TEST_BR)/vom_test |
Klement Sekera | be2c2a8 | 2019-09-02 15:19:41 +0000 | [diff] [blame] | 6 | |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 7 | VAPI_LIBS = \ |
Klement Sekera | b8c72a4 | 2018-11-08 11:21:39 +0100 | [diff] [blame] | 8 | -L$(VPP_INSTALL_PATH)/vpp/lib \ |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 9 | -lvppinfra -lvlibmemoryclient -lsvm -lpthread -lcheck -lrt -lm -lvapiclient |
| 10 | |
Marco Varlese | 7220f42 | 2018-05-07 15:40:45 +0200 | [diff] [blame] | 11 | ifneq ($(filter centos opensuse opensuse-tumbleweed opensuse-leap,$(OS_ID)),$(OS_ID)) |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 12 | VAPI_LIBS += -lsubunit |
Marco Varlese | 5f1231c | 2017-10-10 16:43:14 +0200 | [diff] [blame] | 13 | endif |
Klement Sekera | dc15be2 | 2017-06-12 06:49:33 +0200 | [diff] [blame] | 14 | |
Klement Sekera | b8c72a4 | 2018-11-08 11:21:39 +0100 | [diff] [blame] | 15 | FLAGS = -g -Wall -lstdc++ -pthread -I$(WS_ROOT)/src -I$(VPP_INSTALL_PATH)/vpp/include -I$(VAPI_BINDIR) |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 16 | CFLAGS = -std=gnu99 $(FLAGS) |
| 17 | CPPFLAGS = -std=c++11 $(FLAGS) -I$(WS_ROOT)/extras/vom |
| 18 | |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 19 | $(VAPI_BINDIR): |
Dave Wallace | f0797d1 | 2019-11-15 17:29:15 -0500 | [diff] [blame] | 20 | @mkdir -p $(VAPI_BINDIR) |
Klement Sekera | 8f2a4ea | 2017-05-04 06:15:18 +0200 | [diff] [blame] | 21 | |
Dave Wallace | f0797d1 | 2019-11-15 17:29:15 -0500 | [diff] [blame] | 22 | CSRC = $(TEST_EXT_DIR)/vapi_c_test.c |
Klement Sekera | 8f2a4ea | 2017-05-04 06:15:18 +0200 | [diff] [blame] | 23 | |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 24 | $(VAPI_BINDIR)/fake.api.vapi.h: fake.api.json $(WS_ROOT)/src/vpp-api/vapi/vapi_c_gen.py | $(VAPI_BINDIR) |
| 25 | $(WS_ROOT)/src/vpp-api/vapi/vapi_c_gen.py --prefix $(VAPI_BINDIR) $< |
Klement Sekera | dc15be2 | 2017-06-12 06:49:33 +0200 | [diff] [blame] | 26 | |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 27 | $(VAPI_BINDIR)/fake.api.vapi.hpp: fake.api.json $(WS_ROOT)/src/vpp-api/vapi/vapi_cpp_gen.py | $(VAPI_BINDIR) |
| 28 | $(WS_ROOT)/src/vpp-api/vapi/vapi_cpp_gen.py --prefix $(VAPI_BINDIR) $< |
Klement Sekera | dc15be2 | 2017-06-12 06:49:33 +0200 | [diff] [blame] | 29 | |
Dave Wallace | f0797d1 | 2019-11-15 17:29:15 -0500 | [diff] [blame] | 30 | $(VAPI_CBIN): $(VAPI_BINDIR) $(CSRC) $(VAPI_BINDIR)/fake.api.vapi.h |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 31 | $(CC) -o $@ $(CFLAGS) $(CSRC) $(VAPI_LIBS) |
Klement Sekera | dc15be2 | 2017-06-12 06:49:33 +0200 | [diff] [blame] | 32 | |
Sirshak Das | 41141d5 | 2018-05-18 13:14:52 -0500 | [diff] [blame] | 33 | $(VAPI_CBIN).d: $(CSRC) $(VAPI_BINDIR)/fake.api.vapi.h |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 34 | $(CC) -o $@ $(CFLAGS) -MM -MT '$(VAPI_CBIN)' $(CSRC) > $@ |
| 35 | |
| 36 | |
Dave Wallace | f0797d1 | 2019-11-15 17:29:15 -0500 | [diff] [blame] | 37 | ifeq ($(filter rhel centos,$(OS_ID)),$(OS_ID)) |
| 38 | VAPI_CPPBIN= |
| 39 | else |
| 40 | CPPSRC = $(TEST_EXT_DIR)/vapi_cpp_test.cpp |
Klement Sekera | dc15be2 | 2017-06-12 06:49:33 +0200 | [diff] [blame] | 41 | |
Dave Wallace | f0797d1 | 2019-11-15 17:29:15 -0500 | [diff] [blame] | 42 | $(VAPI_CPPBIN): $(VAPI_BINDIR) $(CPPSRC) $(VAPI_BINDIR)/fake.api.vapi.hpp |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 43 | $(CXX) -o $@ $(CPPFLAGS) $(CPPSRC) $(VAPI_LIBS) |
| 44 | |
Sirshak Das | 41141d5 | 2018-05-18 13:14:52 -0500 | [diff] [blame] | 45 | $(VAPI_CPPBIN).d: $(CPPSRC) $(VAPI_BINDIR)/fake.api.vapi.hpp |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 46 | $(CXX) -o $@ $(CPPFLAGS) -MM -MT '$(VAPI_CPPBIN)' $(CPPSRC) > $@ |
Dave Wallace | f0797d1 | 2019-11-15 17:29:15 -0500 | [diff] [blame] | 47 | endif |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 48 | |
Dave Wallace | f0797d1 | 2019-11-15 17:29:15 -0500 | [diff] [blame] | 49 | ifeq ($(filter yes,$(EXTENDED_TESTS)),$(EXTENDED_TESTS)) |
| 50 | VOM_BIN = $(addprefix $(VOM_BINDIR), /vom_test) |
| 51 | VOM_CPPSRC = $(TEST_EXT_DIR)/vom_test.cpp |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 52 | |
| 53 | $(VOM_BINDIR): |
Dave Wallace | f0797d1 | 2019-11-15 17:29:15 -0500 | [diff] [blame] | 54 | @mkdir -p $(VOM_BINDIR) |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 55 | |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 56 | LIB_VOM = -lvom |
| 57 | VOM_LIBS = \ |
Klement Sekera | b8c72a4 | 2018-11-08 11:21:39 +0100 | [diff] [blame] | 58 | -L$(VPP_INSTALL_PATH)/vom/lib \ |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 59 | -lvom \ |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 60 | -lboost_thread \ |
| 61 | -lboost_system \ |
| 62 | -lboost_filesystem \ |
| 63 | -lboost_unit_test_framework \ |
| 64 | $(VAPI_LIBS) |
| 65 | |
Neale Ranns | 9ef1c0a | 2017-11-03 04:39:05 -0700 | [diff] [blame] | 66 | VOM_CPPFLAGS = \ |
| 67 | -I $(WS_ROOT)/src/vpp-api/ \ |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 68 | -DBOOST_LOG_DYN_LINK \ |
Neale Ranns | 9ef1c0a | 2017-11-03 04:39:05 -0700 | [diff] [blame] | 69 | $(CPPFLAGS) |
| 70 | |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 71 | $(VOM_BIN): $(VOM_CPPSRC) $(VOM_BINDIR) |
Klement Sekera | b8c72a4 | 2018-11-08 11:21:39 +0100 | [diff] [blame] | 72 | $(CXX) -o $@ $(VOM_CPPFLAGS) -O0 -g $(VOM_CPPSRC) $(VOM_LIBS) -Wl,-rpath,$(VPP_INSTALL_PATH)/vom/lib |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 73 | |
| 74 | $(VOM_BIN).d: $(VOM_CPPSRC) $(VOM_BINDIR) |
| 75 | $(CXX) -o $@ $(VOM_CPPFLAGS) -MM -MT '$(VOM_BIN)' $(VOM_CPPSRC) > $@ |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 76 | endif |
| 77 | |
Dave Wallace | f0797d1 | 2019-11-15 17:29:15 -0500 | [diff] [blame] | 78 | .PHONY: test-apps |
| 79 | test-apps: $(VAPI_CBIN) $(VAPI_CPPBIN) $(VOM_BIN) |
| 80 | |
| 81 | .PHONY: clean |
| 82 | clean: |
| 83 | @rm -rf $(VAPI_BINDIR) $(VOM_BINDIR) |
| 84 | |
| 85 | ifneq ($(MAKECMDGOALS),clean) |
| 86 | -include $(VAPI_CBIN).d |
| 87 | ifneq ($(VAPI_CPPBIN),) |
| 88 | -include $(VAPI_CPPBIN).d |
| 89 | endif |
| 90 | ifneq ($(VOM_BIN),) |
| 91 | -include $(VOM_BIN).d |
| 92 | endif |
| 93 | endif |