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 | |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 11 | VAPI_LIBS = \ |
Klement Sekera | b8c72a4 | 2018-11-08 11:21:39 +0100 | [diff] [blame^] | 12 | -L$(VPP_INSTALL_PATH)/vpp/lib \ |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 13 | -lvppinfra -lvlibmemoryclient -lsvm -lpthread -lcheck -lrt -lm -lvapiclient |
| 14 | |
Marco Varlese | 7220f42 | 2018-05-07 15:40:45 +0200 | [diff] [blame] | 15 | ifneq ($(filter centos opensuse opensuse-tumbleweed opensuse-leap,$(OS_ID)),$(OS_ID)) |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 16 | VAPI_LIBS += -lsubunit |
Marco Varlese | 5f1231c | 2017-10-10 16:43:14 +0200 | [diff] [blame] | 17 | endif |
Klement Sekera | dc15be2 | 2017-06-12 06:49:33 +0200 | [diff] [blame] | 18 | |
Klement Sekera | b8c72a4 | 2018-11-08 11:21:39 +0100 | [diff] [blame^] | 19 | 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] | 20 | CFLAGS = -std=gnu99 $(FLAGS) |
| 21 | CPPFLAGS = -std=c++11 $(FLAGS) -I$(WS_ROOT)/extras/vom |
| 22 | |
| 23 | all: $(VAPI_CBIN) $(VAPI_CPPBIN) $(VOM_BIN) |
Klement Sekera | 8f2a4ea | 2017-05-04 06:15:18 +0200 | [diff] [blame] | 24 | |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 25 | $(VAPI_BINDIR): |
| 26 | mkdir -p $(VAPI_BINDIR) |
Klement Sekera | 8f2a4ea | 2017-05-04 06:15:18 +0200 | [diff] [blame] | 27 | |
Klement Sekera | dc15be2 | 2017-06-12 06:49:33 +0200 | [diff] [blame] | 28 | CSRC = vapi_c_test.c |
Klement Sekera | 8f2a4ea | 2017-05-04 06:15:18 +0200 | [diff] [blame] | 29 | |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 30 | $(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 Sekera | dc15be2 | 2017-06-12 06:49:33 +0200 | [diff] [blame] | 32 | |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 33 | $(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 Sekera | dc15be2 | 2017-06-12 06:49:33 +0200 | [diff] [blame] | 35 | |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 36 | $(VAPI_CBIN): $(CSRC) $(VAPI_BINDIR)/fake.api.vapi.h |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 37 | $(CC) -o $@ $(CFLAGS) $(CSRC) $(VAPI_LIBS) |
Klement Sekera | dc15be2 | 2017-06-12 06:49:33 +0200 | [diff] [blame] | 38 | |
Sirshak Das | 41141d5 | 2018-05-18 13:14:52 -0500 | [diff] [blame] | 39 | $(VAPI_CBIN).d: $(CSRC) $(VAPI_BINDIR)/fake.api.vapi.h |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 40 | $(CC) -o $@ $(CFLAGS) -MM -MT '$(VAPI_CBIN)' $(CSRC) > $@ |
| 41 | |
| 42 | |
Klement Sekera | dc15be2 | 2017-06-12 06:49:33 +0200 | [diff] [blame] | 43 | CPPSRC = vapi_cpp_test.cpp |
| 44 | |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 45 | $(VAPI_CPPBIN): $(CPPSRC) $(VAPI_BINDIR)/fake.api.vapi.hpp |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 46 | $(CXX) -o $@ $(CPPFLAGS) $(CPPSRC) $(VAPI_LIBS) |
| 47 | |
Sirshak Das | 41141d5 | 2018-05-18 13:14:52 -0500 | [diff] [blame] | 48 | $(VAPI_CPPBIN).d: $(CPPSRC) $(VAPI_BINDIR)/fake.api.vapi.hpp |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 49 | $(CXX) -o $@ $(CPPFLAGS) -MM -MT '$(VAPI_CPPBIN)' $(CPPSRC) > $@ |
| 50 | |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 51 | VOM_CPPSRC = vom_test.cpp |
| 52 | |
| 53 | $(VOM_BINDIR): |
| 54 | mkdir -p $(VOM_BINDIR) |
| 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) > $@ |
| 76 | |
Klement Sekera | 8f2a4ea | 2017-05-04 06:15:18 +0200 | [diff] [blame] | 77 | |
| 78 | clean: |
Neale Ranns | 812ed39 | 2017-10-16 04:20:13 -0700 | [diff] [blame] | 79 | rm -rf $(VAPI_BINDIR) $(VOM_BINDIR) |
Damjan Marion | 164e5f8 | 2018-04-25 19:11:15 +0200 | [diff] [blame] | 80 | |
| 81 | ifneq ($(MAKECMDGOALS),clean) |
| 82 | -include $(VAPI_CPPBIN).d |
| 83 | -include $(VAPI_CBIN).d |
| 84 | -include $(VOM_BIN).d |
| 85 | endif |
| 86 | |