diff options
Diffstat (limited to 'tools/scripts/Makefile.include')
| -rw-r--r-- | tools/scripts/Makefile.include | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include index fcb3ed0be5f8..dd614463d4d6 100644 --- a/tools/scripts/Makefile.include +++ b/tools/scripts/Makefile.include | |||
| @@ -42,6 +42,24 @@ EXTRA_WARNINGS += -Wformat | |||
| 42 | 42 | ||
| 43 | CC_NO_CLANG := $(shell $(CC) -dM -E -x c /dev/null | grep -Fq "__clang__"; echo $$?) | 43 | CC_NO_CLANG := $(shell $(CC) -dM -E -x c /dev/null | grep -Fq "__clang__"; echo $$?) |
| 44 | 44 | ||
| 45 | # Makefiles suck: This macro sets a default value of $(2) for the | ||
| 46 | # variable named by $(1), unless the variable has been set by | ||
| 47 | # environment or command line. This is necessary for CC and AR | ||
| 48 | # because make sets default values, so the simpler ?= approach | ||
| 49 | # won't work as expected. | ||
| 50 | define allow-override | ||
| 51 | $(if $(or $(findstring environment,$(origin $(1))),\ | ||
| 52 | $(findstring command line,$(origin $(1)))),,\ | ||
| 53 | $(eval $(1) = $(2))) | ||
| 54 | endef | ||
| 55 | |||
| 56 | # Allow setting various cross-compile vars or setting CROSS_COMPILE as a prefix. | ||
| 57 | $(call allow-override,CC,$(CROSS_COMPILE)gcc) | ||
| 58 | $(call allow-override,AR,$(CROSS_COMPILE)ar) | ||
| 59 | $(call allow-override,LD,$(CROSS_COMPILE)ld) | ||
| 60 | $(call allow-override,CXX,$(CROSS_COMPILE)g++) | ||
| 61 | $(call allow-override,STRIP,$(CROSS_COMPILE)strip) | ||
| 62 | |||
| 45 | ifeq ($(CC_NO_CLANG), 1) | 63 | ifeq ($(CC_NO_CLANG), 1) |
| 46 | EXTRA_WARNINGS += -Wstrict-aliasing=3 | 64 | EXTRA_WARNINGS += -Wstrict-aliasing=3 |
| 47 | endif | 65 | endif |
