X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Ftep_termination%2FMakefile;h=443bcb190ecaff3debc5fec01c85c510ea8adc69;hb=e30b2833c47c79e0b5fae1de31ae07975f440282;hp=717cccd6360f016c8f56196fb380edfff7ff310e;hpb=22119c4591a008abe5de8e395a97fcc09c8dc14a;p=dpdk.git diff --git a/examples/tep_termination/Makefile b/examples/tep_termination/Makefile index 717cccd636..443bcb190e 100644 --- a/examples/tep_termination/Makefile +++ b/examples/tep_termination/Makefile @@ -8,43 +8,38 @@ APP = tep_termination SRCS-y := main.c vxlan_setup.c vxlan.c # Build using pkg-config variables if possible -$(shell pkg-config --exists libdpdk) -ifeq ($(.SHELLSTATUS),0) - -PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +ifneq ($(shell pkg-config --exists libdpdk && echo 0),0) +$(error "no installation of DPDK found") +endif -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) -build: - @mkdir -p $@ - -.PHONY: clean -clean: - rm -f build/$(APP) - rmdir --ignore-fail-on-non-empty build +LDFLAGS += -pthread -else # Build using legacy build system +PKGCONF ?= pkg-config -ifeq ($(RTE_SDK),) -$(error "Please define RTE_SDK environment variable") -endif +PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) +CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) +LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) +LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) -# Default target, can be overridden by command line or environment -RTE_TARGET ?= x86_64-native-linuxapp-gcc +CFLAGS += -Wno-deprecated-declarations -include $(RTE_SDK)/mk/rte.vars.mk +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -ifneq ($(CONFIG_RTE_EXEC_ENV),"linuxapp") -$(error This application can only operate in a linuxapp environment, \ -please change the definition of the RTE_TARGET environment variable) -endif +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) -CFLAGS += -O3 -CFLAGS += $(WERROR_FLAGS) -CFLAGS += -D_GNU_SOURCE +build: + @mkdir -p $@ -include $(RTE_SDK)/mk/rte.extapp.mk -endif +.PHONY: clean +clean: + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared + test -d build && rmdir -p build || true