From 59de50963cc49f6aa003bd10f5a20f766186c02a Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 22 Dec 2016 12:51:53 +0900 Subject: [PATCH] Build: use CPP just for pre-processing Using AS for pre-processing looks a bit weird, and some assembly specific options are given for nothing. Rather, use CPP. Signed-off-by: Masahiro Yamada --- Makefile | 18 ++++++++---------- make_helpers/build_macros.mk | 4 ++-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index bb46afcb4..adfdba6c2 100644 --- a/Makefile +++ b/Makefile @@ -143,16 +143,14 @@ TF_CFLAGS_aarch64 = -mgeneral-regs-only -mstrict-align ASFLAGS_aarch32 = -march=armv8-a TF_CFLAGS_aarch32 = -march=armv8-a -ASFLAGS += -nostdinc -ffreestanding -Wa,--fatal-warnings \ - -Werror -Wmissing-include-dirs \ - -D__ASSEMBLY__ $(ASFLAGS_$(ARCH)) \ - ${DEFINES} ${INCLUDES} -TF_CFLAGS += -nostdinc -ffreestanding -Wall \ - -Werror -Wmissing-include-dirs \ - -std=c99 -Os \ - $(TF_CFLAGS_$(ARCH)) \ - ${DEFINES} ${INCLUDES} -TF_CFLAGS += -ffunction-sections -fdata-sections +CPPFLAGS = ${DEFINES} ${INCLUDES} -nostdinc \ + -Wmissing-include-dirs -Werror +ASFLAGS += $(CPPFLAGS) $(ASFLAGS_$(ARCH)) \ + -D__ASSEMBLY__ -ffreestanding \ + -Wa,--fatal-warnings +TF_CFLAGS += $(CPPFLAGS) $(TF_CFLAGS_$(ARCH)) \ + -ffreestanding -Wall -std=c99 -Os \ + -ffunction-sections -fdata-sections LDFLAGS += --fatal-warnings -O1 LDFLAGS += --gc-sections diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk index 4ec060b64..dd8c2b508 100644 --- a/make_helpers/build_macros.mk +++ b/make_helpers/build_macros.mk @@ -262,11 +262,11 @@ $(eval PREREQUISITES := $(1).d) $(1): $(2) @echo " PP $$<" - $$(Q)$$(AS) $$(ASFLAGS) -P -E -D__LINKER__ -o $$@ $$< + $$(Q)$$(CPP) $$(CPPFLAGS) -P -D__ASSEMBLY__ -D__LINKER__ -o $$@ $$< $(PREREQUISITES): $(2) | $(dir ${1}) @echo " DEPS $$@" - $$(Q)$$(AS) $$(ASFLAGS) -M -MT $(1) -MF $$@ $$< + $$(Q)$$(CPP) $$(CPPFLAGS) -D__ASSEMBLY__ -M -MT $(1) -MF $$@ $$< ifdef IS_ANYTHING_TO_BUILD -include $(PREREQUISITES)