aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile18
1 files changed, 16 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 169fcbc..c4cd926 100644
--- a/Makefile
+++ b/Makefile
@@ -13,8 +13,22 @@ FILE_VERSION = 6
13 13
14MAKEFLAGS += --no-print-directory 14MAKEFLAGS += --no-print-directory
15 15
16CC ?= $(CROSS_COMPILE)gcc 16
17AR ?= $(CROSS_COMPILE)ar 17# Makefiles suck: This macro sets a default value of $(2) for the
18# variable named by $(1), unless the variable has been set by
19# environment or command line. This is necessary for CC and AR
20# because make sets default values, so the simpler ?= approach
21# won't work as expected.
22define allow-override
23 $(if $(or $(findstring environment,$(origin $(1))),\
24 $(findstring command line,$(origin $(1)))),,\
25 $(eval $(1) = $(2)))
26endef
27
28# Allow setting CC and AR, or setting CROSS_COMPILE as a prefix.
29$(call allow-override,CC,$(CROSS_COMPILE)gcc)
30$(call allow-override,AR,$(CROSS_COMPILE)ar)
31
18EXT = -std=gnu99 32EXT = -std=gnu99
19INSTALL = install 33INSTALL = install
20 34