diff options
author | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
---|---|---|
committer | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/skiboot/Makefile.rules | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/skiboot/Makefile.rules')
-rw-r--r-- | roms/skiboot/Makefile.rules | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/roms/skiboot/Makefile.rules b/roms/skiboot/Makefile.rules new file mode 100644 index 000000000..dcebde6d2 --- /dev/null +++ b/roms/skiboot/Makefile.rules @@ -0,0 +1,84 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later +# +# These allow for the build to be less verbose +# +# Copyright 2012-2019 IBM Corp + +ifdef V + VERBOSE:= $(V) +else + VERBOSE:= 0 +endif + +ifeq ($(VERBOSE),1) +define Q + $(2) +endef +else +ifneq ($(filter s% -s%,$(MAKEFLAGS)),) +define Q + @$(2) +endef +else +define Q + @echo " [$1] $(3)" + @$(2) +endef +endif +endif + +define QTEST + $(call Q,$1, ./test/run.sh $2, $3) +endef + +define cook_aflags + $(filter-out $(AFLAGS_SKIP_$(1)) $(AFLAGS_SKIP_$(dir $(1))), $(CPPFLAGS) $(AFLAGS)) $(AFLAGS_$(1)) $(AFLAGS_$(dir $(1))) +endef + +define cook_cflags + $(filter-out $(CFLAGS_SKIP_$(1)) $(CFLAGS_SKIP_$(dir $(1))), $(CPPFLAGS) $(CFLAGS)) $(CFLAGS_$(1)) $(CFLAGS_$(dir $(1))) +endef + +ifeq ($(C),1) + ifeq ($(VERBOSE),1) + cmd_check = $(CHECK) $(CHECKFLAGS) $(filter-out $(CHECK_CFLAGS_SKIP),$(call cook_cflags,$@)) $< + else + cmd_check = @$(CHECK) $(CHECKFLAGS) $(filter-out $(CHECK_CFLAGS_SKIP),$(call cook_cflags,$@)) $< + endif +endif + + +%.o : %.S include/asm-offsets.h + $(call Q,AS, $(CC) $(call cook_aflags,$@) -c $< -o $@, $@) + +%.s : %.S include/asm-offsets.h + $(call Q,CC, $(CC) $(call cook_aflags,$@) -E -c $< -o $@, $@) + +%.o : %.c + $(call cmd_check) + $(call Q,CC, $(CC) $(call cook_cflags,$@) -c $< -o $@, $@) + +# Force the use of the C compiler, not C++ for the .C files in libpore +%.o : %.C + $(call cmd_check) + $(call Q,CC, $(CC) $(call cook_cflags,$@) -x c -c $< -o $@, $@) + +%.s : %.c + $(call Q,CC, $(CC) $(call cook_cflags,$@) -fverbose-asm -S -c $< -o $@, $@) + +# no -fverbose-asm for asm-offsets.s +asm/asm-offsets.s: asm/asm-offsets.c + $(call Q,CC, $(CC) $(call cook_cflags,$@) -S -c $< -o $@, $@) + +%.i : %.c + $(call Q,CC, $(CC) $(call cook_cflags,$@) -E -c $< -o $@, $@) + +%built-in.a : + @rm -f $@ + $(call Q,AR, $(AR) rcSTPD $@ $^, $@) + +%.lds : %.lds.S + $(call Q,CC, $(CC) $(CPPFLAGS) -P -E $< -o $@, $@) + +%.map: %.elf + $(call Q,NM, $(NM) --synthetic -n $< | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)' > $@, $@) |