vpp/test/ext/Makefile
Dave Wallace e89bfe33ab build: fix vom_test dependency on EXTENDED_TESTS
- Note: This was not caught by CI because the VPP 'make verify'
  target always build libvom.so

Type: fix
Fixes: f0797d130

Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Change-Id: I8663e317e4e793c386b09d1cb887133de1e43faf
2019-12-05 01:23:54 +00:00

96 lines
2.7 KiB
Makefile

TEST_EXT_DIR=$(TEST_DIR)/ext
VAPI_BINDIR = $(TEST_BR)/vapi_test
VAPI_CBIN = $(addprefix $(VAPI_BINDIR), /vapi_c_test)
VAPI_CPPBIN = $(addprefix $(VAPI_BINDIR), /vapi_cpp_test)
VOM_BINDIR = $(TEST_BR)/vom_test
VAPI_LIBS = \
-L$(VPP_INSTALL_PATH)/vpp/lib \
-lvppinfra -lvlibmemoryclient -lsvm -lpthread -lcheck -lrt -lm -lvapiclient
ifneq ($(filter centos opensuse opensuse-tumbleweed opensuse-leap,$(OS_ID)),$(OS_ID))
VAPI_LIBS += -lsubunit
endif
FLAGS = -g -Wall -lstdc++ -pthread -I$(WS_ROOT)/src -I$(VPP_INSTALL_PATH)/vpp/include -I$(VAPI_BINDIR)
CFLAGS = -std=gnu99 $(FLAGS)
CPPFLAGS = -std=c++11 $(FLAGS) -I$(WS_ROOT)/extras/vom
$(VAPI_BINDIR):
@mkdir -p $(VAPI_BINDIR)
CSRC = $(TEST_EXT_DIR)/vapi_c_test.c
$(VAPI_BINDIR)/fake.api.vapi.h: fake.api.json $(WS_ROOT)/src/vpp-api/vapi/vapi_c_gen.py | $(VAPI_BINDIR)
$(WS_ROOT)/src/vpp-api/vapi/vapi_c_gen.py --prefix $(VAPI_BINDIR) $<
$(VAPI_BINDIR)/fake.api.vapi.hpp: fake.api.json $(WS_ROOT)/src/vpp-api/vapi/vapi_cpp_gen.py | $(VAPI_BINDIR)
$(WS_ROOT)/src/vpp-api/vapi/vapi_cpp_gen.py --prefix $(VAPI_BINDIR) $<
$(VAPI_CBIN): $(VAPI_BINDIR) $(CSRC) $(VAPI_BINDIR)/fake.api.vapi.h
$(CC) -o $@ $(CFLAGS) $(CSRC) $(VAPI_LIBS)
$(VAPI_CBIN).d: $(CSRC) $(VAPI_BINDIR)/fake.api.vapi.h
$(CC) -o $@ $(CFLAGS) -MM -MT '$(VAPI_CBIN)' $(CSRC) > $@
ifeq ($(filter rhel centos,$(OS_ID)),$(OS_ID))
VAPI_CPPBIN=
else
CPPSRC = $(TEST_EXT_DIR)/vapi_cpp_test.cpp
$(VAPI_CPPBIN): $(VAPI_BINDIR) $(CPPSRC) $(VAPI_BINDIR)/fake.api.vapi.hpp
$(CXX) -o $@ $(CPPFLAGS) $(CPPSRC) $(VAPI_LIBS)
$(VAPI_CPPBIN).d: $(CPPSRC) $(VAPI_BINDIR)/fake.api.vapi.hpp
$(CXX) -o $@ $(CPPFLAGS) -MM -MT '$(VAPI_CPPBIN)' $(CPPSRC) > $@
endif
ifneq ($(EXTENDED_TESTS),)
ifeq ($(filter yes y 1,$(EXTENDED_TESTS)),$(EXTENDED_TESTS))
VOM_BIN = $(addprefix $(VOM_BINDIR), /vom_test)
VOM_CPPSRC = $(TEST_EXT_DIR)/vom_test.cpp
$(VOM_BINDIR):
@mkdir -p $(VOM_BINDIR)
LIB_VOM = -lvom
VOM_LIBS = \
-L$(VPP_INSTALL_PATH)/vom/lib \
-lvom \
-lboost_thread \
-lboost_system \
-lboost_filesystem \
-lboost_unit_test_framework \
$(VAPI_LIBS)
VOM_CPPFLAGS = \
-I $(WS_ROOT)/src/vpp-api/ \
-DBOOST_LOG_DYN_LINK \
$(CPPFLAGS)
$(VOM_BIN): $(VOM_CPPSRC) $(VOM_BINDIR)
$(CXX) -o $@ $(VOM_CPPFLAGS) -O0 -g $(VOM_CPPSRC) $(VOM_LIBS) -Wl,-rpath,$(VPP_INSTALL_PATH)/vom/lib
$(VOM_BIN).d: $(VOM_CPPSRC) $(VOM_BINDIR)
$(CXX) -o $@ $(VOM_CPPFLAGS) -MM -MT '$(VOM_BIN)' $(VOM_CPPSRC) > $@
endif
endif
.PHONY: test-apps
test-apps: $(VAPI_CBIN) $(VAPI_CPPBIN) $(VOM_BIN)
.PHONY: clean
clean:
@rm -rf $(VAPI_BINDIR) $(VOM_BINDIR)
ifneq ($(MAKECMDGOALS),clean)
-include $(VAPI_CBIN).d
ifneq ($(VAPI_CPPBIN),)
-include $(VAPI_CPPBIN).d
endif
ifneq ($(VOM_BIN),)
-include $(VOM_BIN).d
endif
endif