diff options
author | Damien Le Moal <damien.lemoal@wdc.com> | 2019-01-18 15:57:31 +0900 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2019-01-21 09:58:33 +0530 |
commit | 9c4aca4f1b7bfc52660589705846fc52ff7c015b (patch) | |
tree | e60686ea15da850062f9b09c6c6b8c785ec8b9e0 /Makefile | |
parent | 0df82694776d4497ca3bcfb662a68fd817698e89 (diff) |
Makefile: Improve readability
Repeating "ifdef CROSS_COMPILE" multiple times does not help with
readability. Simplify by grouping compilation command setup under a
single ifdef statement.
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 37 |
1 files changed, 13 insertions, 24 deletions
@@ -101,12 +101,24 @@ GENFLAGS += $(platform-common-genflags-y) GENFLAGS += $(platform-genflags-y) GENFLAGS += $(firmware-genflags-y) -# Setup compilation environment +# Setup compilation commands ifdef CROSS_COMPILE CC = $(CROSS_COMPILE)gcc +CPP = $(CROSS_COMPILE)cpp +AR = $(CROSS_COMPILE)ar +LD = $(CROSS_COMPILE)ld +OBJCOPY = $(CROSS_COMPILE)objcopy else CC ?= gcc +CPP ?= cpp +AR ?= ar +LD ?= ld +OBJCOPY ?= objcopy endif +AS = $(CC) +DTC = dtc + +# Setup compilation commands flags CFLAGS = -g -Wall -Werror -nostdlib -fno-strict-aliasing -O2 CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls CFLAGS += -mno-save-restore -mstrict-align @@ -114,16 +126,10 @@ CFLAGS += $(GENFLAGS) CFLAGS += $(platform-cflags-y) CFLAGS += $(firmware-cflags-y) -ifdef CROSS_COMPILE -CPP = $(CROSS_COMPILE)cpp -else -CPP ?= cpp -endif CPPFLAGS += $(GENFLAGS) CPPFLAGS += $(platform-cppflags-y) CPPFLAGS += $(firmware-cppflags-y) -AS = $(CC) ASFLAGS = -g -Wall -nostdlib -D__ASSEMBLY__ ASFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls ASFLAGS += -mno-save-restore -mstrict-align @@ -131,31 +137,14 @@ ASFLAGS += $(GENFLAGS) ASFLAGS += $(platform-asflags-y) ASFLAGS += $(firmware-asflags-y) -ifdef CROSS_COMPILE -AR = $(CROSS_COMPILE)ar -else -AR ?= ar -endif ARFLAGS = rcs -ifdef CROSS_COMPILE -LD = $(CROSS_COMPILE)ld -else -LD ?= ld -endif LDFLAGS += -g -Wall -nostdlib -Wl,--build-id=none -N LDFLAGS += $(platform-ldflags-y) LDFLAGS += $(firmware-ldflags-y) MERGEFLAGS += -r -ifdef CROSS_COMPILE -OBJCOPY = $(CROSS_COMPILE)objcopy -else -OBJCOPY ?= objcopy -endif - -DTC = dtc DTCFLAGS = -O dtb # Setup functions for compilation |