diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 96 |
1 files changed, 26 insertions, 70 deletions
@@ -334,10 +334,9 @@ CFLAGS_GCOV = -fprofile-arcs -ftest-coverage | |||
334 | 334 | ||
335 | # Use LINUXINCLUDE when you must reference the include/ directory. | 335 | # Use LINUXINCLUDE when you must reference the include/ directory. |
336 | # Needed to be compatible with the O= option | 336 | # Needed to be compatible with the O= option |
337 | LINUXINCLUDE := -Iinclude \ | 337 | LINUXINCLUDE := -I$(srctree)/arch/$(hdr-arch)/include -Iinclude \ |
338 | $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \ | 338 | $(if $(KBUILD_SRC), -I$(srctree)/include) \ |
339 | -I$(srctree)/arch/$(hdr-arch)/include \ | 339 | -include include/generated/autoconf.h |
340 | -include include/linux/autoconf.h | ||
341 | 340 | ||
342 | KBUILD_CPPFLAGS := -D__KERNEL__ | 341 | KBUILD_CPPFLAGS := -D__KERNEL__ |
343 | 342 | ||
@@ -465,7 +464,7 @@ ifeq ($(KBUILD_EXTMOD),) | |||
465 | # Carefully list dependencies so we do not try to build scripts twice | 464 | # Carefully list dependencies so we do not try to build scripts twice |
466 | # in parallel | 465 | # in parallel |
467 | PHONY += scripts | 466 | PHONY += scripts |
468 | scripts: scripts_basic include/config/auto.conf | 467 | scripts: scripts_basic include/config/auto.conf include/config/tristate.conf |
469 | $(Q)$(MAKE) $(build)=$(@) | 468 | $(Q)$(MAKE) $(build)=$(@) |
470 | 469 | ||
471 | # Objects we will link into vmlinux / subdirs we need to visit | 470 | # Objects we will link into vmlinux / subdirs we need to visit |
@@ -492,18 +491,18 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; | |||
492 | # with it and forgot to run make oldconfig. | 491 | # with it and forgot to run make oldconfig. |
493 | # if auto.conf.cmd is missing then we are probably in a cleaned tree so | 492 | # if auto.conf.cmd is missing then we are probably in a cleaned tree so |
494 | # we execute the config step to be sure to catch updated Kconfig files | 493 | # we execute the config step to be sure to catch updated Kconfig files |
495 | include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd | 494 | include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd |
496 | $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig | 495 | $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig |
497 | else | 496 | else |
498 | # external modules needs include/linux/autoconf.h and include/config/auto.conf | 497 | # external modules needs include/generated/autoconf.h and include/config/auto.conf |
499 | # but do not care if they are up-to-date. Use auto.conf to trigger the test | 498 | # but do not care if they are up-to-date. Use auto.conf to trigger the test |
500 | PHONY += include/config/auto.conf | 499 | PHONY += include/config/auto.conf |
501 | 500 | ||
502 | include/config/auto.conf: | 501 | include/config/auto.conf: |
503 | $(Q)test -e include/linux/autoconf.h -a -e $@ || ( \ | 502 | $(Q)test -e include/generated/autoconf.h -a -e $@ || ( \ |
504 | echo; \ | 503 | echo; \ |
505 | echo " ERROR: Kernel configuration is invalid."; \ | 504 | echo " ERROR: Kernel configuration is invalid."; \ |
506 | echo " include/linux/autoconf.h or $@ are missing."; \ | 505 | echo " include/generated/autoconf.h or $@ are missing.";\ |
507 | echo " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ | 506 | echo " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ |
508 | echo; \ | 507 | echo; \ |
509 | /bin/false) | 508 | /bin/false) |
@@ -877,6 +876,9 @@ $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ; | |||
877 | PHONY += $(vmlinux-dirs) | 876 | PHONY += $(vmlinux-dirs) |
878 | $(vmlinux-dirs): prepare scripts | 877 | $(vmlinux-dirs): prepare scripts |
879 | $(Q)$(MAKE) $(build)=$@ | 878 | $(Q)$(MAKE) $(build)=$@ |
879 | ifdef CONFIG_MODULES | ||
880 | $(Q)$(MAKE) $(modbuiltin)=$@ | ||
881 | endif | ||
880 | 882 | ||
881 | # Build the kernel release string | 883 | # Build the kernel release string |
882 | # | 884 | # |
@@ -955,7 +957,6 @@ PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3 | |||
955 | # prepare3 is used to check if we are building in a separate output directory, | 957 | # prepare3 is used to check if we are building in a separate output directory, |
956 | # and if so do: | 958 | # and if so do: |
957 | # 1) Check that make has not been executed in the kernel src $(srctree) | 959 | # 1) Check that make has not been executed in the kernel src $(srctree) |
958 | # 2) Create the include2 directory, used for the second asm symlink | ||
959 | prepare3: include/config/kernel.release | 960 | prepare3: include/config/kernel.release |
960 | ifneq ($(KBUILD_SRC),) | 961 | ifneq ($(KBUILD_SRC),) |
961 | @$(kecho) ' Using $(srctree) as source for kernel' | 962 | @$(kecho) ' Using $(srctree) as source for kernel' |
@@ -964,17 +965,13 @@ ifneq ($(KBUILD_SRC),) | |||
964 | echo " in the '$(srctree)' directory.";\ | 965 | echo " in the '$(srctree)' directory.";\ |
965 | /bin/false; \ | 966 | /bin/false; \ |
966 | fi; | 967 | fi; |
967 | $(Q)if [ ! -d include2 ]; then \ | ||
968 | mkdir -p include2; \ | ||
969 | ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \ | ||
970 | fi | ||
971 | endif | 968 | endif |
972 | 969 | ||
973 | # prepare2 creates a makefile if using a separate output directory | 970 | # prepare2 creates a makefile if using a separate output directory |
974 | prepare2: prepare3 outputmakefile | 971 | prepare2: prepare3 outputmakefile |
975 | 972 | ||
976 | prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \ | 973 | prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \ |
977 | include/asm include/config/auto.conf | 974 | include/config/auto.conf |
978 | $(cmd_crmodverdir) | 975 | $(cmd_crmodverdir) |
979 | 976 | ||
980 | archprepare: prepare1 scripts_basic | 977 | archprepare: prepare1 scripts_basic |
@@ -986,42 +983,6 @@ prepare0: archprepare FORCE | |||
986 | # All the preparing.. | 983 | # All the preparing.. |
987 | prepare: prepare0 | 984 | prepare: prepare0 |
988 | 985 | ||
989 | # The asm symlink changes when $(ARCH) changes. | ||
990 | # Detect this and ask user to run make mrproper | ||
991 | # If asm is a stale symlink (point to dir that does not exist) remove it | ||
992 | define check-symlink | ||
993 | set -e; \ | ||
994 | if [ -L include/asm ]; then \ | ||
995 | asmlink=`readlink include/asm | cut -d '-' -f 2`; \ | ||
996 | if [ "$$asmlink" != "$(SRCARCH)" ]; then \ | ||
997 | echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \ | ||
998 | echo " set ARCH or save .config and run 'make mrproper' to fix it"; \ | ||
999 | exit 1; \ | ||
1000 | fi; \ | ||
1001 | test -e $$asmlink || rm include/asm; \ | ||
1002 | elif [ -d include/asm ]; then \ | ||
1003 | echo "ERROR: $@ is a directory but a symlink was expected";\ | ||
1004 | exit 1; \ | ||
1005 | fi | ||
1006 | endef | ||
1007 | |||
1008 | # We create the target directory of the symlink if it does | ||
1009 | # not exist so the test in check-symlink works and we have a | ||
1010 | # directory for generated filesas used by some architectures. | ||
1011 | define create-symlink | ||
1012 | if [ ! -L include/asm ]; then \ | ||
1013 | $(kecho) ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \ | ||
1014 | if [ ! -d include/asm-$(SRCARCH) ]; then \ | ||
1015 | mkdir -p include/asm-$(SRCARCH); \ | ||
1016 | fi; \ | ||
1017 | ln -fsn asm-$(SRCARCH) $@; \ | ||
1018 | fi | ||
1019 | endef | ||
1020 | |||
1021 | include/asm: FORCE | ||
1022 | $(Q)$(check-symlink) | ||
1023 | $(Q)$(create-symlink) | ||
1024 | |||
1025 | # Generate some files | 986 | # Generate some files |
1026 | # --------------------------------------------------------------------------- | 987 | # --------------------------------------------------------------------------- |
1027 | 988 | ||
@@ -1046,7 +1007,7 @@ endef | |||
1046 | include/linux/version.h: $(srctree)/Makefile FORCE | 1007 | include/linux/version.h: $(srctree)/Makefile FORCE |
1047 | $(call filechk,version.h) | 1008 | $(call filechk,version.h) |
1048 | 1009 | ||
1049 | include/linux/utsrelease.h: include/config/kernel.release FORCE | 1010 | include/generated/utsrelease.h: include/config/kernel.release FORCE |
1050 | $(call filechk,utsrelease.h) | 1011 | $(call filechk,utsrelease.h) |
1051 | 1012 | ||
1052 | PHONY += headerdep | 1013 | PHONY += headerdep |
@@ -1076,11 +1037,6 @@ firmware_install: FORCE | |||
1076 | export INSTALL_HDR_PATH = $(objtree)/usr | 1037 | export INSTALL_HDR_PATH = $(objtree)/usr |
1077 | 1038 | ||
1078 | hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj | 1039 | hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj |
1079 | # Find out where the Kbuild file is located to support | ||
1080 | # arch/$(ARCH)/include/asm | ||
1081 | hdr-dir = $(strip \ | ||
1082 | $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/asm/Kbuild), \ | ||
1083 | arch/$(hdr-arch)/include/asm, include/asm-$(hdr-arch))) | ||
1084 | 1040 | ||
1085 | # If we do an all arch process set dst to asm-$(hdr-arch) | 1041 | # If we do an all arch process set dst to asm-$(hdr-arch) |
1086 | hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm) | 1042 | hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm) |
@@ -1095,10 +1051,10 @@ headers_install_all: | |||
1095 | 1051 | ||
1096 | PHONY += headers_install | 1052 | PHONY += headers_install |
1097 | headers_install: __headers | 1053 | headers_install: __headers |
1098 | $(if $(wildcard $(srctree)/$(hdr-dir)/Kbuild),, \ | 1054 | $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/asm/Kbuild),, \ |
1099 | $(error Headers not exportable for the $(SRCARCH) architecture)) | 1055 | $(error Headers not exportable for the $(SRCARCH) architecture)) |
1100 | $(Q)$(MAKE) $(hdr-inst)=include | 1056 | $(Q)$(MAKE) $(hdr-inst)=include |
1101 | $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst) | 1057 | $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst) |
1102 | 1058 | ||
1103 | PHONY += headers_check_all | 1059 | PHONY += headers_check_all |
1104 | headers_check_all: headers_install_all | 1060 | headers_check_all: headers_install_all |
@@ -1107,7 +1063,7 @@ headers_check_all: headers_install_all | |||
1107 | PHONY += headers_check | 1063 | PHONY += headers_check |
1108 | headers_check: headers_install | 1064 | headers_check: headers_install |
1109 | $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1 | 1065 | $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1 |
1110 | $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst) HDRCHECK=1 | 1066 | $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst) HDRCHECK=1 |
1111 | 1067 | ||
1112 | # --------------------------------------------------------------------------- | 1068 | # --------------------------------------------------------------------------- |
1113 | # Modules | 1069 | # Modules |
@@ -1127,6 +1083,7 @@ all: modules | |||
1127 | PHONY += modules | 1083 | PHONY += modules |
1128 | modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) | 1084 | modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) |
1129 | $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order | 1085 | $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order |
1086 | $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.builtin) > $(objtree)/modules.builtin | ||
1130 | @$(kecho) ' Building modules, stage 2.'; | 1087 | @$(kecho) ' Building modules, stage 2.'; |
1131 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost | 1088 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
1132 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild | 1089 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild |
@@ -1156,6 +1113,7 @@ _modinst_: | |||
1156 | ln -s $(objtree) $(MODLIB)/build ; \ | 1113 | ln -s $(objtree) $(MODLIB)/build ; \ |
1157 | fi | 1114 | fi |
1158 | @cp -f $(objtree)/modules.order $(MODLIB)/ | 1115 | @cp -f $(objtree)/modules.order $(MODLIB)/ |
1116 | @cp -f $(objtree)/modules.builtin $(MODLIB)/ | ||
1159 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst | 1117 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst |
1160 | 1118 | ||
1161 | # This depmod is only for convenience to give the initial | 1119 | # This depmod is only for convenience to give the initial |
@@ -1194,12 +1152,10 @@ CLEAN_FILES += vmlinux System.map \ | |||
1194 | .tmp_kallsyms* .tmp_version .tmp_vmlinux* .tmp_System.map | 1152 | .tmp_kallsyms* .tmp_version .tmp_vmlinux* .tmp_System.map |
1195 | 1153 | ||
1196 | # Directories & files removed with 'make mrproper' | 1154 | # Directories & files removed with 'make mrproper' |
1197 | MRPROPER_DIRS += include/config include2 usr/include include/generated | 1155 | MRPROPER_DIRS += include/config usr/include include/generated |
1198 | MRPROPER_FILES += .config .config.old include/asm .version .old_version \ | 1156 | MRPROPER_FILES += .config .config.old .version .old_version \ |
1199 | include/linux/autoconf.h include/linux/version.h \ | 1157 | include/linux/version.h \ |
1200 | include/linux/utsrelease.h \ | 1158 | Module.symvers tags TAGS cscope* |
1201 | include/linux/bounds.h include/asm*/asm-offsets.h \ | ||
1202 | Module.symvers Module.markers tags TAGS cscope* | ||
1203 | 1159 | ||
1204 | # clean - Delete most, but leave enough to build external modules | 1160 | # clean - Delete most, but leave enough to build external modules |
1205 | # | 1161 | # |
@@ -1218,7 +1174,7 @@ clean: archclean $(clean-dirs) | |||
1218 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ | 1174 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ |
1219 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ | 1175 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ |
1220 | -o -name '*.symtypes' -o -name 'modules.order' \ | 1176 | -o -name '*.symtypes' -o -name 'modules.order' \ |
1221 | -o -name 'Module.markers' -o -name '.tmp_*.o.*' \ | 1177 | -o -name modules.builtin -o -name '.tmp_*.o.*' \ |
1222 | -o -name '*.gcno' \) -type f -print | xargs rm -f | 1178 | -o -name '*.gcno' \) -type f -print | xargs rm -f |
1223 | 1179 | ||
1224 | # mrproper - Delete all generated files, including .config | 1180 | # mrproper - Delete all generated files, including .config |
@@ -1416,8 +1372,8 @@ $(clean-dirs): | |||
1416 | 1372 | ||
1417 | clean: rm-dirs := $(MODVERDIR) | 1373 | clean: rm-dirs := $(MODVERDIR) |
1418 | clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers \ | 1374 | clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers \ |
1419 | $(KBUILD_EXTMOD)/Module.markers \ | 1375 | $(KBUILD_EXTMOD)/modules.order \ |
1420 | $(KBUILD_EXTMOD)/modules.order | 1376 | $(KBUILD_EXTMOD)/modules.builtin |
1421 | clean: $(clean-dirs) | 1377 | clean: $(clean-dirs) |
1422 | $(call cmd,rmdirs) | 1378 | $(call cmd,rmdirs) |
1423 | $(call cmd,rmfiles) | 1379 | $(call cmd,rmfiles) |