summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.m@jp.panasonic.com>2014-02-04 17:24:19 +0900
committerTom Rini <trini@ti.com>2014-02-19 11:07:50 -0500
commit2b3c9d3ddd4e0b5a55d17e164e817b42cb555639 (patch)
tree1e1c4ab380b87fdc02438a58c10ad501b97819fa /Makefile
parentbf4b3de1013c1643ffb8f071292c0f0eabb265c3 (diff)
downloadu-boot-imx-2b3c9d3ddd4e0b5a55d17e164e817b42cb555639.zip
u-boot-imx-2b3c9d3ddd4e0b5a55d17e164e817b42cb555639.tar.gz
u-boot-imx-2b3c9d3ddd4e0b5a55d17e164e817b42cb555639.tar.bz2
Makefile: move more flags to the top Makefile
Before this commit, most of compiler flags were defined in config.mk. But it is redundant because config.mk is included from all recursive make. This commit moves many complier flags to the top Makefile and export them. And we use new vaiarables to store them: KBUILD_CPPFLAGS, KBUILD_CFLAGS, KBUILD_AFLAGS. This will allow us to switch more smoothly to Kbuild. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile35
1 files changed, 35 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index e4045bc..3a97483 100644
--- a/Makefile
+++ b/Makefile
@@ -226,11 +226,46 @@ CHECK = sparse
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
-Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
+KBUILD_CPPFLAGS := -D__KERNEL__
+
+KBUILD_CFLAGS := -Wall -Wstrict-prototypes \
+ -Wno-format-security \
+ -fno-builtin -ffreestanding
+KBUILD_AFLAGS := -D__ASSEMBLY__
+
export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
export MAKE AWK
export DTC CHECK CHECKFLAGS
+export KBUILD_CPPFLAGS
+export KBUILD_CFLAGS KBUILD_AFLAGS
+
+KBUILD_CFLAGS += -Os #-fomit-frame-pointer
+
+ifdef BUILD_TAG
+KBUILD_CFLAGS += -DBUILD_TAG='"$(BUILD_TAG)"'
+endif
+
+KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
+
+KBUILD_CFLAGS += -g
+# $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -g<format>
+# option to the assembler.
+KBUILD_AFLAGS += -g
+
+# Report stack usage if supported
+KBUILD_CFLAGS += $(call cc-option,-fstack-usage)
+
+KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral)
+
+# turn jbsr into jsr for m68k
+ifeq ($(ARCH),m68k)
+ifeq ($(findstring 3.4,$(shell $(CC) --version)),3.4)
+KBUILD_AFLAGS += -Wa,-gstabs,-S
+endif
+endif
+
# load other configuration
include $(TOPDIR)/config.mk