net/mlx5: spawn ethdev ports on Windows
[dpdk.git] / examples / vmdq / Makefile
index 9a74b24..749ed53 100644 (file)
@@ -8,38 +8,36 @@ APP = vmdq_app
 SRCS-y := main.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)
-
-build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build
-       $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)
-
-build:
-       @mkdir -p $@
+ifneq ($(shell pkg-config --exists libdpdk && echo 0),0)
+$(error "no installation of DPDK found")
+endif
 
-.PHONY: clean
-clean:
-       rm -f build/$(APP)
-       rmdir --ignore-fail-on-non-empty build
+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)
 
-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 += -DALLOW_EXPERIMENTAL_API
 
-include $(RTE_SDK)/mk/rte.vars.mk
+build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
+       $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
 
-CFLAGS += $(WERROR_FLAGS)
+build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
+       $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
 
-EXTRA_CFLAGS += -O3
+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