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 | e89bfe3 | 2019-12-04 18:29:39 -0500 | [diff] [blame^] | 49 | ifneq ($(EXTENDED_TESTS),) |
| 50 | ifeq ($(filter yes y 1,$(EXTENDED_TESTS)),$(EXTENDED_TESTS)) |
Dave Wallace | f0797d1 | 2019-11-15 17:29:15 -0500 | [diff] [blame] | 51 | VOM_BIN = $(addprefix $(VOM_BINDIR), /vom_test) |
| 52 | VOM_CPPSRC = $(TEST_EXT_DIR)/vom_test.cpp |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 53 | |
| 54 | $(VOM_BINDIR): |
Dave Wallace | f0797d1 | 2019-11-15 17:29:15 -0500 | [diff] [blame] | 55 | @mkdir -p $(VOM_BINDIR) |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 56 | |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 57 | LIB_VOM = -lvom |
| 58 | VOM_LIBS = \ |
Klement Sekera | b8c72a4 | 2018-11-08 11:21:39 +0100 | [diff] [blame] | 59 | -L$(VPP_INSTALL_PATH)/vom/lib \ |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 60 | -lvom \ |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 61 | -lboost_thread \ |
| 62 | -lboost_system \ |
| 63 | -lboost_filesystem \ |
| 64 | -lboost_unit_test_framework \ |
| 65 | $(VAPI_LIBS) |
| 66 | |
Neale Ranns | 9ef1c0a | 2017-11-03 04:39:05 -0700 | [diff] [blame] | 67 | VOM_CPPFLAGS = \ |
| 68 | -I $(WS_ROOT)/src/vpp-api/ \ |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 69 | -DBOOST_LOG_DYN_LINK \ |
Neale Ranns | 9ef1c0a | 2017-11-03 04:39:05 -0700 | [diff] [blame] | 70 | $(CPPFLAGS) |
| 71 | |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 72 | $(VOM_BIN): $(VOM_CPPSRC) $(VOM_BINDIR) |
Klement Sekera | b8c72a4 | 2018-11-08 11:21:39 +0100 | [diff] [blame] | 73 | $(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] | 74 | |
| 75 | $(VOM_BIN).d: $(VOM_CPPSRC) $(VOM_BINDIR) |
| 76 | $(CXX) -o $@ $(VOM_CPPFLAGS) -MM -MT '$(VOM_BIN)' $(VOM_CPPSRC) > $@ |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 77 | endif |
Dave Wallace | e89bfe3 | 2019-12-04 18:29:39 -0500 | [diff] [blame^] | 78 | endif |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 79 | |
Dave Wallace | f0797d1 | 2019-11-15 17:29:15 -0500 | [diff] [blame] | 80 | .PHONY: test-apps |
| 81 | test-apps: $(VAPI_CBIN) $(VAPI_CPPBIN) $(VOM_BIN) |
| 82 | |
| 83 | .PHONY: clean |
| 84 | clean: |
| 85 | @rm -rf $(VAPI_BINDIR) $(VOM_BINDIR) |
| 86 | |
| 87 | ifneq ($(MAKECMDGOALS),clean) |
| 88 | -include $(VAPI_CBIN).d |
| 89 | ifneq ($(VAPI_CPPBIN),) |
| 90 | -include $(VAPI_CPPBIN).d |
| 91 | endif |
| 92 | ifneq ($(VOM_BIN),) |
| 93 | -include $(VOM_BIN).d |
| 94 | endif |
| 95 | endif |