From patchwork Mon Aug 14 09:52:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 27575 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 505927D2A; Mon, 14 Aug 2017 12:04:36 +0200 (CEST) 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) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Aug 2017 03:03:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,372,1498546800"; d="scan'208";a="118723960" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.223.223]) by orsmga004.jf.intel.com with ESMTP; 14 Aug 2017 03:03:58 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: thomas@monjalon.net, Bruce Richardson Date: Mon, 14 Aug 2017 10:52:08 +0100 Message-Id: <20170814095208.166496-41-bruce.richardson@intel.com> X-Mailer: git-send-email 2.13.4 In-Reply-To: <20170814095208.166496-1-bruce.richardson@intel.com> References: <20170814095208.166496-1-bruce.richardson@intel.com> Subject: [dpdk-dev] [RFCv2 40/40] examples: allow basic sample app build using pkg-config X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list 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