X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fntb%2FMakefile;h=d9b6e5309026de0cb7f254a80805e968ec51b615;hb=23f7ec1d9b7ccfcfb9b9f67d33cf6cbf7f5034d3;hp=d35dabc47157efcb2d49861fc280ccfa770fb5e6;hpb=9bb2997cb7a9e9fa286c13fabe392e544b95158b;p=dpdk.git diff --git a/examples/ntb/Makefile b/examples/ntb/Makefile index d35dabc471..d9b6e53090 100644 --- a/examples/ntb/Makefile +++ b/examples/ntb/Makefile @@ -7,8 +7,10 @@ APP = ntb_fwd # all source are stored in SRCS-y SRCS-y := ntb_fwd.c +PKGCONF ?= pkg-config + # Build using pkg-config variables if possible -ifneq ($(shell pkg-config --exists libdpdk && echo 0),0) +ifneq ($(shell $(PKGCONF) --exists libdpdk && echo 0),0) $(error "no installation of DPDK found") endif @@ -19,17 +21,24 @@ shared: build/$(APP)-shared static: build/$(APP)-static ln -sf $(APP)-static build/$(APP) -PKGCONF ?= pkg-config - CFLAGS += -D_FILE_OFFSET_BITS=64 LDFLAGS += -pthread PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null) CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) -CFLAGS += -DALLOW_EXPERIMENTAL_API LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) +ifeq ($(MAKECMDGOALS),static) +# check for broken pkg-config +ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),) +$(warning "pkg-config output list does not contain drivers between 'whole-archive'/'no-whole-archive' flags.") +$(error "Cannot generate statically-linked binaries with this version of pkg-config") +endif +endif + +CFLAGS += -DALLOW_EXPERIMENTAL_API + build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)