From patchwork Tue Feb 18 14:08:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 24852 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 152D0202B2 for ; Tue, 18 Feb 2014 14:07:19 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id g12sf69740673oah.10 for ; Tue, 18 Feb 2014 06:07:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:to:cc:subject:date:message-id :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe:content-type; bh=fbya4uTqjq5NAu9QL0NiiCNiikh+TVU1RlhXSsn6/0A=; b=ZTZyGPsckpSgbb/G249tDfrlG2+ctFOZcL8imgTiMtnheLXLt6UHVrdgPDn9ePCmCX nNJIWR6A4kHOQgi3od6KJtJrCN4bi5Lak+exBmgmjGs3Jurmg3yNfzKPNkNytJpiAD8M Ul5UkELyLoc9KJafhTJFD6rNT0eUVvsOI95nbqJcl1TFk3T9PYqZif+Qy1acU5i25f+v c0OUZfIuegKLns/R3b/PawlFvyYZ4nhLwzGF8kmZJr4mAN4Yz9gnvSNJG6ZUS1bL4P8S 8w6hDLacMxfCNuOzaRVVHS7On8DThMN8/XH1b1jSOlJypC1yPRMHUG6C65cdINqvXStm CiVw== X-Gm-Message-State: ALoCoQlhXI9SIqrINAoj/xQEanFzgThOQZ329iLbbP92UdWcE902acZ3TFSJYGrAwfTPXQMczUmi X-Received: by 10.50.114.105 with SMTP id jf9mr2668849igb.1.1392732439084; Tue, 18 Feb 2014 06:07:19 -0800 (PST) MIME-Version: 1.0 X-BeenThere: lng-odp@linaro.org Received: by 10.140.84.165 with SMTP id l34ls1238787qgd.5.gmail; Tue, 18 Feb 2014 06:07:18 -0800 (PST) X-Received: by 10.224.40.130 with SMTP id k2mr2345757qae.91.1392732438722; Tue, 18 Feb 2014 06:07:18 -0800 (PST) Received: from mail-qa0-f46.google.com (mail-qa0-f46.google.com [209.85.216.46]) by mx.google.com with ESMTPS id x103si10190556qgx.127.2014.02.18.06.07.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Feb 2014 06:07:18 -0800 (PST) Received-SPF: neutral (google.com: 209.85.216.46 is neither permitted nor denied by best guess record for domain of petri.savolainen@linaro.org) client-ip=209.85.216.46; Received: by mail-qa0-f46.google.com with SMTP id k15so10173402qaq.33 for ; Tue, 18 Feb 2014 06:07:18 -0800 (PST) X-Received: by 10.224.43.144 with SMTP id w16mr2159764qae.93.1392732438318; Tue, 18 Feb 2014 06:07:18 -0800 (PST) Received: from localhost.localdomain (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id h12sm27150465qge.0.2014.02.18.06.07.16 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Feb 2014 06:07:17 -0800 (PST) From: Petri Savolainen To: lng-odp@linaro.org Cc: Petri Savolainen Subject: [lng-odp] [PATCH] Makefile cleanup Date: Tue, 18 Feb 2014 16:08:11 +0200 Message-Id: <1392732491-2051-1-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 1.8.5.3 X-Original-Sender: petri.savolainen@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.216.46 is neither permitted nor denied by best guess record for domain of petri.savolainen@linaro.org) smtp.mail=petri.savolainen@linaro.org Precedence: list Mailing-list: list lng-odp@linaro.org; contact lng-odp+owners@linaro.org List-ID: X-Google-Group-Id: 474323889996 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , - Enabled test level make / make clean without install - Main level Makefile installs files still by default - Moved common stuff into odp/Makefile.inc and odp/test/Makefile.inc Signed-off-by: Petri Savolainen --- Makefile | 15 +++++++-------- Makefile.inc | 34 +++++++++++++++++++++------------- platform/linux-generic/Makefile | 4 ++-- test/Makefile.inc | 19 +++++++++++++++---- test/api_test/Makefile | 34 ++++++++++++++++++---------------- test/example/Makefile | 21 ++++++++++----------- test/packet/Makefile | 22 ++++++++-------------- test/packet_netmap/Makefile | 20 +++++++------------- 8 files changed, 88 insertions(+), 81 deletions(-) diff --git a/Makefile b/Makefile index f086750..2512343 100644 --- a/Makefile +++ b/Makefile @@ -5,10 +5,9 @@ .DEFAULT_GOAL := default -ODP_ROOT = $(PWD) -ODP_TESTS = $(ODP_ROOT)/test -PLATFORM_ROOT = $(ODP_ROOT)/platform/$(PLATFORM) -INCLUDE = -I$(ODP_ROOT)/include +ODP_ROOT = $(PWD) +ODP_TESTS = $(ODP_ROOT)/test +export DESTDIR = $(ODP_ROOT)/build include $(ODP_ROOT)/Makefile.inc @@ -28,19 +27,19 @@ tests: libs_install .PHONY: docs docs: - $(MAKE) -C $(PLATFORM_ROOT) docs + $(MAKE) -C $(ODP_DIR) docs .PHONY: docs_install docs_install: docs - $(MAKE) -C $(PLATFORM_ROOT) docs_install + $(MAKE) -C $(ODP_DIR) docs_install .PHONY: lib lib: - $(MAKE) -C $(PLATFORM_ROOT) libs + $(MAKE) -C $(ODP_DIR) libs .PHONY: clean clean: - $(MAKE) -C $(PLATFORM_ROOT) clean + $(MAKE) -C $(ODP_DIR) clean $(MAKE) -C $(ODP_TESTS) clean .PHONY: libs_install diff --git a/Makefile.inc b/Makefile.inc index 523385d..1af7643 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -4,27 +4,35 @@ # SPDX-License-Identifier: BSD-3-Clause PLATFORM ?= linux-generic -CFLAGS += -DODP_DEBUG=1 -CFLAGS += -O3 -#CFLAGS += -O0 -g +OBJ_DIR = ./obj +ODP_DIR = $(ODP_ROOT)/platform/$(PLATFORM) -OBJ_DIR = ./obj -DESTDIR ?= $(ODP_ROOT)/build - -CFLAGS += -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -CFLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith -CFLAGS += -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral -CFLAGS += -Wformat-security -Wundef -Wwrite-strings CC ?= gcc LD ?= gcc AR ?= ar - -ECHO := echo +ECHO := @echo MKDIR := mkdir -p RMDIR := rm -rf RM := rm -f COPY := cp -r -CFLAGS += -pthread +CFLAGS += -DODP_DEBUG=1 +CFLAGS += -O3 +#CFLAGS += -O0 -g +CFLAGS += -pthread +CFLAGS += -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes +CFLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith +CFLAGS += -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral +CFLAGS += -Wformat-security -Wundef -Wwrite-strings + + LDFLAGS += -pthread +LDFLAGS += -lrt +LDFLAGS += $(EXTRA_CFLAGS) + +.PHONY: default +default: + +$(OBJ_DIR): + $(MKDIR) $(OBJ_DIR) diff --git a/platform/linux-generic/Makefile b/platform/linux-generic/Makefile index b640928..676d4bf 100644 --- a/platform/linux-generic/Makefile +++ b/platform/linux-generic/Makefile @@ -78,8 +78,8 @@ all: libs docs -include $(DEPS) -$(OBJ_DIR): - $(MKDIR) $(OBJ_DIR) +#$(OBJ_DIR): +# $(MKDIR) $(OBJ_DIR) $(LIB_DIR): $(MKDIR) $(LIB_DIR) diff --git a/test/Makefile.inc b/test/Makefile.inc index 72bbebd..1bb6a3c 100644 --- a/test/Makefile.inc +++ b/test/Makefile.inc @@ -3,10 +3,21 @@ # # SPDX-License-Identifier: BSD-3-Clause -ODP_TEST_ROOT = $(ODP_ROOT)/test +ifdef DESTDIR + +ODP_LIB = $(DESTDIR)/lib/libodp.a CFLAGS += -I$(DESTDIR)/include -LIB = -L$(DESTDIR)/lib -lodp +CFLAGS += -I$(DESTDIR)/include/api + +else + +ODP_LIB = $(ODP_DIR)/lib/libodp.a +CFLAGS += -I$(ODP_ROOT)/include +CFLAGS += -I$(ODP_DIR)/include/api + +$(ODP_LIB): + @echo Building $@ + $(MAKE) -C $(ODP_DIR) libs -LDFLAGS += -lrt -LDFLAGS += $(EXTRA_CFLAGS) +endif diff --git a/test/api_test/Makefile b/test/api_test/Makefile index 15c18f4..1c90174 100644 --- a/test/api_test/Makefile +++ b/test/api_test/Makefile @@ -12,12 +12,19 @@ ODP_ATOMIC = odp_atomic ODP_SHM = odp_shm ODP_RING = odp_ring -CFLAGS += -I$(ODP_ROOT)/platform/linux-generic/include - -include ../Makefile.inc include $(ODP_ROOT)/Makefile.inc +include ../Makefile.inc + +.PHONY: default +default: all + +CFLAGS += -I. +#CFLAGS += -I$(ODP_LIB) +#CFLAGS += -I$(ODP_ROOT)/platform/linux-generic/include +#CFLAGS += -I$(ARCH_INC) +#CFLAGS += -DODP_TEST_ATOMIC + -CFLAGS += -I$(ODP_TEST_ROOT)/api_test ATOMIC_OBJS = ATOMIC_OBJS += $(OBJ_DIR)/odp_common.o @@ -41,12 +48,6 @@ ring: $(OBJ_DIR) $(ODP_RING) -include $(DEPS) -$(DESTDIR)/lib/libodp.a: - @test -e $@ || (echo "$@ is missing" && false) - -$(OBJ_DIR): $(DESTDIR)/lib/libodp.a - $(MKDIR) $(OBJ_DIR) - # # Compile rules # @@ -57,17 +58,17 @@ $(OBJ_DIR)/%.o: %.c # # Link rule # -$(ODP_ATOMIC): $(ATOMIC_OBJS) +$(ODP_ATOMIC): $(ODP_LIB) $(ATOMIC_OBJS) $(ECHO) Linking $< - $(CC) $(LDFLAGS) $(ATOMIC_OBJS) $(LIB) -o $@ + $(CC) $(LDFLAGS) $(ATOMIC_OBJS) $(ODP_LIB) -o $@ -$(ODP_SHM): $(SHM_OBJS) +$(ODP_SHM): $(ODP_LIB) $(SHM_OBJS) $(ECHO) Linking $< - $(CC) $(LDFLAGS) $(SHM_OBJS) $(LIB) -o $@ + $(CC) $(LDFLAGS) $(SHM_OBJS) $(ODP_LIB) -o $@ -$(ODP_RING): $(RING_OBJS) +$(ODP_RING): $(ODP_LIB) $(RING_OBJS) $(ECHO) Linking $< - $(CC) $(LDFLAGS) $(RING_OBJS) $(LIB) -o $@ + $(CC) $(LDFLAGS) $(RING_OBJS) $(ODP_LIB) -o $@ .PHONY: clean clean: @@ -75,6 +76,7 @@ clean: $(RM) $(ODP_ATOMIC) $(RM) $(ODP_SHM) $(RM) $(ODP_RING) + $(MAKE) -C $(ODP_DIR) clean .PHONY: install install: diff --git a/test/example/Makefile b/test/example/Makefile index d43e780..ba3940f 100644 --- a/test/example/Makefile +++ b/test/example/Makefile @@ -6,24 +6,22 @@ ODP_ROOT = ../.. ODP_APP = odp_example -include ../Makefile.inc include $(ODP_ROOT)/Makefile.inc +include ../Makefile.inc + +.PHONY: default +default: $(OBJ_DIR) $(ODP_APP) + + +CFLAGS += -I. OBJS = OBJS += $(OBJ_DIR)/odp_example.o DEPS = $(OBJS:.o=.d) -.PHONY: all -all: $(OBJ_DIR) $(ODP_APP) - -include $(DEPS) -$(DESTDIR)/lib/libodp.a: - @test -e $@ || (echo "$@ is missing" && false) - -$(OBJ_DIR): $(DESTDIR)/lib/libodp.a - $(MKDIR) $(OBJ_DIR) # # Compile rules @@ -35,14 +33,15 @@ $(OBJ_DIR)/%.o: %.c # # Link rule # -$(ODP_APP): $(OBJS) +$(ODP_APP): $(ODP_LIB) $(OBJS) $(ECHO) Linking $< - $(CC) $(LDFLAGS) $(OBJS) $(LIB) -o $@ + $(CC) $(LDFLAGS) $(OBJS) $(ODP_LIB) -o $@ .PHONY: clean clean: $(RMDIR) $(OBJ_DIR) $(RM) $(ODP_APP) + $(MAKE) -C $(ODP_DIR) clean .PHONY: install install: diff --git a/test/packet/Makefile b/test/packet/Makefile index f1cb7d9..83c813b 100644 --- a/test/packet/Makefile +++ b/test/packet/Makefile @@ -6,27 +6,21 @@ ODP_ROOT = ../.. ODP_APP = odp_packet -include ../Makefile.inc -include $(ODP_ROOT)/Makefile.inc +CFLAGS += -I. -CFLAGS += -I$(ODP_TEST_ROOT)/packet +include $(ODP_ROOT)/Makefile.inc +include ../Makefile.inc OBJS = OBJS += $(OBJ_DIR)/odp_example_pktio.o DEPS = $(OBJS:.o=.d) -.PHONY: all -all: $(OBJ_DIR) $(ODP_APP) +.PHONY: default +default: $(OBJ_DIR) $(ODP_APP) -include $(DEPS) -$(DESTDIR)/lib/libodp.a: - @test -e $@ || (echo "$@ is missing" && false) - -$(OBJ_DIR): $(DESTDIR)/lib/libodp.a - $(MKDIR) $(OBJ_DIR) - # # Compile rules # @@ -37,14 +31,14 @@ $(OBJ_DIR)/%.o: %.c # # Link rule # -$(ODP_APP): $(OBJS) - $(ECHO) Linking $< - $(CC) $(LDFLAGS) $(OBJS) $(LIB) -o $@ +$(ODP_APP): $(ODP_LIB) $(OBJS) + $(CC) $(LDFLAGS) $(OBJS) $(ODP_LIB) -o $@ .PHONY: clean clean: $(RMDIR) $(OBJ_DIR) $(RM) $(ODP_APP) + $(MAKE) -C $(ODP_DIR) clean .PHONY: install install: diff --git a/test/packet_netmap/Makefile b/test/packet_netmap/Makefile index 5febb33..1ef0df1 100644 --- a/test/packet_netmap/Makefile +++ b/test/packet_netmap/Makefile @@ -6,28 +6,22 @@ ODP_ROOT = ../.. ODP_APP = odp_packet +CFLAGS += -I. CFLAGS += -DODP_HAVE_NETMAP -CFLAGS += -O0 -g -include ../Makefile.inc include $(ODP_ROOT)/Makefile.inc +include ../Makefile.inc OBJS = OBJS += $(OBJ_DIR)/odp_example_pktio_netmap.o DEPS = $(OBJS:.o=.d) -.PHONY: all -all: $(OBJ_DIR) $(ODP_APP) +.PHONY: default +default: $(OBJ_DIR) $(ODP_APP) -include $(DEPS) -$(DESTDIR)/lib/libodp.a: - @test -e $@ || (echo "$@ is missing" && false) - -$(OBJ_DIR): $(DESTDIR)/lib/libodp.a - $(MKDIR) $(OBJ_DIR) - # # Compile rules # @@ -38,14 +32,14 @@ $(OBJ_DIR)/%.o: %.c # # Link rule # -$(ODP_APP): $(OBJS) - $(ECHO) Linking $< - $(CC) $(LDFLAGS) $(OBJS) $(LIB) -o $@ +$(ODP_APP): $(ODP_LIB) $(OBJS) + $(CC) $(LDFLAGS) $(OBJS) $(ODP_LIB) -o $@ .PHONY: clean clean: $(RMDIR) $(OBJ_DIR) $(RM) $(ODP_APP) + $(MAKE) -C $(ODP_DIR) clean .PHONY: install install: