1 # This helper makefile is used for creating
2 # - symbolic links (arch/$ARCH/include/asm/arch
3 # - include/autoconf.mk, {spl,tpl}/include/autoconf.mk
6 # When our migration to Kconfig is done
7 # (= When we move all CONFIGs from header files to Kconfig)
8 # this makefile can be deleted.
10 # obj is "include" or "spl/include" or "tpl/include"
11 # for non-SPL, SPL, TPL, respectively
12 include $(obj)/config/auto.conf
14 include scripts/Kbuild.include
16 # Need to define CC and CPP again here in case the top Makefile did not
17 # include config.mk. Some architectures expect CROSS_COMPILE to be defined
18 # in arch/$(ARCH)/config.mk
19 CC = $(CROSS_COMPILE)gcc
27 $(if $(KBUILD_SRC), -I$(srctree)/include) \
28 -I$(srctree)/arch/$(ARCH)/include \
29 -include $(srctree)/include/linux/kconfig.h
31 c_flags := $(KBUILD_CFLAGS) $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) \
32 $(UBOOTINCLUDE) $(NOSTDINC_FLAGS)
34 quiet_cmd_autoconf_dep = GEN $@
35 cmd_autoconf_dep = $(CC) -x c -DDO_DEPS_ONLY -M -MP $(c_flags) \
36 -MQ include/config/auto.conf $(srctree)/include/common.h > $@ || { \
39 include/autoconf.mk.dep: FORCE
40 $(call cmd,autoconf_dep)
42 # We are migrating from board headers to Kconfig little by little.
43 # In the interim, we use both of
44 # - include/config/auto.conf (generated by Kconfig)
45 # - include/autoconf.mk (used in the U-Boot conventional configuration)
46 # The following rule creates autoconf.mk
47 # include/config/auto.conf is grepped in order to avoid duplication of the
49 quiet_cmd_autoconf = GEN $@
51 $(CPP) $(c_flags) -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && { \
52 sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp | \
54 if ! grep -q "$${line%=*}=" $(obj)/config/auto.conf; then \
63 $(obj)/autoconf.mk: FORCE
66 include/autoconf.mk include/autoconf.mk.dep: include/config.h
69 # Prior to Kconfig, it was generated by mkconfig. Now it is created here.
70 define filechk_config_h
71 (echo "/* Automatically generated - do not edit */"; \
72 for i in $$(echo $(CONFIG_SYS_EXTRA_OPTIONS) | sed 's/,/ /g'); do \
73 echo \#define CONFIG_$$i \
74 | sed '/=/ {s/=/ /;q; } ; { s/$$/ 1/; }'; \
76 echo \#define CONFIG_BOARDDIR board/$(if $(VENDOR),$(VENDOR)/)$(BOARD);\
77 echo \#include \<config_defaults.h\>; \
78 echo \#include \<configs/$(CONFIG_SYS_CONFIG_NAME).h\>; \
79 echo \#include \<asm/config.h\>; \
80 echo \#include \<config_fallbacks.h\>; \
81 echo \#include \<config_uncmd_spl.h\>; )
84 include/config.h: scripts/Makefile.autoconf create_symlink FORCE
85 $(call filechk,config_h)
88 PHONY += create_symlink
90 ifneq ($(KBUILD_SRC),)
91 $(Q)mkdir -p include/asm
93 $(Q)ln -fsn $(srctree)/arch/$(ARCH)/include/asm/arch-$(if $(SOC),$(SOC),$(CPU)) \
94 $(if $(KBUILD_SRC),,arch/$(ARCH)/)include/asm/arch