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