blob: de219b1a5dcc2cac7facfab83227084b2621d0ce [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
Damjan Marion164e5f82018-04-25 19:11:15 +020011VAPI_LIBS = \
Klement Sekerab8c72a42018-11-08 11:21:39 +010012 -L$(VPP_INSTALL_PATH)/vpp/lib \
Damjan Marion164e5f82018-04-25 19:11:15 +020013 -lvppinfra -lvlibmemoryclient -lsvm -lpthread -lcheck -lrt -lm -lvapiclient
14
Marco Varlese7220f422018-05-07 15:40:45 +020015ifneq ($(filter centos opensuse opensuse-tumbleweed opensuse-leap,$(OS_ID)),$(OS_ID))
Neale Ranns812ed392017-10-16 04:20:13 -070016VAPI_LIBS += -lsubunit
Marco Varlese5f1231c2017-10-10 16:43:14 +020017endif
Klement Sekeradc15be22017-06-12 06:49:33 +020018
Klement Sekerab8c72a42018-11-08 11:21:39 +010019FLAGS = -g -Wall -lstdc++ -pthread -I$(WS_ROOT)/src -I$(VPP_INSTALL_PATH)/vpp/include -I$(VAPI_BINDIR)
Damjan Marion164e5f82018-04-25 19:11:15 +020020CFLAGS = -std=gnu99 $(FLAGS)
21CPPFLAGS = -std=c++11 $(FLAGS) -I$(WS_ROOT)/extras/vom
22
23all: $(VAPI_CBIN) $(VAPI_CPPBIN) $(VOM_BIN)
Klement Sekera8f2a4ea2017-05-04 06:15:18 +020024
Neale Ranns812ed392017-10-16 04:20:13 -070025$(VAPI_BINDIR):
26 mkdir -p $(VAPI_BINDIR)
Klement Sekera8f2a4ea2017-05-04 06:15:18 +020027
Klement Sekeradc15be22017-06-12 06:49:33 +020028CSRC = vapi_c_test.c
Klement Sekera8f2a4ea2017-05-04 06:15:18 +020029
Neale Ranns812ed392017-10-16 04:20:13 -070030$(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 Sekeradc15be22017-06-12 06:49:33 +020032
Neale Ranns812ed392017-10-16 04:20:13 -070033$(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 Sekeradc15be22017-06-12 06:49:33 +020035
Damjan Marion164e5f82018-04-25 19:11:15 +020036$(VAPI_CBIN): $(CSRC) $(VAPI_BINDIR)/fake.api.vapi.h
Neale Ranns812ed392017-10-16 04:20:13 -070037 $(CC) -o $@ $(CFLAGS) $(CSRC) $(VAPI_LIBS)
Klement Sekeradc15be22017-06-12 06:49:33 +020038
Sirshak Das41141d52018-05-18 13:14:52 -050039$(VAPI_CBIN).d: $(CSRC) $(VAPI_BINDIR)/fake.api.vapi.h
Damjan Marion164e5f82018-04-25 19:11:15 +020040 $(CC) -o $@ $(CFLAGS) -MM -MT '$(VAPI_CBIN)' $(CSRC) > $@
41
42
Klement Sekeradc15be22017-06-12 06:49:33 +020043CPPSRC = vapi_cpp_test.cpp
44
Damjan Marion164e5f82018-04-25 19:11:15 +020045$(VAPI_CPPBIN): $(CPPSRC) $(VAPI_BINDIR)/fake.api.vapi.hpp
Neale Ranns812ed392017-10-16 04:20:13 -070046 $(CXX) -o $@ $(CPPFLAGS) $(CPPSRC) $(VAPI_LIBS)
47
Sirshak Das41141d52018-05-18 13:14:52 -050048$(VAPI_CPPBIN).d: $(CPPSRC) $(VAPI_BINDIR)/fake.api.vapi.hpp
Damjan Marion164e5f82018-04-25 19:11:15 +020049 $(CXX) -o $@ $(CPPFLAGS) -MM -MT '$(VAPI_CPPBIN)' $(CPPSRC) > $@
50
Neale Ranns812ed392017-10-16 04:20:13 -070051VOM_CPPSRC = vom_test.cpp
52
53$(VOM_BINDIR):
54 mkdir -p $(VOM_BINDIR)
55
Damjan Marion164e5f82018-04-25 19:11:15 +020056LIB_VOM = -lvom
57VOM_LIBS = \
Klement Sekerab8c72a42018-11-08 11:21:39 +010058 -L$(VPP_INSTALL_PATH)/vom/lib \
Damjan Marion164e5f82018-04-25 19:11:15 +020059 -lvom \
Neale Ranns812ed392017-10-16 04:20:13 -070060 -lboost_thread \
61 -lboost_system \
62 -lboost_filesystem \
63 -lboost_unit_test_framework \
64 $(VAPI_LIBS)
65
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070066VOM_CPPFLAGS = \
67 -I $(WS_ROOT)/src/vpp-api/ \
Damjan Marion164e5f82018-04-25 19:11:15 +020068 -DBOOST_LOG_DYN_LINK \
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070069 $(CPPFLAGS)
70
Damjan Marion164e5f82018-04-25 19:11:15 +020071$(VOM_BIN): $(VOM_CPPSRC) $(VOM_BINDIR)
Klement Sekerab8c72a42018-11-08 11:21:39 +010072 $(CXX) -o $@ $(VOM_CPPFLAGS) -O0 -g $(VOM_CPPSRC) $(VOM_LIBS) -Wl,-rpath,$(VPP_INSTALL_PATH)/vom/lib
Damjan Marion164e5f82018-04-25 19:11:15 +020073
74$(VOM_BIN).d: $(VOM_CPPSRC) $(VOM_BINDIR)
75 $(CXX) -o $@ $(VOM_CPPFLAGS) -MM -MT '$(VOM_BIN)' $(VOM_CPPSRC) > $@
76
Klement Sekera8f2a4ea2017-05-04 06:15:18 +020077
78clean:
Neale Ranns812ed392017-10-16 04:20:13 -070079 rm -rf $(VAPI_BINDIR) $(VOM_BINDIR)
Damjan Marion164e5f82018-04-25 19:11:15 +020080
81ifneq ($(MAKECMDGOALS),clean)
82-include $(VAPI_CPPBIN).d
83-include $(VAPI_CBIN).d
84-include $(VOM_BIN).d
85endif
86