Makefile: refactor include path settings
This commit merges commonly-used header include paths to UBOOTINCLUDE and NOSTDINC_FLAGS variables, which are placed at the top Makefile. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
This commit is contained in:
parent
2b3c9d3ddd
commit
fea1ca8e34
14
Makefile
14
Makefile
|
@ -226,6 +226,15 @@ CHECK = sparse
|
||||||
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
|
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
|
||||||
-Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
|
-Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
|
||||||
|
|
||||||
|
# Use UBOOTINCLUDE when you must reference the include/ directory.
|
||||||
|
# Needed to be compatible with the O= option
|
||||||
|
UBOOTINCLUDE :=
|
||||||
|
ifneq ($(OBJTREE),$(SRCTREE))
|
||||||
|
UBOOTINCLUDE += -I$(OBJTREE)/include
|
||||||
|
endif
|
||||||
|
UBOOTINCLUDE += -I$(srctree)/include \
|
||||||
|
-I$(srctree)/arch/$(ARCH)/include
|
||||||
|
|
||||||
KBUILD_CPPFLAGS := -D__KERNEL__
|
KBUILD_CPPFLAGS := -D__KERNEL__
|
||||||
|
|
||||||
KBUILD_CFLAGS := -Wall -Wstrict-prototypes \
|
KBUILD_CFLAGS := -Wall -Wstrict-prototypes \
|
||||||
|
@ -238,7 +247,7 @@ export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
|
||||||
export MAKE AWK
|
export MAKE AWK
|
||||||
export DTC CHECK CHECKFLAGS
|
export DTC CHECK CHECKFLAGS
|
||||||
|
|
||||||
export KBUILD_CPPFLAGS
|
export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE
|
||||||
export KBUILD_CFLAGS KBUILD_AFLAGS
|
export KBUILD_CFLAGS KBUILD_AFLAGS
|
||||||
|
|
||||||
KBUILD_CFLAGS += -Os #-fomit-frame-pointer
|
KBUILD_CFLAGS += -Os #-fomit-frame-pointer
|
||||||
|
@ -254,6 +263,9 @@ KBUILD_CFLAGS += -g
|
||||||
# option to the assembler.
|
# option to the assembler.
|
||||||
KBUILD_AFLAGS += -g
|
KBUILD_AFLAGS += -g
|
||||||
|
|
||||||
|
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
|
||||||
|
CHECKFLAGS += $(NOSTDINC_FLAGS)
|
||||||
|
|
||||||
# Report stack usage if supported
|
# Report stack usage if supported
|
||||||
KBUILD_CFLAGS += $(call cc-option,-fstack-usage)
|
KBUILD_CFLAGS += $(call cc-option,-fstack-usage)
|
||||||
|
|
||||||
|
|
11
config.mk
11
config.mk
|
@ -94,8 +94,6 @@ RELFLAGS= $(PLATFORM_RELFLAGS)
|
||||||
|
|
||||||
OBJCFLAGS += --gap-fill=0xff
|
OBJCFLAGS += --gap-fill=0xff
|
||||||
|
|
||||||
gccincdir := $(shell $(CC) -print-file-name=include)
|
|
||||||
|
|
||||||
CPPFLAGS = $(KBUILD_CPPFLAGS) $(RELFLAGS)
|
CPPFLAGS = $(KBUILD_CPPFLAGS) $(RELFLAGS)
|
||||||
|
|
||||||
# Enable garbage collection of un-used sections for SPL
|
# Enable garbage collection of un-used sections for SPL
|
||||||
|
@ -123,13 +121,8 @@ Please undefined CONFIG_SYS_GENERIC_BOARD in your board config file)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(OBJTREE),$(SRCTREE))
|
CPPFLAGS += $(UBOOTINCLUDE)
|
||||||
CPPFLAGS += -I$(OBJTREE)/include
|
CPPFLAGS += $(NOSTDINC_FLAGS) -pipe $(PLATFORM_CPPFLAGS)
|
||||||
endif
|
|
||||||
|
|
||||||
CPPFLAGS += -I$(TOPDIR)/include -I$(SRCTREE)/arch/$(ARCH)/include
|
|
||||||
CPPFLAGS += -nostdinc \
|
|
||||||
-isystem $(gccincdir) -pipe $(PLATFORM_CPPFLAGS)
|
|
||||||
|
|
||||||
CFLAGS := $(KBUILD_CFLAGS) $(CPPFLAGS)
|
CFLAGS := $(KBUILD_CFLAGS) $(CPPFLAGS)
|
||||||
|
|
||||||
|
|
|
@ -175,11 +175,9 @@ HOSTSRCS += $(addprefix $(SRCTREE)/lib/libfdt/,$(LIBFDT_OBJ_FILES-y:.o=.c))
|
||||||
# Define _GNU_SOURCE to obtain the getline prototype from stdio.h
|
# Define _GNU_SOURCE to obtain the getline prototype from stdio.h
|
||||||
#
|
#
|
||||||
HOST_EXTRACFLAGS += -include $(SRCTREE)/include/libfdt_env.h \
|
HOST_EXTRACFLAGS += -include $(SRCTREE)/include/libfdt_env.h \
|
||||||
-idirafter $(SRCTREE)/include \
|
$(patsubst -I%,-idirafter%, $(UBOOTINCLUDE)) \
|
||||||
-idirafter $(SRCTREE)/arch/$(ARCH)/include \
|
-I$(SRCTREE)/lib/libfdt \
|
||||||
-idirafter $(OBJTREE)/include \
|
-I$(SRCTREE)/tools \
|
||||||
-I $(SRCTREE)/lib/libfdt \
|
|
||||||
-I $(SRCTREE)/tools \
|
|
||||||
-DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) \
|
-DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) \
|
||||||
-DUSE_HOSTCC \
|
-DUSE_HOSTCC \
|
||||||
-D__KERNEL_STRICT_NAMES \
|
-D__KERNEL_STRICT_NAMES \
|
||||||
|
|
|
@ -6,9 +6,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
# Compile for a hosted environment on the target
|
# Compile for a hosted environment on the target
|
||||||
HOST_EXTRACFLAGS = -idirafter $(SRCTREE)/include \
|
HOST_EXTRACFLAGS = $(patsubst -I%,-idirafter%, $(UBOOTINCLUDE)) \
|
||||||
-idirafter $(SRCTREE)/arch/$(ARCH)/include \
|
|
||||||
-idirafter $(OBJTREE)/include \
|
|
||||||
-idirafter $(SRCTREE)/tools/env \
|
-idirafter $(SRCTREE)/tools/env \
|
||||||
-DUSE_HOSTCC \
|
-DUSE_HOSTCC \
|
||||||
-DTEXT_BASE=$(TEXT_BASE)
|
-DTEXT_BASE=$(TEXT_BASE)
|
||||||
|
|
Loading…
Reference in New Issue