X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=config.mk;h=bf71837c411f4190592c7a4b0ad36148ce27d50d;hb=712932648c772c13bd401bd75d538a42b7860598;hp=3dcea6a8f99a8b3bc4e22f6c981a7e43839cf6f8;hpb=d978780b2e676c005460cd561f4f15b5220bdf49;p=karo-tx-uboot.git diff --git a/config.mk b/config.mk index 3dcea6a8f9..bf71837c41 100644 --- a/config.mk +++ b/config.mk @@ -23,6 +23,8 @@ ######################################################################### +include $(TOPDIR)/helper.mk + ifeq ($(CURDIR),$(SRCTREE)) dir := else @@ -128,12 +130,17 @@ endif # cc-version # Usage gcc-ver := $(call cc-version) cc-version = $(shell $(SHELL) $(SRCTREE)/tools/gcc-version.sh $(CC)) +binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS)) # # Include the make variables (CC, etc...) # AS = $(CROSS_COMPILE)as -LD = $(CROSS_COMPILE)ld + +# Always use GNU ld +LD = $(shell if $(CROSS_COMPILE)ld.bfd -v > /dev/null 2>&1; \ + then echo "$(CROSS_COMPILE)ld.bfd"; else echo "$(CROSS_COMPILE)ld"; fi;) + CC = $(CROSS_COMPILE)gcc CPP = $(CC) -E AR = $(CROSS_COMPILE)ar @@ -144,6 +151,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy OBJDUMP = $(CROSS_COMPILE)objdump RANLIB = $(CROSS_COMPILE)RANLIB DTC = dtc +CHECK = sparse ######################################################################### @@ -225,20 +233,17 @@ CPPFLAGS += -I$(TOPDIR)/include CPPFLAGS += -fno-builtin -ffreestanding -nostdinc \ -isystem $(gccincdir) -pipe $(PLATFORM_CPPFLAGS) -ifdef BUILD_TAG -CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes \ - -DBUILD_TAG='"$(BUILD_TAG)"' -else -CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -endif - CFLAGS_SSP := $(call cc-option,-fno-stack-protector) -CFLAGS += $(CFLAGS_SSP) + # Some toolchains enable security related warning flags by default, # but they don't make much sense in the u-boot world, so disable them. CFLAGS_WARN := $(call cc-option,-Wno-format-nonliteral) \ $(call cc-option,-Wno-format-security) -CFLAGS += $(CFLAGS_WARN) + +CFLAGS := $(CFLAGS_SSP) $(CFLAGS_WARN) $(CPPFLAGS) -Wall -Wstrict-prototypes +ifdef BUILD_TAG + CFLAGS += -DBUILD_TAG='"$(BUILD_TAG)"' +endif # Report stack usage if supported CFLAGS_STACK := $(call cc-option,-fstack-usage) @@ -270,6 +275,10 @@ ifneq ($(CONFIG_SPL_TEXT_BASE),) LDFLAGS_u-boot-spl += -Ttext $(CONFIG_SPL_TEXT_BASE) endif +# Linus' kernel sanity checking tool +CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ + -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF) + # Location of a usable BFD library, where we define "usable" as # "built for ${HOST}, supports ${TARGET}". Sensible values are # - When cross-compiling: the root of the cross-environment @@ -317,6 +326,9 @@ $(obj)%.s: %.S $(obj)%.o: %.S $(CC) $(ALL_AFLAGS) -o $@ $< -c $(obj)%.o: %.c +ifneq ($(CHECKSRC),0) + $(CHECK) $(CHECKFLAGS) $(ALL_CFLAGS) $< +endif $(CC) $(ALL_CFLAGS) -o $@ $< -c $(obj)%.i: %.c $(CPP) $(ALL_CFLAGS) -o $@ $< -c