[PATCH] build compile.h earlier

compile.h is created super-late in the build.  But proc_misc.c want to include
it, and it's generally not sane to have a header file in include/linux be
created at the end of the build: it's either not present or, worse, wrong for
most of the build.

So the patch arranges for compile.h to be built at the start of the build
process.  It also consolidates the compile.h rules with those for version.h
and utsname.h, so they all get built together.

I hope.  My chances of having got this right are about 2%.

Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Andrew Morton 2006-12-22 01:12:01 -08:00 committed by Linus Torvalds
parent 0888f06ac9
commit ef129412b4
2 changed files with 22 additions and 18 deletions

View file

@ -368,10 +368,14 @@ endif
# Detect when mixed targets is specified, and make a second invocation # Detect when mixed targets is specified, and make a second invocation
# of make so .config is not included in this case either (for *config). # of make so .config is not included in this case either (for *config).
no-dot-config-targets := clean mrproper distclean \ PHONY += generated_headers
generated_headers: include/linux/version.h include/linux/compile.h \
include/linux/utsrelease.h
no-dot-config-targets := generated_headers clean mrproper distclean \
cscope TAGS tags help %docs check% \ cscope TAGS tags help %docs check% \
include/linux/version.h headers_% \ headers_% kernelrelease kernelversion
kernelrelease kernelversion
config-targets := 0 config-targets := 0
mixed-targets := 0 mixed-targets := 0
@ -734,6 +738,16 @@ debug_kallsyms: .tmp_map$(last_kallsyms)
endif # ifdef CONFIG_KALLSYMS endif # ifdef CONFIG_KALLSYMS
# compile.h changes depending on hostname, generation number, etc,
# so we regenerate it always.
# mkcompile_h will make sure to only update the
# actual file if its content has changed.
include/linux/compile.h: FORCE
@echo ' CHK $@'
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \
"$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" "$(CC) $(CFLAGS)"
# vmlinux image - including updated kernel symbols # vmlinux image - including updated kernel symbols
vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
ifdef CONFIG_HEADERS_CHECK ifdef CONFIG_HEADERS_CHECK
@ -852,8 +866,8 @@ endif
# prepare2 creates a makefile if using a separate output directory # prepare2 creates a makefile if using a separate output directory
prepare2: prepare3 outputmakefile prepare2: prepare3 outputmakefile
prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \ prepare1: prepare2 generated_headers include/asm include/config/auto.conf
include/asm include/config/auto.conf
ifneq ($(KBUILD_MODULES),) ifneq ($(KBUILD_MODULES),)
$(Q)mkdir -p $(MODVERDIR) $(Q)mkdir -p $(MODVERDIR)
$(Q)rm -f $(MODVERDIR)/* $(Q)rm -f $(MODVERDIR)/*
@ -922,14 +936,14 @@ export INSTALL_HDR_PATH
HDRARCHES=$(filter-out generic,$(patsubst $(srctree)/include/asm-%/Kbuild,%,$(wildcard $(srctree)/include/asm-*/Kbuild))) HDRARCHES=$(filter-out generic,$(patsubst $(srctree)/include/asm-%/Kbuild,%,$(wildcard $(srctree)/include/asm-*/Kbuild)))
PHONY += headers_install_all PHONY += headers_install_all
headers_install_all: include/linux/version.h scripts_basic FORCE headers_install_all: generated_headers scripts_basic FORCE
$(Q)$(MAKE) $(build)=scripts scripts/unifdef $(Q)$(MAKE) $(build)=scripts scripts/unifdef
$(Q)for arch in $(HDRARCHES); do \ $(Q)for arch in $(HDRARCHES); do \
$(MAKE) ARCH=$$arch -f $(srctree)/scripts/Makefile.headersinst obj=include BIASMDIR=-bi-$$arch ;\ $(MAKE) ARCH=$$arch -f $(srctree)/scripts/Makefile.headersinst obj=include BIASMDIR=-bi-$$arch ;\
done done
PHONY += headers_install PHONY += headers_install
headers_install: include/linux/version.h scripts_basic FORCE headers_install: generated_headers scripts_basic FORCE
@if [ ! -r $(srctree)/include/asm-$(ARCH)/Kbuild ]; then \ @if [ ! -r $(srctree)/include/asm-$(ARCH)/Kbuild ]; then \
echo '*** Error: Headers not exportable for this architecture ($(ARCH))'; \ echo '*** Error: Headers not exportable for this architecture ($(ARCH))'; \
exit 1 ; fi exit 1 ; fi
@ -1026,8 +1040,7 @@ CLEAN_FILES += vmlinux System.map \
# Directories & files removed with 'make mrproper' # Directories & files removed with 'make mrproper'
MRPROPER_DIRS += include/config include2 usr/include MRPROPER_DIRS += include/config include2 usr/include
MRPROPER_FILES += .config .config.old include/asm .version .old_version \ MRPROPER_FILES += .config .config.old include/asm .version .old_version \
include/linux/autoconf.h include/linux/version.h \ include/linux/autoconf.h generated-headers \
include/linux/utsrelease.h \
Module.symvers tags TAGS cscope* Module.symvers tags TAGS cscope*
# clean - Delete most, but leave enough to build external modules # clean - Delete most, but leave enough to build external modules

View file

@ -18,12 +18,3 @@ clean-files := ../include/linux/compile.h
$(obj)/main.o: include/linux/compile.h $(obj)/main.o: include/linux/compile.h
$(obj)/version.o: include/linux/compile.h $(obj)/version.o: include/linux/compile.h
# compile.h changes depending on hostname, generation number, etc,
# so we regenerate it always.
# mkcompile_h will make sure to only update the
# actual file if its content has changed.
include/linux/compile.h: FORCE
@echo ' CHK $@'
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \
"$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" "$(CC) $(CFLAGS)"