examples: support relocated DPDK install
[dpdk.git] / examples / l3fwd-power / Makefile
index a106b04..359f323 100644 (file)
@@ -18,10 +18,12 @@ shared: build/$(APP)-shared
 static: build/$(APP)-static
        ln -sf $(APP)-static build/$(APP)
 
-PC_FILE := $(shell pkg-config --path libdpdk)
-CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+PKGCONF=pkg-config --define-prefix
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 
@@ -37,7 +39,7 @@ build:
 .PHONY: clean
 clean:
        rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
-       rmdir --ignore-fail-on-non-empty build
+       test -d build && rmdir -p build || true
 
 else # Build using legacy build system
 
@@ -59,6 +61,7 @@ else
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lm
 
 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603