From: Bruce Richardson Subject: [RFCv2 40/40] examples: allow basic sample app build using pkg-config Date: Mon, 14 Aug 2017 10:52:08 +0100 Message-ID: <20170814095208.166496-41-bruce.richardson@intel.com> References: <20170814095208.166496-1-bruce.richardson@intel.com> Cc: thomas@monjalon.net, Bruce Richardson To: dev@dpdk.org Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 018FB99D6 for ; Mon, 14 Aug 2017 12:03:59 +0200 (CEST) In-Reply-To: <20170814095208.166496-1-bruce.richardson@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: Bruce Richardson --- examples/helloworld/Makefile | 13 +++++++++++++ examples/l2fwd/Makefile | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/examples/helloworld/Makefile b/examples/helloworld/Makefile index c83ec01e8..270f02f91 100644 --- a/examples/helloworld/Makefile +++ b/examples/helloworld/Makefile @@ -29,6 +29,17 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +ifeq ($(shell pkg-config --exists DPDK || echo 1),) +# we have pkg-config install DPDK + +CFLAGS += $(shell pkg-config --cflags DPDK) +LDFLAGS += $(shell pkg-config --libs DPDK) + +helloworld: main.o + $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) + +else # legacy build system + ifeq ($(RTE_SDK),) $(error "Please define RTE_SDK environment variable") endif @@ -48,3 +59,5 @@ CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) include $(RTE_SDK)/mk/rte.extapp.mk + +endif diff --git a/examples/l2fwd/Makefile b/examples/l2fwd/Makefile index 8896ab452..d631c7d35 100644 --- a/examples/l2fwd/Makefile +++ b/examples/l2fwd/Makefile @@ -29,6 +29,17 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +ifeq ($(shell pkg-config --exists DPDK || echo 1),) +# we have pkg-config install DPDK + +CFLAGS += $(shell pkg-config --cflags DPDK) +LDFLAGS += $(shell pkg-config --libs DPDK) + +l2fwd: main.o + $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) + +else # legacy build system + ifeq ($(RTE_SDK),) $(error "Please define RTE_SDK environment variable") endif @@ -48,3 +59,5 @@ CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) include $(RTE_SDK)/mk/rte.extapp.mk + +endif -- 2.13.4