From 1e3dca51bbc8b99102977092b8738aa5bd4bf847 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 26 Nov 2015 16:45:36 -0500 Subject: [PATCH] build: set platform name without quotes and reuse everywhere Avoid having to remove quotes wherever the platform name is used by exporting the variable only once. Change-Id: I4cb51901e4ac19d70d0310fe6bbacd157f586661 Signed-off-by: Anas Nashif --- Makefile | 4 +++- arch/arc/Kbuild | 4 ++-- arch/arc/platforms/quark_se-arc/Makefile | 4 ++-- arch/arm/Kbuild | 4 ++-- arch/arm/core/cortex_m/Makefile | 2 +- arch/x86/Kbuild | 4 +--- arch/x86/platforms/quark_se-x86/Makefile | 1 + drivers/Makefile | 4 ++-- drivers/aio/Makefile | 4 ---- samples/microkernel/apps/nfc_hello/src/Makefile | 2 +- samples/nanokernel/test/test_atomic/src/Makefile | 2 +- samples/nanokernel/test/test_context/src/Makefile | 2 +- 12 files changed, 17 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 3bb875a17a5..53f24229c12 100644 --- a/Makefile +++ b/Makefile @@ -746,12 +746,14 @@ libs-y1 := $(patsubst %/, %/lib.a, $(libs-y)) libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y)) libs-y := $(libs-y1) $(libs-y2) +PLATFORM_NAME = $(subst $(DQUOTE),,$(CONFIG_PLATFORM)) +export PLATFORM_NAME # Externally visible symbols (used by link-zephyr.sh) export KBUILD_ZEPHYR_MAIN := $(drivers-y) $(core-y) $(libs-y) $(app-y) ifdef CONFIG_HAVE_CUSTOM_LINKER_SCRIPT export KBUILD_LDS := $(subst $(DQUOTE),,$(CONFIG_CUSTOM_LINKER_SCRIPT)) else -export KBUILD_LDS := $(srctree)/arch/$(SRCARCH)/platforms/$(subst $(DQUOTE),,$(CONFIG_PLATFORM))/linker.cmd +export KBUILD_LDS := $(srctree)/arch/$(SRCARCH)/platforms/$(PLATFORM_NAME)/linker.cmd endif export LDFLAGS_zephyr # used by scripts/pacmage/Makefile diff --git a/arch/arc/Kbuild b/arch/arc/Kbuild index 8c91fbda4a5..08993d0955e 100644 --- a/arch/arc/Kbuild +++ b/arch/arc/Kbuild @@ -1,7 +1,7 @@ -subdir-ccflags-y +=-I$(srctree)/arch/arc/platforms/$(subst $(DQUOTE),,$(CONFIG_PLATFORM)) +subdir-ccflags-y +=-I$(srctree)/arch/arc/platforms/$(PLATFORM_NAME) subdir-ccflags-y +=-I$(srctree)/include/drivers subdir-ccflags-y +=-I$(srctree)/drivers subdir-asflags-y += $(subdir-ccflags-y) obj-y = core/ -obj-y += platforms/$(subst $(DQUOTE),,$(CONFIG_PLATFORM))/ +obj-y += platforms/$(PLATFORM_NAME)/ diff --git a/arch/arc/platforms/quark_se-arc/Makefile b/arch/arc/platforms/quark_se-arc/Makefile index 24678fc2966..37d08295846 100644 --- a/arch/arc/platforms/quark_se-arc/Makefile +++ b/arch/arc/platforms/quark_se-arc/Makefile @@ -1,10 +1,10 @@ -ccflags-y +=-I$(srctree)/arch/arc/platforms/$(subst $(DQUOTE),,$(CONFIG_PLATFORM)) +ccflags-y +=-I$(srctree)/arch/arc/platforms/$(PLATFORM_NAME) ccflags-y +=-I$(srctree)/arch/x86/platforms/ ccflags-y +=-I$(srctree)/include ccflags-y +=-I$(srctree)/include/drivers ccflags-y +=-I$(srctree)/drivers +asflags-y +=-I$(srctree)/arch/arc/platforms/$(PLATFORM_NAME) ccflags-$(CONFIG_ADC) +=-I$(srctree)/drivers/adc -asflags-y +=-I$(srctree)/arch/arc/platforms/$(subst $(DQUOTE),,$(CONFIG_PLATFORM)) asflags-y := ${ccflags-y} diff --git a/arch/arm/Kbuild b/arch/arm/Kbuild index 9806cfd3b23..0db5c455db9 100644 --- a/arch/arm/Kbuild +++ b/arch/arm/Kbuild @@ -1,7 +1,7 @@ subdir-ccflags-y +=-I$(srctree)/include/drivers subdir-ccflags-y +=-I$(srctree)/drivers -subdir-ccflags-y +=-I$(srctree)/arch/arm/platforms/$(subst $(DQUOTE),,$(CONFIG_PLATFORM)) +subdir-ccflags-y +=-I$(srctree)/arch/arm/platforms/$(PLATFORM_NAME) subdir-asflags-y := ${subdir-ccflags-y} obj-y += core/ -obj-y += platforms/$(subst $(DQUOTE),,$(CONFIG_PLATFORM))/ +obj-y += platforms/$(PLATFORM_NAME)/ diff --git a/arch/arm/core/cortex_m/Makefile b/arch/arm/core/cortex_m/Makefile index a3304367df3..b0ad3a69e1a 100644 --- a/arch/arm/core/cortex_m/Makefile +++ b/arch/arm/core/cortex_m/Makefile @@ -1,5 +1,5 @@ ccflags-y +=-I$(srctree)/include/drivers -ccflags-y +=-I$(srctree)/arch/$(ARCH)/platforms/$(subst $(DQUOTE),,$(CONFIG_PLATFORM)) +ccflags-y +=-I$(srctree)/arch/$(ARCH)/platforms/$(PLATFORM_NAME) asflags-y = $(ccflags-y) diff --git a/arch/x86/Kbuild b/arch/x86/Kbuild index e70fbabe4cb..d5179097fc3 100644 --- a/arch/x86/Kbuild +++ b/arch/x86/Kbuild @@ -1,4 +1,2 @@ -DQUOTE = " -# This comment line is to fix the highlighting of some editors due the quote effect." obj-y += core/ -obj-y += platforms/$(subst $(DQUOTE),,$(CONFIG_PLATFORM))/ +obj-y += platforms/$(PLATFORM_NAME)/ diff --git a/arch/x86/platforms/quark_se-x86/Makefile b/arch/x86/platforms/quark_se-x86/Makefile index 1a5df9af103..eaaa2f9dca0 100644 --- a/arch/x86/platforms/quark_se-x86/Makefile +++ b/arch/x86/platforms/quark_se-x86/Makefile @@ -1,4 +1,5 @@ ccflags-y +=-I$(srctree)/arch/x86 +ccflags-y +=-I$(srctree)/arch/x86/platforms/$(PLATFORM_NAME)/ ccflags-y +=-I$(srctree)/include/drivers ccflags-y +=-I$(srctree)/drivers asflags-y := ${ccflags-y} diff --git a/drivers/Makefile b/drivers/Makefile index fccea712db8..ae5f640af50 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -1,6 +1,6 @@ subdir-ccflags-y += -I$(srctree)/include/drivers -subdir-ccflags-y +=-I$(srctree)/arch/$(ARCH)/platforms/$(subst $(DQUOTE),,$(CONFIG_PLATFORM)) -subdir-asflags-y +=-I$(srctree)/arch/$(ARCH)/platforms/$(subst $(DQUOTE),,$(CONFIG_PLATFORM)) +subdir-ccflags-y +=-I$(srctree)/arch/$(ARCH)/platforms/$(PLATFORM_NAME) +subdir-asflags-y +=-I$(srctree)/arch/$(ARCH)/platforms/$(PLATFORM_NAME) obj-y = console/ obj-y += random/ diff --git a/drivers/aio/Makefile b/drivers/aio/Makefile index b9ba574477c..3f0ec5a98f4 100644 --- a/drivers/aio/Makefile +++ b/drivers/aio/Makefile @@ -1,5 +1 @@ -ccflags-y +=-I$(srctree)/arch/$(ARCH) -ccflags-y +=-I$(srctree)/arch/$(ARCH)/platforms/$(subst $(DQUOTE),,$(CONFIG_PLATFORM)) -asflags-y +=-I$(srctree)/arch/$(ARCH)/platforms/$(subst $(DQUOTE),,$(CONFIG_PLATFORM)) - obj-$(CONFIG_AIO_DW_COMPARATOR) += aio_dw_comparator.o aio_static_irq_stubs.o diff --git a/samples/microkernel/apps/nfc_hello/src/Makefile b/samples/microkernel/apps/nfc_hello/src/Makefile index 70f5d1cc0d7..1ed046534d7 100644 --- a/samples/microkernel/apps/nfc_hello/src/Makefile +++ b/samples/microkernel/apps/nfc_hello/src/Makefile @@ -1,3 +1,3 @@ -ccflags-y +=-I$(srctree)/arch/$(ARCH)/platforms/$(subst $(DQUOTE),,$(CONFIG_PLATFORM)) +ccflags-y +=-I$(srctree)/arch/$(ARCH)/platforms/$(PLATFORM_NAME) obj-y = main.o diff --git a/samples/nanokernel/test/test_atomic/src/Makefile b/samples/nanokernel/test/test_atomic/src/Makefile index b655e6d9b2d..c89cef5cea2 100644 --- a/samples/nanokernel/test/test_atomic/src/Makefile +++ b/samples/nanokernel/test/test_atomic/src/Makefile @@ -1,4 +1,4 @@ ccflags-y += ${PROJECTINCLUDE} -I${srctree}/samples/include -ccflags-y +=-I$(srctree)/arch/$(ARCH)/platforms/$(subst $(DQUOTE),,$(CONFIG_PLATFORM)) +ccflags-y +=-I$(srctree)/arch/$(ARCH)/platforms/$(PLATFORM_NAME) obj-y = atomic.o diff --git a/samples/nanokernel/test/test_context/src/Makefile b/samples/nanokernel/test/test_context/src/Makefile index 49d1939a787..50d1727981e 100644 --- a/samples/nanokernel/test/test_context/src/Makefile +++ b/samples/nanokernel/test/test_context/src/Makefile @@ -1,5 +1,5 @@ ccflags-y += ${PROJECTINCLUDE} -I${srctree}/samples/include -ccflags-y +=-I$(srctree)/arch/$(ARCH)/platforms/$(subst $(DQUOTE),,$(CONFIG_PLATFORM)) +ccflags-y +=-I$(srctree)/arch/$(ARCH)/platforms/$(PLATFORM_NAME) ccflags-$(CONFIG_PLATFORM_QUARK_D2000) += -DFIBER_STACKSIZE=256 obj-y = context.o