diff options
author | Andrew Morton <akpm@osdl.org> | 2006-12-22 04:12:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-22 11:55:51 -0500 |
commit | ef129412b4cbd6686d0749612cb9b76e207271f4 (patch) | |
tree | 54492763733c957405d938a74fb0ac99da927f9b | |
parent | 0888f06ac99f993df2bb4c479f5b9306dafe154f (diff) |
[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>
-rw-r--r-- | Makefile | 31 | ||||
-rw-r--r-- | init/Makefile | 9 |
2 files changed, 22 insertions, 18 deletions
@@ -368,10 +368,14 @@ endif | |||
368 | # Detect when mixed targets is specified, and make a second invocation | 368 | # Detect when mixed targets is specified, and make a second invocation |
369 | # of make so .config is not included in this case either (for *config). | 369 | # of make so .config is not included in this case either (for *config). |
370 | 370 | ||
371 | no-dot-config-targets := clean mrproper distclean \ | 371 | PHONY += generated_headers |
372 | |||
373 | generated_headers: include/linux/version.h include/linux/compile.h \ | ||
374 | include/linux/utsrelease.h | ||
375 | |||
376 | no-dot-config-targets := generated_headers clean mrproper distclean \ | ||
372 | cscope TAGS tags help %docs check% \ | 377 | cscope TAGS tags help %docs check% \ |
373 | include/linux/version.h headers_% \ | 378 | headers_% kernelrelease kernelversion |
374 | kernelrelease kernelversion | ||
375 | 379 | ||
376 | config-targets := 0 | 380 | config-targets := 0 |
377 | mixed-targets := 0 | 381 | mixed-targets := 0 |
@@ -734,6 +738,16 @@ debug_kallsyms: .tmp_map$(last_kallsyms) | |||
734 | 738 | ||
735 | endif # ifdef CONFIG_KALLSYMS | 739 | endif # ifdef CONFIG_KALLSYMS |
736 | 740 | ||
741 | # compile.h changes depending on hostname, generation number, etc, | ||
742 | # so we regenerate it always. | ||
743 | # mkcompile_h will make sure to only update the | ||
744 | # actual file if its content has changed. | ||
745 | |||
746 | include/linux/compile.h: FORCE | ||
747 | @echo ' CHK $@' | ||
748 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \ | ||
749 | "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" "$(CC) $(CFLAGS)" | ||
750 | |||
737 | # vmlinux image - including updated kernel symbols | 751 | # vmlinux image - including updated kernel symbols |
738 | vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE | 752 | vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE |
739 | ifdef CONFIG_HEADERS_CHECK | 753 | ifdef CONFIG_HEADERS_CHECK |
@@ -852,8 +866,8 @@ endif | |||
852 | # prepare2 creates a makefile if using a separate output directory | 866 | # prepare2 creates a makefile if using a separate output directory |
853 | prepare2: prepare3 outputmakefile | 867 | prepare2: prepare3 outputmakefile |
854 | 868 | ||
855 | prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \ | 869 | prepare1: prepare2 generated_headers include/asm include/config/auto.conf |
856 | include/asm include/config/auto.conf | 870 | |
857 | ifneq ($(KBUILD_MODULES),) | 871 | ifneq ($(KBUILD_MODULES),) |
858 | $(Q)mkdir -p $(MODVERDIR) | 872 | $(Q)mkdir -p $(MODVERDIR) |
859 | $(Q)rm -f $(MODVERDIR)/* | 873 | $(Q)rm -f $(MODVERDIR)/* |
@@ -922,14 +936,14 @@ export INSTALL_HDR_PATH | |||
922 | HDRARCHES=$(filter-out generic,$(patsubst $(srctree)/include/asm-%/Kbuild,%,$(wildcard $(srctree)/include/asm-*/Kbuild))) | 936 | HDRARCHES=$(filter-out generic,$(patsubst $(srctree)/include/asm-%/Kbuild,%,$(wildcard $(srctree)/include/asm-*/Kbuild))) |
923 | 937 | ||
924 | PHONY += headers_install_all | 938 | PHONY += headers_install_all |
925 | headers_install_all: include/linux/version.h scripts_basic FORCE | 939 | headers_install_all: generated_headers scripts_basic FORCE |
926 | $(Q)$(MAKE) $(build)=scripts scripts/unifdef | 940 | $(Q)$(MAKE) $(build)=scripts scripts/unifdef |
927 | $(Q)for arch in $(HDRARCHES); do \ | 941 | $(Q)for arch in $(HDRARCHES); do \ |
928 | $(MAKE) ARCH=$$arch -f $(srctree)/scripts/Makefile.headersinst obj=include BIASMDIR=-bi-$$arch ;\ | 942 | $(MAKE) ARCH=$$arch -f $(srctree)/scripts/Makefile.headersinst obj=include BIASMDIR=-bi-$$arch ;\ |
929 | done | 943 | done |
930 | 944 | ||
931 | PHONY += headers_install | 945 | PHONY += headers_install |
932 | headers_install: include/linux/version.h scripts_basic FORCE | 946 | headers_install: generated_headers scripts_basic FORCE |
933 | @if [ ! -r $(srctree)/include/asm-$(ARCH)/Kbuild ]; then \ | 947 | @if [ ! -r $(srctree)/include/asm-$(ARCH)/Kbuild ]; then \ |
934 | echo '*** Error: Headers not exportable for this architecture ($(ARCH))'; \ | 948 | echo '*** Error: Headers not exportable for this architecture ($(ARCH))'; \ |
935 | exit 1 ; fi | 949 | exit 1 ; fi |
@@ -1026,8 +1040,7 @@ CLEAN_FILES += vmlinux System.map \ | |||
1026 | # Directories & files removed with 'make mrproper' | 1040 | # Directories & files removed with 'make mrproper' |
1027 | MRPROPER_DIRS += include/config include2 usr/include | 1041 | MRPROPER_DIRS += include/config include2 usr/include |
1028 | MRPROPER_FILES += .config .config.old include/asm .version .old_version \ | 1042 | MRPROPER_FILES += .config .config.old include/asm .version .old_version \ |
1029 | include/linux/autoconf.h include/linux/version.h \ | 1043 | include/linux/autoconf.h generated-headers \ |
1030 | include/linux/utsrelease.h \ | ||
1031 | Module.symvers tags TAGS cscope* | 1044 | Module.symvers tags TAGS cscope* |
1032 | 1045 | ||
1033 | # clean - Delete most, but leave enough to build external modules | 1046 | # clean - Delete most, but leave enough to build external modules |
diff --git a/init/Makefile b/init/Makefile index d6c764d0eabb..9cd871ce5784 100644 --- a/init/Makefile +++ b/init/Makefile | |||
@@ -18,12 +18,3 @@ clean-files := ../include/linux/compile.h | |||
18 | $(obj)/main.o: include/linux/compile.h | 18 | $(obj)/main.o: include/linux/compile.h |
19 | $(obj)/version.o: include/linux/compile.h | 19 | $(obj)/version.o: include/linux/compile.h |
20 | 20 | ||
21 | # compile.h changes depending on hostname, generation number, etc, | ||
22 | # so we regenerate it always. | ||
23 | # mkcompile_h will make sure to only update the | ||
24 | # actual file if its content has changed. | ||
25 | |||
26 | include/linux/compile.h: FORCE | ||
27 | @echo ' CHK $@' | ||
28 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \ | ||
29 | "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" "$(CC) $(CFLAGS)" | ||