[PATCH 14/16] common: Move the build-system includes to a separate file

Simon Glass sjg at chromium.org
Mon Aug 3 00:59:38 CEST 2020


At present common.h is used by the build system when calculating
dependencies. Move it out into a separate file so we can drop the
env_internal.h inclusion from common.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 arch/nds32/lib/asm-offsets.c |  1 +
 include/common.h             |  5 -----
 include/deps_internal.h      | 18 ++++++++++++++++++
 scripts/Makefile.autoconf    |  8 +++++---
 4 files changed, 24 insertions(+), 8 deletions(-)
 create mode 100644 include/deps_internal.h

diff --git a/arch/nds32/lib/asm-offsets.c b/arch/nds32/lib/asm-offsets.c
index 39e3480bd52..7412b788d79 100644
--- a/arch/nds32/lib/asm-offsets.c
+++ b/arch/nds32/lib/asm-offsets.c
@@ -10,6 +10,7 @@
  * published by the Free Software Foundation.
  */
 #include <common.h>
+#include <compiler.h>
 
 #include <linux/kbuild.h>
 
diff --git a/include/common.h b/include/common.h
index 2e95d0ebdf5..1a9a2ce0ea8 100644
--- a/include/common.h
+++ b/include/common.h
@@ -16,9 +16,4 @@
 #include <config.h>
 #endif	/* __ASSEMBLY__ */
 
-/* Pull in stuff for the build system */
-#ifdef DO_DEPS_ONLY
-# include <env_internal.h>
-#endif
-
 #endif	/* __COMMON_H_ */
diff --git a/include/deps_internal.h b/include/deps_internal.h
new file mode 100644
index 00000000000..9c3b31cc577
--- /dev/null
+++ b/include/deps_internal.h
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Internal header file used by the build system to calculate dependences
+ *
+ * (C) Copyright 2000-2009
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ */
+
+#ifndef __DEPS_INTERNAL
+#define __DEPS_INTERNAL
+
+#ifndef __ASSEMBLY__
+#include <config.h>
+#endif
+
+#include <env_internal.h>
+
+#endif	/* __DEPS_INTERNAL */
diff --git a/scripts/Makefile.autoconf b/scripts/Makefile.autoconf
index 0bfc1b2a629..89882e3c71a 100644
--- a/scripts/Makefile.autoconf
+++ b/scripts/Makefile.autoconf
@@ -41,8 +41,9 @@ c_flags := $(KBUILD_CFLAGS) $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) \
 
 quiet_cmd_autoconf_dep = GEN     $@
       cmd_autoconf_dep = $(CC) -x c -DDO_DEPS_ONLY -M -MP $(c_flags) \
-	-MQ include/config/auto.conf $(srctree)/include/common.h > $@ || {	\
-		rm $@; false;							\
+	-MQ include/config/auto.conf $(srctree)/include/deps_internal.h > $@ \
+	|| {								\
+		rm $@; false;						\
 	}
 include/autoconf.mk.dep: include/config.h FORCE
 	$(call cmd,autoconf_dep)
@@ -66,7 +67,8 @@ quiet_cmd_autoconf = GEN     $@
 
 quiet_cmd_u_boot_cfg = CFG     $@
       cmd_u_boot_cfg = \
-	$(CPP) $(c_flags) $2 -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && { \
+	$(CPP) $(c_flags) $2 -DDO_DEPS_ONLY -dM				\
+	$(srctree)/include/deps_internal.h > $@.tmp && {		\
 		grep 'define CONFIG_' $@.tmp > $@;			\
 		rm $@.tmp;						\
 	} || {								\
-- 
2.28.0.163.g6104cc2f0b6-goog



More information about the U-Boot mailing list