From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-f173.google.com (mail-we0-f173.google.com [74.125.82.173]) by dpdk.org (Postfix) with ESMTP id 87192695D for ; Tue, 4 Feb 2014 16:53:47 +0100 (CET) Received: by mail-we0-f173.google.com with SMTP id x55so4382132wes.32 for ; Tue, 04 Feb 2014 07:55:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=S5hrCMhKJXzPyYUsDF5fmQB6uvjQ8B0gc6e8Ks1mptU=; b=fr66W+bgeZPIrf8vP6k5F9PeeWmaJUuyDwO8Xx2miG4ox28yUv4qWr7hcEnE1UDNV/ jvAu7CN1PyjND+B2U7QbOIFrYgPm4jm1MskH44ynDJ0ySGF0ZCTYGNok6/qU7S4cIT8x Y/Y0HN0aVLtdI5L3APgZOVz33aPzEjgaW1/HS4HbvvvOWrGqaxBtceizEqEVXcPIeEd+ +Qp2yrP29kRg2ghl/mi+/f8J/tTtbWZ6Fw/JgBvheH58SmZRY5EM1nNwJfTmFi//ftw5 0mS444ZBlJMrgjxLlfwazFxi7TLegJpDLCotPgSfB0S4kHModeSSBM7jHmtxsAJgl2jO cAKA== X-Gm-Message-State: ALoCoQniCveNd0H2rLz5KZmVZ7/jeNMHriA+zSylhVjK/27XigLvtwXv4ykOkH/3rxYrYEQjTzv3 X-Received: by 10.180.109.16 with SMTP id ho16mr11179732wib.3.1391529308367; Tue, 04 Feb 2014 07:55:08 -0800 (PST) Received: from angus.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id q2sm53639203wjq.0.2014.02.04.07.55.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Feb 2014 07:55:07 -0800 (PST) From: Thomas Monjalon To: dev@dpdk.org Date: Tue, 4 Feb 2014 16:54:25 +0100 Message-Id: <1391529271-24606-11-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1391529271-24606-1-git-send-email-thomas.monjalon@6wind.com> References: <1391529271-24606-1-git-send-email-thomas.monjalon@6wind.com> Subject: [dpdk-dev] [virtio-net-pmd PATCH 10/16] mk: allow to build outside of the source directory X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Feb 2014 15:53:47 -0000 S specify source directory (when not already in). O specify output directory (when different of current one). Signed-off-by: Thomas Monjalon --- Makefile | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4b51057..4ff4c1d 100644 --- a/Makefile +++ b/Makefile @@ -36,16 +36,27 @@ override CPPFLAGS += -Wall -Wextra -Werror override CFLAGS += -fPIC override LDFLAGS += -shared -all : +S ?= . +O ?= . + +all : $O/$(SOLIB) + +$O : + mkdir -p $@ + +$O/$(SOLIB) : $S/virtio_user.c | $O ifeq '$(RTE_INCLUDE)' '' @ echo 'ERROR: RTE_INCLUDE is not set' && false endif $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \ -I$(RTE_INCLUDE) -include $(RTE_INCLUDE)/rte_config.h \ - -o $(SOLIB) virtio_user.c + -o $@ $< clean : - rm -f $(SOLIB) + - rm -f $O/$(SOLIB) +ifneq '$(abspath $O)' '$(CURDIR)' + - rmdir -p $O 2>&- +endif help : @ echo 'rules:' @@ -53,6 +64,7 @@ help : @ echo ' clean' @ echo 'variables:' @ echo ' RTE_INCLUDE (e.g. ../dpdk/build/include),' - @ echo ' CPPFLAGS, CFLAGS, LDFLAGS' + @ echo ' CPPFLAGS, CFLAGS, LDFLAGS,' + @ echo ' S (source directory), O (build directory)' .PHONY : all clean help -- 1.7.10.4