[19.08,2/6] examples: add support for relocated DPDK install

Message ID 20190503133537.58712-3-bruce.richardson@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series improve building examples |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Bruce Richardson May 3, 2019, 1:35 p.m. UTC
  For testing of DPDK, we want to override the prefix given by the
pkg-config file, so that we can get correct paths for DPDK installed
in an unusual location.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 examples/bbdev_app/Makefile             | 13 +++++++++----
 examples/bond/Makefile                  | 13 +++++++++----
 examples/cmdline/Makefile               | 13 +++++++++----
 examples/distributor/Makefile           | 13 +++++++++----
 examples/eventdev_pipeline/Makefile     | 13 +++++++++----
 examples/exception_path/Makefile        | 13 +++++++++----
 examples/fips_validation/Makefile       | 13 +++++++++----
 examples/flow_classify/Makefile         | 13 +++++++++----
 examples/flow_filtering/Makefile        | 13 +++++++++----
 examples/helloworld/Makefile            | 13 +++++++++----
 examples/ip_fragmentation/Makefile      | 13 +++++++++----
 examples/ip_pipeline/Makefile           | 13 +++++++++----
 examples/ip_reassembly/Makefile         | 13 +++++++++----
 examples/ipsec-secgw/Makefile           | 13 +++++++++----
 examples/ipv4_multicast/Makefile        | 13 +++++++++----
 examples/kni/Makefile                   | 13 +++++++++----
 examples/l2fwd-cat/Makefile             | 13 +++++++++----
 examples/l2fwd-crypto/Makefile          | 13 +++++++++----
 examples/l2fwd-jobstats/Makefile        | 13 +++++++++----
 examples/l2fwd-keepalive/Makefile       | 13 +++++++++----
 examples/l2fwd/Makefile                 | 13 +++++++++----
 examples/l3fwd-acl/Makefile             | 13 +++++++++----
 examples/l3fwd-power/Makefile           | 13 +++++++++----
 examples/l3fwd-vf/Makefile              | 13 +++++++++----
 examples/l3fwd/Makefile                 | 13 +++++++++----
 examples/link_status_interrupt/Makefile | 13 +++++++++----
 examples/load_balancer/Makefile         | 13 +++++++++----
 examples/packet_ordering/Makefile       | 13 +++++++++----
 examples/ptpclient/Makefile             | 13 +++++++++----
 examples/qos_meter/Makefile             | 13 +++++++++----
 examples/qos_sched/Makefile             | 13 +++++++++----
 examples/rxtx_callbacks/Makefile        | 13 +++++++++----
 examples/service_cores/Makefile         | 13 +++++++++----
 examples/skeleton/Makefile              | 13 +++++++++----
 examples/tep_termination/Makefile       | 13 +++++++++----
 examples/timer/Makefile                 | 13 +++++++++----
 examples/vhost/Makefile                 | 13 +++++++++----
 examples/vhost_scsi/Makefile            | 13 +++++++++----
 examples/vmdq/Makefile                  | 13 +++++++++----
 examples/vmdq_dcb/Makefile              | 13 +++++++++----
 40 files changed, 360 insertions(+), 160 deletions(-)
  

Comments

Luca Boccassi May 7, 2019, 10:09 a.m. UTC | #1
On Fri, 2019-05-03 at 14:35 +0100, Bruce Richardson wrote:
> For testing of DPDK, we want to override the prefix given by the
> pkg-config file, so that we can get correct paths for DPDK installed
> in an unusual location.
> 
> Signed-off-by: Bruce Richardson <
> bruce.richardson@intel.com
> >
> ---
>  examples/bbdev_app/Makefile             | 13 +++++++++----
>  examples/bond/Makefile                  | 13 +++++++++----
>  examples/cmdline/Makefile               | 13 +++++++++----
>  examples/distributor/Makefile           | 13 +++++++++----
>  examples/eventdev_pipeline/Makefile     | 13 +++++++++----
>  examples/exception_path/Makefile        | 13 +++++++++----
>  examples/fips_validation/Makefile       | 13 +++++++++----
>  examples/flow_classify/Makefile         | 13 +++++++++----
>  examples/flow_filtering/Makefile        | 13 +++++++++----
>  examples/helloworld/Makefile            | 13 +++++++++----
>  examples/ip_fragmentation/Makefile      | 13 +++++++++----
>  examples/ip_pipeline/Makefile           | 13 +++++++++----
>  examples/ip_reassembly/Makefile         | 13 +++++++++----
>  examples/ipsec-secgw/Makefile           | 13 +++++++++----
>  examples/ipv4_multicast/Makefile        | 13 +++++++++----
>  examples/kni/Makefile                   | 13 +++++++++----
>  examples/l2fwd-cat/Makefile             | 13 +++++++++----
>  examples/l2fwd-crypto/Makefile          | 13 +++++++++----
>  examples/l2fwd-jobstats/Makefile        | 13 +++++++++----
>  examples/l2fwd-keepalive/Makefile       | 13 +++++++++----
>  examples/l2fwd/Makefile                 | 13 +++++++++----
>  examples/l3fwd-acl/Makefile             | 13 +++++++++----
>  examples/l3fwd-power/Makefile           | 13 +++++++++----
>  examples/l3fwd-vf/Makefile              | 13 +++++++++----
>  examples/l3fwd/Makefile                 | 13 +++++++++----
>  examples/link_status_interrupt/Makefile | 13 +++++++++----
>  examples/load_balancer/Makefile         | 13 +++++++++----
>  examples/packet_ordering/Makefile       | 13 +++++++++----
>  examples/ptpclient/Makefile             | 13 +++++++++----
>  examples/qos_meter/Makefile             | 13 +++++++++----
>  examples/qos_sched/Makefile             | 13 +++++++++----
>  examples/rxtx_callbacks/Makefile        | 13 +++++++++----
>  examples/service_cores/Makefile         | 13 +++++++++----
>  examples/skeleton/Makefile              | 13 +++++++++----
>  examples/tep_termination/Makefile       | 13 +++++++++----
>  examples/timer/Makefile                 | 13 +++++++++----
>  examples/vhost/Makefile                 | 13 +++++++++----
>  examples/vhost_scsi/Makefile            | 13 +++++++++----
>  examples/vmdq/Makefile                  | 13 +++++++++----
>  examples/vmdq_dcb/Makefile              | 13 +++++++++----
>  40 files changed, 360 insertions(+), 160 deletions(-)
> 
> diff --git a/examples/bbdev_app/Makefile
> b/examples/bbdev_app/Makefile
> index e8115b46a..603932ace 100644
> --- a/examples/bbdev_app/Makefile
> +++ b/examples/bbdev_app/Makefile
> @@ -18,10 +18,15 @@ 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
> +ifneq ($(DPDK_PC_PREFIX),)
> +       PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
> +endif
> +
> +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

Hi,

Would using "--define-prefix" allow to avoid the special-sauced
DPDK_PC_PREFIX variable?
  
Bruce Richardson May 7, 2019, 10:50 a.m. UTC | #2
On Tue, May 07, 2019 at 11:09:51AM +0100, Luca Boccassi wrote:
> On Fri, 2019-05-03 at 14:35 +0100, Bruce Richardson wrote:
> > For testing of DPDK, we want to override the prefix given by the
> > pkg-config file, so that we can get correct paths for DPDK installed
> > in an unusual location.
> > 
> > Signed-off-by: Bruce Richardson <
> > bruce.richardson@intel.com
> > >
> > ---
> >  examples/bbdev_app/Makefile             | 13 +++++++++----
> >  examples/bond/Makefile                  | 13 +++++++++----
> >  examples/cmdline/Makefile               | 13 +++++++++----
> >  examples/distributor/Makefile           | 13 +++++++++----
> >  examples/eventdev_pipeline/Makefile     | 13 +++++++++----
> >  examples/exception_path/Makefile        | 13 +++++++++----
> >  examples/fips_validation/Makefile       | 13 +++++++++----
> >  examples/flow_classify/Makefile         | 13 +++++++++----
> >  examples/flow_filtering/Makefile        | 13 +++++++++----
> >  examples/helloworld/Makefile            | 13 +++++++++----
> >  examples/ip_fragmentation/Makefile      | 13 +++++++++----
> >  examples/ip_pipeline/Makefile           | 13 +++++++++----
> >  examples/ip_reassembly/Makefile         | 13 +++++++++----
> >  examples/ipsec-secgw/Makefile           | 13 +++++++++----
> >  examples/ipv4_multicast/Makefile        | 13 +++++++++----
> >  examples/kni/Makefile                   | 13 +++++++++----
> >  examples/l2fwd-cat/Makefile             | 13 +++++++++----
> >  examples/l2fwd-crypto/Makefile          | 13 +++++++++----
> >  examples/l2fwd-jobstats/Makefile        | 13 +++++++++----
> >  examples/l2fwd-keepalive/Makefile       | 13 +++++++++----
> >  examples/l2fwd/Makefile                 | 13 +++++++++----
> >  examples/l3fwd-acl/Makefile             | 13 +++++++++----
> >  examples/l3fwd-power/Makefile           | 13 +++++++++----
> >  examples/l3fwd-vf/Makefile              | 13 +++++++++----
> >  examples/l3fwd/Makefile                 | 13 +++++++++----
> >  examples/link_status_interrupt/Makefile | 13 +++++++++----
> >  examples/load_balancer/Makefile         | 13 +++++++++----
> >  examples/packet_ordering/Makefile       | 13 +++++++++----
> >  examples/ptpclient/Makefile             | 13 +++++++++----
> >  examples/qos_meter/Makefile             | 13 +++++++++----
> >  examples/qos_sched/Makefile             | 13 +++++++++----
> >  examples/rxtx_callbacks/Makefile        | 13 +++++++++----
> >  examples/service_cores/Makefile         | 13 +++++++++----
> >  examples/skeleton/Makefile              | 13 +++++++++----
> >  examples/tep_termination/Makefile       | 13 +++++++++----
> >  examples/timer/Makefile                 | 13 +++++++++----
> >  examples/vhost/Makefile                 | 13 +++++++++----
> >  examples/vhost_scsi/Makefile            | 13 +++++++++----
> >  examples/vmdq/Makefile                  | 13 +++++++++----
> >  examples/vmdq_dcb/Makefile              | 13 +++++++++----
> >  40 files changed, 360 insertions(+), 160 deletions(-)
> > 
> > diff --git a/examples/bbdev_app/Makefile
> > b/examples/bbdev_app/Makefile
> > index e8115b46a..603932ace 100644
> > --- a/examples/bbdev_app/Makefile
> > +++ b/examples/bbdev_app/Makefile
> > @@ -18,10 +18,15 @@ 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
> > +ifneq ($(DPDK_PC_PREFIX),)
> > +       PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
> > +endif
> > +
> > +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
> 
> Hi,
> 
> Would using "--define-prefix" allow to avoid the special-sauced
> DPDK_PC_PREFIX variable?
> 
> -- 
Perhaps I'm missing something, but I'm not seeing how, since the code above
is already using the --define-variable flag. Swapping one pkg-config flag
for another isn't likely to change the flow. Whatever way things work, we
need an environment variable to pull in the path change. Since one doesn't
seem to be available for pkg-config directly, we need a DPDK special-sauced
one.

/Bruce
  
Luca Boccassi May 7, 2019, 1:28 p.m. UTC | #3
On Tue, 2019-05-07 at 11:50 +0100, Bruce Richardson wrote:
> On Tue, May 07, 2019 at 11:09:51AM +0100, Luca Boccassi wrote:
> > On Fri, 2019-05-03 at 14:35 +0100, Bruce Richardson wrote:
> > > For testing of DPDK, we want to override the prefix given by the
> > > pkg-config file, so that we can get correct paths for DPDK
> > > installed
> > > in an unusual location.
> > > 
> > > Signed-off-by: Bruce Richardson <
> > > bruce.richardson@intel.com
> > > 
> > > 
> > > ---
> > >  examples/bbdev_app/Makefile             | 13 +++++++++----
> > >  examples/bond/Makefile                  | 13 +++++++++----
> > >  examples/cmdline/Makefile               | 13 +++++++++----
> > >  examples/distributor/Makefile           | 13 +++++++++----
> > >  examples/eventdev_pipeline/Makefile     | 13 +++++++++----
> > >  examples/exception_path/Makefile        | 13 +++++++++----
> > >  examples/fips_validation/Makefile       | 13 +++++++++----
> > >  examples/flow_classify/Makefile         | 13 +++++++++----
> > >  examples/flow_filtering/Makefile        | 13 +++++++++----
> > >  examples/helloworld/Makefile            | 13 +++++++++----
> > >  examples/ip_fragmentation/Makefile      | 13 +++++++++----
> > >  examples/ip_pipeline/Makefile           | 13 +++++++++----
> > >  examples/ip_reassembly/Makefile         | 13 +++++++++----
> > >  examples/ipsec-secgw/Makefile           | 13 +++++++++----
> > >  examples/ipv4_multicast/Makefile        | 13 +++++++++----
> > >  examples/kni/Makefile                   | 13 +++++++++----
> > >  examples/l2fwd-cat/Makefile             | 13 +++++++++----
> > >  examples/l2fwd-crypto/Makefile          | 13 +++++++++----
> > >  examples/l2fwd-jobstats/Makefile        | 13 +++++++++----
> > >  examples/l2fwd-keepalive/Makefile       | 13 +++++++++----
> > >  examples/l2fwd/Makefile                 | 13 +++++++++----
> > >  examples/l3fwd-acl/Makefile             | 13 +++++++++----
> > >  examples/l3fwd-power/Makefile           | 13 +++++++++----
> > >  examples/l3fwd-vf/Makefile              | 13 +++++++++----
> > >  examples/l3fwd/Makefile                 | 13 +++++++++----
> > >  examples/link_status_interrupt/Makefile | 13 +++++++++----
> > >  examples/load_balancer/Makefile         | 13 +++++++++----
> > >  examples/packet_ordering/Makefile       | 13 +++++++++----
> > >  examples/ptpclient/Makefile             | 13 +++++++++----
> > >  examples/qos_meter/Makefile             | 13 +++++++++----
> > >  examples/qos_sched/Makefile             | 13 +++++++++----
> > >  examples/rxtx_callbacks/Makefile        | 13 +++++++++----
> > >  examples/service_cores/Makefile         | 13 +++++++++----
> > >  examples/skeleton/Makefile              | 13 +++++++++----
> > >  examples/tep_termination/Makefile       | 13 +++++++++----
> > >  examples/timer/Makefile                 | 13 +++++++++----
> > >  examples/vhost/Makefile                 | 13 +++++++++----
> > >  examples/vhost_scsi/Makefile            | 13 +++++++++----
> > >  examples/vmdq/Makefile                  | 13 +++++++++----
> > >  examples/vmdq_dcb/Makefile              | 13 +++++++++----
> > >  40 files changed, 360 insertions(+), 160 deletions(-)
> > > 
> > > diff --git a/examples/bbdev_app/Makefile
> > > b/examples/bbdev_app/Makefile
> > > index e8115b46a..603932ace 100644
> > > --- a/examples/bbdev_app/Makefile
> > > +++ b/examples/bbdev_app/Makefile
> > > @@ -18,10 +18,15 @@ 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
> > > +ifneq ($(DPDK_PC_PREFIX),)
> > > +       PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
> > > +endif
> > > +
> > > +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
> > 
> > Hi,
> > 
> > Would using "--define-prefix" allow to avoid the special-sauced
> > DPDK_PC_PREFIX variable?
> > 
> > -- 
> 
> Perhaps I'm missing something, but I'm not seeing how, since the code
> above
> is already using the --define-variable flag. Swapping one pkg-config
> flag
> for another isn't likely to change the flow. Whatever way things
> work, we
> need an environment variable to pull in the path change. Since one
> doesn't
> seem to be available for pkg-config directly, we need a DPDK special-
> sauced
> one.
> 
> /Bruce

I think PKG_CONFIG_PATH is a more common and more well-understood flag
to use - using define-prefix should allow to use that instead
  
Bruce Richardson May 7, 2019, 3:17 p.m. UTC | #4
On Tue, May 07, 2019 at 02:28:11PM +0100, Luca Boccassi wrote:
> On Tue, 2019-05-07 at 11:50 +0100, Bruce Richardson wrote:
> > On Tue, May 07, 2019 at 11:09:51AM +0100, Luca Boccassi wrote:
> > > On Fri, 2019-05-03 at 14:35 +0100, Bruce Richardson wrote:
> > > > For testing of DPDK, we want to override the prefix given by the
> > > > pkg-config file, so that we can get correct paths for DPDK
> > > > installed
> > > > in an unusual location.
> > > > 
> > > > Signed-off-by: Bruce Richardson <
> > > > bruce.richardson@intel.com
> > > > 
> > > > 
> > > > ---
> > > >  examples/bbdev_app/Makefile             | 13 +++++++++----
> > > >  examples/bond/Makefile                  | 13 +++++++++----
> > > >  examples/cmdline/Makefile               | 13 +++++++++----
> > > >  examples/distributor/Makefile           | 13 +++++++++----
> > > >  examples/eventdev_pipeline/Makefile     | 13 +++++++++----
> > > >  examples/exception_path/Makefile        | 13 +++++++++----
> > > >  examples/fips_validation/Makefile       | 13 +++++++++----
> > > >  examples/flow_classify/Makefile         | 13 +++++++++----
> > > >  examples/flow_filtering/Makefile        | 13 +++++++++----
> > > >  examples/helloworld/Makefile            | 13 +++++++++----
> > > >  examples/ip_fragmentation/Makefile      | 13 +++++++++----
> > > >  examples/ip_pipeline/Makefile           | 13 +++++++++----
> > > >  examples/ip_reassembly/Makefile         | 13 +++++++++----
> > > >  examples/ipsec-secgw/Makefile           | 13 +++++++++----
> > > >  examples/ipv4_multicast/Makefile        | 13 +++++++++----
> > > >  examples/kni/Makefile                   | 13 +++++++++----
> > > >  examples/l2fwd-cat/Makefile             | 13 +++++++++----
> > > >  examples/l2fwd-crypto/Makefile          | 13 +++++++++----
> > > >  examples/l2fwd-jobstats/Makefile        | 13 +++++++++----
> > > >  examples/l2fwd-keepalive/Makefile       | 13 +++++++++----
> > > >  examples/l2fwd/Makefile                 | 13 +++++++++----
> > > >  examples/l3fwd-acl/Makefile             | 13 +++++++++----
> > > >  examples/l3fwd-power/Makefile           | 13 +++++++++----
> > > >  examples/l3fwd-vf/Makefile              | 13 +++++++++----
> > > >  examples/l3fwd/Makefile                 | 13 +++++++++----
> > > >  examples/link_status_interrupt/Makefile | 13 +++++++++----
> > > >  examples/load_balancer/Makefile         | 13 +++++++++----
> > > >  examples/packet_ordering/Makefile       | 13 +++++++++----
> > > >  examples/ptpclient/Makefile             | 13 +++++++++----
> > > >  examples/qos_meter/Makefile             | 13 +++++++++----
> > > >  examples/qos_sched/Makefile             | 13 +++++++++----
> > > >  examples/rxtx_callbacks/Makefile        | 13 +++++++++----
> > > >  examples/service_cores/Makefile         | 13 +++++++++----
> > > >  examples/skeleton/Makefile              | 13 +++++++++----
> > > >  examples/tep_termination/Makefile       | 13 +++++++++----
> > > >  examples/timer/Makefile                 | 13 +++++++++----
> > > >  examples/vhost/Makefile                 | 13 +++++++++----
> > > >  examples/vhost_scsi/Makefile            | 13 +++++++++----
> > > >  examples/vmdq/Makefile                  | 13 +++++++++----
> > > >  examples/vmdq_dcb/Makefile              | 13 +++++++++----
> > > >  40 files changed, 360 insertions(+), 160 deletions(-)
> > > > 
> > > > diff --git a/examples/bbdev_app/Makefile
> > > > b/examples/bbdev_app/Makefile
> > > > index e8115b46a..603932ace 100644
> > > > --- a/examples/bbdev_app/Makefile
> > > > +++ b/examples/bbdev_app/Makefile
> > > > @@ -18,10 +18,15 @@ 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
> > > > +ifneq ($(DPDK_PC_PREFIX),)
> > > > +       PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
> > > > +endif
> > > > +
> > > > +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
> > > 
> > > Hi,
> > > 
> > > Would using "--define-prefix" allow to avoid the special-sauced
> > > DPDK_PC_PREFIX variable?
> > > 
> > > -- 
> > 
> > Perhaps I'm missing something, but I'm not seeing how, since the code
> > above
> > is already using the --define-variable flag. Swapping one pkg-config
> > flag
> > for another isn't likely to change the flow. Whatever way things
> > work, we
> > need an environment variable to pull in the path change. Since one
> > doesn't
> > seem to be available for pkg-config directly, we need a DPDK special-
> > sauced
> > one.
> > 
> > /Bruce
> 
> I think PKG_CONFIG_PATH is a more common and more well-understood flag
> to use - using define-prefix should allow to use that instead
> 
Yes, except pkg-config-path only gives the path to the pkg-config file, it
doesn't affect the prefixes in the file itself, and it's the latter we need
to modify.
  
Luca Boccassi May 7, 2019, 3:53 p.m. UTC | #5
On Tue, 2019-05-07 at 16:17 +0100, Bruce Richardson wrote:
> On Tue, May 07, 2019 at 02:28:11PM +0100, Luca Boccassi wrote:
> > On Tue, 2019-05-07 at 11:50 +0100, Bruce Richardson wrote:
> > > On Tue, May 07, 2019 at 11:09:51AM +0100, Luca Boccassi wrote:
> > > > On Fri, 2019-05-03 at 14:35 +0100, Bruce Richardson wrote:
> > > > > For testing of DPDK, we want to override the prefix given by
> > > > > the
> > > > > pkg-config file, so that we can get correct paths for DPDK
> > > > > installed
> > > > > in an unusual location.
> > > > > 
> > > > > Signed-off-by: Bruce Richardson <
> > > > > bruce.richardson@intel.com
> > > > > 
> > > > > 
> > > > > 
> > > > > ---
> > > > >  examples/bbdev_app/Makefile             | 13 +++++++++----
> > > > >  examples/bond/Makefile                  | 13 +++++++++----
> > > > >  examples/cmdline/Makefile               | 13 +++++++++----
> > > > >  examples/distributor/Makefile           | 13 +++++++++----
> > > > >  examples/eventdev_pipeline/Makefile     | 13 +++++++++----
> > > > >  examples/exception_path/Makefile        | 13 +++++++++----
> > > > >  examples/fips_validation/Makefile       | 13 +++++++++----
> > > > >  examples/flow_classify/Makefile         | 13 +++++++++----
> > > > >  examples/flow_filtering/Makefile        | 13 +++++++++----
> > > > >  examples/helloworld/Makefile            | 13 +++++++++----
> > > > >  examples/ip_fragmentation/Makefile      | 13 +++++++++----
> > > > >  examples/ip_pipeline/Makefile           | 13 +++++++++----
> > > > >  examples/ip_reassembly/Makefile         | 13 +++++++++----
> > > > >  examples/ipsec-secgw/Makefile           | 13 +++++++++----
> > > > >  examples/ipv4_multicast/Makefile        | 13 +++++++++----
> > > > >  examples/kni/Makefile                   | 13 +++++++++----
> > > > >  examples/l2fwd-cat/Makefile             | 13 +++++++++----
> > > > >  examples/l2fwd-crypto/Makefile          | 13 +++++++++----
> > > > >  examples/l2fwd-jobstats/Makefile        | 13 +++++++++----
> > > > >  examples/l2fwd-keepalive/Makefile       | 13 +++++++++----
> > > > >  examples/l2fwd/Makefile                 | 13 +++++++++----
> > > > >  examples/l3fwd-acl/Makefile             | 13 +++++++++----
> > > > >  examples/l3fwd-power/Makefile           | 13 +++++++++----
> > > > >  examples/l3fwd-vf/Makefile              | 13 +++++++++----
> > > > >  examples/l3fwd/Makefile                 | 13 +++++++++----
> > > > >  examples/link_status_interrupt/Makefile | 13 +++++++++----
> > > > >  examples/load_balancer/Makefile         | 13 +++++++++----
> > > > >  examples/packet_ordering/Makefile       | 13 +++++++++----
> > > > >  examples/ptpclient/Makefile             | 13 +++++++++----
> > > > >  examples/qos_meter/Makefile             | 13 +++++++++----
> > > > >  examples/qos_sched/Makefile             | 13 +++++++++----
> > > > >  examples/rxtx_callbacks/Makefile        | 13 +++++++++----
> > > > >  examples/service_cores/Makefile         | 13 +++++++++----
> > > > >  examples/skeleton/Makefile              | 13 +++++++++----
> > > > >  examples/tep_termination/Makefile       | 13 +++++++++----
> > > > >  examples/timer/Makefile                 | 13 +++++++++----
> > > > >  examples/vhost/Makefile                 | 13 +++++++++----
> > > > >  examples/vhost_scsi/Makefile            | 13 +++++++++----
> > > > >  examples/vmdq/Makefile                  | 13 +++++++++----
> > > > >  examples/vmdq_dcb/Makefile              | 13 +++++++++----
> > > > >  40 files changed, 360 insertions(+), 160 deletions(-)
> > > > > 
> > > > > diff --git a/examples/bbdev_app/Makefile
> > > > > b/examples/bbdev_app/Makefile
> > > > > index e8115b46a..603932ace 100644
> > > > > --- a/examples/bbdev_app/Makefile
> > > > > +++ b/examples/bbdev_app/Makefile
> > > > > @@ -18,10 +18,15 @@ 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
> > > > > +ifneq ($(DPDK_PC_PREFIX),)
> > > > > +       PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
> > > > > +endif
> > > > > +
> > > > > +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
> > > > 
> > > > Hi,
> > > > 
> > > > Would using "--define-prefix" allow to avoid the special-sauced
> > > > DPDK_PC_PREFIX variable?
> > > > 
> > > > -- 
> > > 
> > > Perhaps I'm missing something, but I'm not seeing how, since the
> > > code
> > > above
> > > is already using the --define-variable flag. Swapping one pkg-
> > > config
> > > flag
> > > for another isn't likely to change the flow. Whatever way things
> > > work, we
> > > need an environment variable to pull in the path change. Since
> > > one
> > > doesn't
> > > seem to be available for pkg-config directly, we need a DPDK
> > > special-
> > > sauced
> > > one.
> > > 
> > > /Bruce
> > 
> > I think PKG_CONFIG_PATH is a more common and more well-understood
> > flag
> > to use - using define-prefix should allow to use that instead
> > 
> 
> Yes, except pkg-config-path only gives the path to the pkg-config
> file, it
> doesn't affect the prefixes in the file itself, and it's the latter
> we need
> to modify.

Using --define-prefix will automatically adjust the prefixes based on
the path:

$ grep prefix /tmp/test/usr/local/lib/x86_64-linux-gnu/pkgconfig/libdpdk.pc 
prefix=/usr/local
libdir=${prefix}/lib/x86_64-linux-gnu
includedir=${prefix}/include

$ PKG_CONFIG_PATH=/tmp/test/usr/local/lib/x86_64-linux-gnu/pkgconfig
pkg-config --cflags --libs libdpdk
-include rte_config.h -march=native -I/usr/local/include
-I/usr/include/libnl3 -L/usr/local/lib/x86_64-linux-gnu -lrte_telemetry
-lrte_bpf -lrte_flow_classify -lrte_pipeline -lrte_table -lrte_port
-lrte_ipsec -lrte_vhost -lrte_stack -lrte_security -lrte_sched
-lrte_reorder -lrte_rawdev -lrte_pdump -lrte_power -lrte_member
-lrte_lpm -lrte_latencystats -lrte_kni -lrte_jobstats -lrte_ip_frag
-lrte_gso -lrte_gro -lrte_eventdev -lrte_efd -lrte_distributor
-lrte_cryptodev -lrte_compressdev -lrte_cfgfile -lrte_bitratestats
-lrte_bbdev -lrte_acl -lrte_timer -lrte_hash -lrte_metrics -lrte_pci
-lrte_ethdev -lrte_meter -lrte_net -lrte_mbuf -lrte_mempool -lrte_ring
-lrte_cmdline -lrte_eal -lrte_kvargs

$ PKG_CONFIG_PATH=/tmp/test/usr/local/lib/x86_64-linux-gnu/pkgconfig
pkg-config --define-prefix --cflags --libs libdpdk
-include rte_config.h -march=native -I/tmp/test/usr/local/lib/include
-I/usr/lib/include -I/usr/lib/include/libnl3 -I/usr/lib/include
-L/tmp/test/usr/local/lib/lib/x86_64-linux-gnu -lrte_telemetry
-lrte_bpf -lrte_flow_classify -lrte_pipeline -lrte_table -lrte_port
-lrte_ipsec -lrte_vhost -lrte_stack -lrte_security -lrte_sched
-lrte_reorder -lrte_rawdev -lrte_pdump -lrte_power -lrte_member
-lrte_lpm -lrte_latencystats -lrte_kni -lrte_jobstats -lrte_ip_frag
-lrte_gso -lrte_gro -lrte_eventdev -lrte_efd -lrte_distributor
-lrte_cryptodev -lrte_compressdev -lrte_cfgfile -lrte_bitratestats
-lrte_bbdev -lrte_acl -lrte_timer -lrte_hash -lrte_metrics -lrte_pci
-lrte_ethdev -lrte_meter -lrte_net -lrte_mbuf -lrte_mempool -lrte_ring
-lrte_cmdline -lrte_eal -lrte_kvargs
  
Bruce Richardson May 7, 2019, 4:04 p.m. UTC | #6
On Tue, May 07, 2019 at 04:53:00PM +0100, Luca Boccassi wrote:
> On Tue, 2019-05-07 at 16:17 +0100, Bruce Richardson wrote:
> > On Tue, May 07, 2019 at 02:28:11PM +0100, Luca Boccassi wrote:
> > > On Tue, 2019-05-07 at 11:50 +0100, Bruce Richardson wrote:
> > > > On Tue, May 07, 2019 at 11:09:51AM +0100, Luca Boccassi wrote:
> > > > > On Fri, 2019-05-03 at 14:35 +0100, Bruce Richardson wrote:
> > > > > > For testing of DPDK, we want to override the prefix given by
> > > > > > the
> > > > > > pkg-config file, so that we can get correct paths for DPDK
> > > > > > installed
> > > > > > in an unusual location.
> > > > > > 
> > > > > > Signed-off-by: Bruce Richardson <
> > > > > > bruce.richardson@intel.com
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > ---
> > > > > >  examples/bbdev_app/Makefile             | 13 +++++++++----
> > > > > >  examples/bond/Makefile                  | 13 +++++++++----
> > > > > >  examples/cmdline/Makefile               | 13 +++++++++----
> > > > > >  examples/distributor/Makefile           | 13 +++++++++----
> > > > > >  examples/eventdev_pipeline/Makefile     | 13 +++++++++----
> > > > > >  examples/exception_path/Makefile        | 13 +++++++++----
> > > > > >  examples/fips_validation/Makefile       | 13 +++++++++----
> > > > > >  examples/flow_classify/Makefile         | 13 +++++++++----
> > > > > >  examples/flow_filtering/Makefile        | 13 +++++++++----
> > > > > >  examples/helloworld/Makefile            | 13 +++++++++----
> > > > > >  examples/ip_fragmentation/Makefile      | 13 +++++++++----
> > > > > >  examples/ip_pipeline/Makefile           | 13 +++++++++----
> > > > > >  examples/ip_reassembly/Makefile         | 13 +++++++++----
> > > > > >  examples/ipsec-secgw/Makefile           | 13 +++++++++----
> > > > > >  examples/ipv4_multicast/Makefile        | 13 +++++++++----
> > > > > >  examples/kni/Makefile                   | 13 +++++++++----
> > > > > >  examples/l2fwd-cat/Makefile             | 13 +++++++++----
> > > > > >  examples/l2fwd-crypto/Makefile          | 13 +++++++++----
> > > > > >  examples/l2fwd-jobstats/Makefile        | 13 +++++++++----
> > > > > >  examples/l2fwd-keepalive/Makefile       | 13 +++++++++----
> > > > > >  examples/l2fwd/Makefile                 | 13 +++++++++----
> > > > > >  examples/l3fwd-acl/Makefile             | 13 +++++++++----
> > > > > >  examples/l3fwd-power/Makefile           | 13 +++++++++----
> > > > > >  examples/l3fwd-vf/Makefile              | 13 +++++++++----
> > > > > >  examples/l3fwd/Makefile                 | 13 +++++++++----
> > > > > >  examples/link_status_interrupt/Makefile | 13 +++++++++----
> > > > > >  examples/load_balancer/Makefile         | 13 +++++++++----
> > > > > >  examples/packet_ordering/Makefile       | 13 +++++++++----
> > > > > >  examples/ptpclient/Makefile             | 13 +++++++++----
> > > > > >  examples/qos_meter/Makefile             | 13 +++++++++----
> > > > > >  examples/qos_sched/Makefile             | 13 +++++++++----
> > > > > >  examples/rxtx_callbacks/Makefile        | 13 +++++++++----
> > > > > >  examples/service_cores/Makefile         | 13 +++++++++----
> > > > > >  examples/skeleton/Makefile              | 13 +++++++++----
> > > > > >  examples/tep_termination/Makefile       | 13 +++++++++----
> > > > > >  examples/timer/Makefile                 | 13 +++++++++----
> > > > > >  examples/vhost/Makefile                 | 13 +++++++++----
> > > > > >  examples/vhost_scsi/Makefile            | 13 +++++++++----
> > > > > >  examples/vmdq/Makefile                  | 13 +++++++++----
> > > > > >  examples/vmdq_dcb/Makefile              | 13 +++++++++----
> > > > > >  40 files changed, 360 insertions(+), 160 deletions(-)
> > > > > > 
> > > > > > diff --git a/examples/bbdev_app/Makefile
> > > > > > b/examples/bbdev_app/Makefile
> > > > > > index e8115b46a..603932ace 100644
> > > > > > --- a/examples/bbdev_app/Makefile
> > > > > > +++ b/examples/bbdev_app/Makefile
> > > > > > @@ -18,10 +18,15 @@ 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
> > > > > > +ifneq ($(DPDK_PC_PREFIX),)
> > > > > > +       PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
> > > > > > +endif
> > > > > > +
> > > > > > +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
> > > > > 
> > > > > Hi,
> > > > > 
> > > > > Would using "--define-prefix" allow to avoid the special-sauced
> > > > > DPDK_PC_PREFIX variable?
> > > > > 
> > > > > -- 
> > > > 
> > > > Perhaps I'm missing something, but I'm not seeing how, since the
> > > > code
> > > > above
> > > > is already using the --define-variable flag. Swapping one pkg-
> > > > config
> > > > flag
> > > > for another isn't likely to change the flow. Whatever way things
> > > > work, we
> > > > need an environment variable to pull in the path change. Since
> > > > one
> > > > doesn't
> > > > seem to be available for pkg-config directly, we need a DPDK
> > > > special-
> > > > sauced
> > > > one.
> > > > 
> > > > /Bruce
> > > 
> > > I think PKG_CONFIG_PATH is a more common and more well-understood
> > > flag
> > > to use - using define-prefix should allow to use that instead
> > > 
> > 
> > Yes, except pkg-config-path only gives the path to the pkg-config
> > file, it
> > doesn't affect the prefixes in the file itself, and it's the latter
> > we need
> > to modify.
> 
> Using --define-prefix will automatically adjust the prefixes based on
> the path:
> 
Sorry, I misunderstood what it did - I thought it required the prefix as
parameter, so yes, it looks like a good fit here.

/Bruce
  

Patch

diff --git a/examples/bbdev_app/Makefile b/examples/bbdev_app/Makefile
index e8115b46a..603932ace 100644
--- a/examples/bbdev_app/Makefile
+++ b/examples/bbdev_app/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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
 
diff --git a/examples/bond/Makefile b/examples/bond/Makefile
index 488eeac70..95b913dab 100644
--- a/examples/bond/Makefile
+++ b/examples/bond/Makefile
@@ -20,10 +20,15 @@  static: build/$(APP)-static
 
 LDFLAGS += -lrte_pmd_bond
 
-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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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
 
diff --git a/examples/cmdline/Makefile b/examples/cmdline/Makefile
index a03dfa8ee..6bc6aa167 100644
--- a/examples/cmdline/Makefile
+++ b/examples/cmdline/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/distributor/Makefile b/examples/distributor/Makefile
index 52076214b..e9c5c5d3c 100644
--- a/examples/distributor/Makefile
+++ b/examples/distributor/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/eventdev_pipeline/Makefile b/examples/eventdev_pipeline/Makefile
index 0b0d1ade9..fd96080f3 100644
--- a/examples/eventdev_pipeline/Makefile
+++ b/examples/eventdev_pipeline/Makefile
@@ -20,10 +20,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/exception_path/Makefile b/examples/exception_path/Makefile
index 18db85ddb..d633be4f8 100644
--- a/examples/exception_path/Makefile
+++ b/examples/exception_path/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/fips_validation/Makefile b/examples/fips_validation/Makefile
index e74252e27..95b6533b9 100644
--- a/examples/fips_validation/Makefile
+++ b/examples/fips_validation/Makefile
@@ -27,10 +27,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/flow_classify/Makefile b/examples/flow_classify/Makefile
index dfce1a4bd..3078c5ec7 100644
--- a/examples/flow_classify/Makefile
+++ b/examples/flow_classify/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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
 
diff --git a/examples/flow_filtering/Makefile b/examples/flow_filtering/Makefile
index f657c0336..ee2eb8754 100644
--- a/examples/flow_filtering/Makefile
+++ b/examples/flow_filtering/Makefile
@@ -16,10 +16,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/helloworld/Makefile b/examples/helloworld/Makefile
index 97d82f68a..eaf028d02 100644
--- a/examples/helloworld/Makefile
+++ b/examples/helloworld/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/ip_fragmentation/Makefile b/examples/ip_fragmentation/Makefile
index 6d1a1fbba..979333af2 100644
--- a/examples/ip_fragmentation/Makefile
+++ b/examples/ip_fragmentation/Makefile
@@ -19,10 +19,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile
index 409966afd..a224080af 100644
--- a/examples/ip_pipeline/Makefile
+++ b/examples/ip_pipeline/Makefile
@@ -31,10 +31,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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 += -I.
 
diff --git a/examples/ip_reassembly/Makefile b/examples/ip_reassembly/Makefile
index 7bbc241c7..00b652e85 100644
--- a/examples/ip_reassembly/Makefile
+++ b/examples/ip_reassembly/Makefile
@@ -19,10 +19,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/ipsec-secgw/Makefile b/examples/ipsec-secgw/Makefile
index ac042e4ce..64379383b 100644
--- a/examples/ipsec-secgw/Makefile
+++ b/examples/ipsec-secgw/Makefile
@@ -29,10 +29,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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
 
diff --git a/examples/ipv4_multicast/Makefile b/examples/ipv4_multicast/Makefile
index 5a1e368fa..2758e1442 100644
--- a/examples/ipv4_multicast/Makefile
+++ b/examples/ipv4_multicast/Makefile
@@ -19,10 +19,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/kni/Makefile b/examples/kni/Makefile
index 634334f86..afc8ddcbf 100644
--- a/examples/kni/Makefile
+++ b/examples/kni/Makefile
@@ -18,11 +18,16 @@  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)
+PKGCONF=pkg-config
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk)
+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
 CFLAGS += -DALLOW_EXPERIMENTAL_API
-LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
-LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/l2fwd-cat/Makefile b/examples/l2fwd-cat/Makefile
index fb3c4bc00..73db78ab2 100644
--- a/examples/l2fwd-cat/Makefile
+++ b/examples/l2fwd-cat/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 LDFLAGS += -lpqos
 
diff --git a/examples/l2fwd-crypto/Makefile b/examples/l2fwd-crypto/Makefile
index ed5e2c73f..88ff086e7 100644
--- a/examples/l2fwd-crypto/Makefile
+++ b/examples/l2fwd-crypto/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/l2fwd-jobstats/Makefile b/examples/l2fwd-jobstats/Makefile
index e14c3a2b2..064799609 100644
--- a/examples/l2fwd-jobstats/Makefile
+++ b/examples/l2fwd-jobstats/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/l2fwd-keepalive/Makefile b/examples/l2fwd-keepalive/Makefile
index bc851b732..1fc3337ea 100644
--- a/examples/l2fwd-keepalive/Makefile
+++ b/examples/l2fwd-keepalive/Makefile
@@ -20,10 +20,15 @@  static: build/$(APP)-static
 
 LDFLAGS += -pthread -lrt
 
-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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/l2fwd/Makefile b/examples/l2fwd/Makefile
index 94d70a43e..b4cc1ae01 100644
--- a/examples/l2fwd/Makefile
+++ b/examples/l2fwd/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/l3fwd-acl/Makefile b/examples/l3fwd-acl/Makefile
index fc236f129..4918a63eb 100644
--- a/examples/l3fwd-acl/Makefile
+++ b/examples/l3fwd-acl/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/l3fwd-power/Makefile b/examples/l3fwd-power/Makefile
index a106b0404..df7963895 100644
--- a/examples/l3fwd-power/Makefile
+++ b/examples/l3fwd-power/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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
 
diff --git a/examples/l3fwd-vf/Makefile b/examples/l3fwd-vf/Makefile
index cc93603e3..1c6ec41fe 100644
--- a/examples/l3fwd-vf/Makefile
+++ b/examples/l3fwd-vf/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/l3fwd/Makefile b/examples/l3fwd/Makefile
index 8c51c7b96..3d23f3ac4 100644
--- a/examples/l3fwd/Makefile
+++ b/examples/l3fwd/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/link_status_interrupt/Makefile b/examples/link_status_interrupt/Makefile
index d12e04782..fd7bb204d 100644
--- a/examples/link_status_interrupt/Makefile
+++ b/examples/link_status_interrupt/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/load_balancer/Makefile b/examples/load_balancer/Makefile
index d4b145ca1..807a2f99a 100644
--- a/examples/load_balancer/Makefile
+++ b/examples/load_balancer/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/packet_ordering/Makefile b/examples/packet_ordering/Makefile
index 474ec9571..4ef8fef26 100644
--- a/examples/packet_ordering/Makefile
+++ b/examples/packet_ordering/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/ptpclient/Makefile b/examples/ptpclient/Makefile
index f113c9d56..c94f64eb0 100644
--- a/examples/ptpclient/Makefile
+++ b/examples/ptpclient/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/qos_meter/Makefile b/examples/qos_meter/Makefile
index fbcda09b2..fab91a0ff 100644
--- a/examples/qos_meter/Makefile
+++ b/examples/qos_meter/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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
 
diff --git a/examples/qos_sched/Makefile b/examples/qos_sched/Makefile
index a25875900..e78b9fe56 100644
--- a/examples/qos_sched/Makefile
+++ b/examples/qos_sched/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/rxtx_callbacks/Makefile b/examples/rxtx_callbacks/Makefile
index b937d599b..143d8383a 100644
--- a/examples/rxtx_callbacks/Makefile
+++ b/examples/rxtx_callbacks/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/service_cores/Makefile b/examples/service_cores/Makefile
index 351fb7e1d..c30920076 100644
--- a/examples/service_cores/Makefile
+++ b/examples/service_cores/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/skeleton/Makefile b/examples/skeleton/Makefile
index 56713a524..e1de10874 100644
--- a/examples/skeleton/Makefile
+++ b/examples/skeleton/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/tep_termination/Makefile b/examples/tep_termination/Makefile
index f4b85e49b..474ce3f74 100644
--- a/examples/tep_termination/Makefile
+++ b/examples/tep_termination/Makefile
@@ -20,10 +20,15 @@  static: build/$(APP)-static
 
 LDFLAGS += -pthread
 
-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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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 += -Wno-deprecated-declarations
 
diff --git a/examples/timer/Makefile b/examples/timer/Makefile
index 046348fd1..356094e72 100644
--- a/examples/timer/Makefile
+++ b/examples/timer/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/vhost/Makefile b/examples/vhost/Makefile
index 80607b79c..ee2b9d8d6 100644
--- a/examples/vhost/Makefile
+++ b/examples/vhost/Makefile
@@ -20,10 +20,15 @@  static: build/$(APP)-static
 
 LDFLAGS += -pthread
 
-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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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
 
diff --git a/examples/vhost_scsi/Makefile b/examples/vhost_scsi/Makefile
index 0a3450bae..61aa318fa 100644
--- a/examples/vhost_scsi/Makefile
+++ b/examples/vhost_scsi/Makefile
@@ -21,10 +21,15 @@  static: build/$(APP)-static
 CFLAGS += -D_FILE_OFFSET_BITS=64
 LDFLAGS += -pthread
 
-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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/vmdq/Makefile b/examples/vmdq/Makefile
index 6a389c776..27c618daf 100644
--- a/examples/vmdq/Makefile
+++ b/examples/vmdq/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
diff --git a/examples/vmdq_dcb/Makefile b/examples/vmdq_dcb/Makefile
index 113bce7d1..6f76c7fd1 100644
--- a/examples/vmdq_dcb/Makefile
+++ b/examples/vmdq_dcb/Makefile
@@ -18,10 +18,15 @@  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
+ifneq ($(DPDK_PC_PREFIX),)
+	PKGCONF += --define-variable=prefix=$(DPDK_PC_PREFIX)
+endif
+
+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)
 
 build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
 	$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)