diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 71 |
1 files changed, 38 insertions, 33 deletions
@@ -887,10 +887,7 @@ prepare2: prepare3 outputmakefile | |||
887 | 887 | ||
888 | prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \ | 888 | prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \ |
889 | include/asm include/config/auto.conf | 889 | include/asm include/config/auto.conf |
890 | ifneq ($(KBUILD_MODULES),) | 890 | $(cmd_crmodverdir) |
891 | $(Q)mkdir -p $(MODVERDIR) | ||
892 | $(Q)rm -f $(MODVERDIR)/* | ||
893 | endif | ||
894 | 891 | ||
895 | archprepare: prepare1 scripts_basic | 892 | archprepare: prepare1 scripts_basic |
896 | 893 | ||
@@ -906,14 +903,24 @@ prepare: prepare0 | |||
906 | 903 | ||
907 | export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) | 904 | export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) |
908 | 905 | ||
909 | # FIXME: The asm symlink changes when $(ARCH) changes. That's | 906 | # The asm symlink changes when $(ARCH) changes. |
910 | # hard to detect, but I suppose "make mrproper" is a good idea | 907 | # Detect this and ask user to run make mrproper |
911 | # before switching between archs anyway. | 908 | |
912 | 909 | include/asm: FORCE | |
913 | include/asm: | 910 | $(Q)set -e; asmlink=`readlink include/asm | cut -d '-' -f 2`; \ |
914 | @echo ' SYMLINK $@ -> include/asm-$(SRCARCH)' | 911 | if [ -L include/asm ]; then \ |
915 | $(Q)if [ ! -d include ]; then mkdir -p include; fi; | 912 | if [ "$$asmlink" != "$(SRCARCH)" ]; then \ |
916 | @ln -fsn asm-$(SRCARCH) $@ | 913 | echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \ |
914 | echo " set ARCH or save .config and run 'make mrproper' to fix it"; \ | ||
915 | exit 1; \ | ||
916 | fi; \ | ||
917 | else \ | ||
918 | echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \ | ||
919 | if [ ! -d include ]; then \ | ||
920 | mkdir -p include; \ | ||
921 | fi; \ | ||
922 | ln -fsn asm-$(SRCARCH) $@; \ | ||
923 | fi | ||
917 | 924 | ||
918 | # Generate some files | 925 | # Generate some files |
919 | # --------------------------------------------------------------------------- | 926 | # --------------------------------------------------------------------------- |
@@ -1023,19 +1030,12 @@ _modinst_: | |||
1023 | fi | 1030 | fi |
1024 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst | 1031 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst |
1025 | 1032 | ||
1026 | # If System.map exists, run depmod. This deliberately does not have a | 1033 | # This depmod is only for convenience to give the initial |
1027 | # dependency on System.map since that would run the dependency tree on | ||
1028 | # vmlinux. This depmod is only for convenience to give the initial | ||
1029 | # boot a modules.dep even before / is mounted read-write. However the | 1034 | # boot a modules.dep even before / is mounted read-write. However the |
1030 | # boot script depmod is the master version. | 1035 | # boot script depmod is the master version. |
1031 | ifeq "$(strip $(INSTALL_MOD_PATH))" "" | ||
1032 | depmod_opts := | ||
1033 | else | ||
1034 | depmod_opts := -b $(INSTALL_MOD_PATH) -r | ||
1035 | endif | ||
1036 | PHONY += _modinst_post | 1036 | PHONY += _modinst_post |
1037 | _modinst_post: _modinst_ | 1037 | _modinst_post: _modinst_ |
1038 | if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi | 1038 | $(call cmd,depmod) |
1039 | 1039 | ||
1040 | else # CONFIG_MODULES | 1040 | else # CONFIG_MODULES |
1041 | 1041 | ||
@@ -1223,8 +1223,7 @@ else # KBUILD_EXTMOD | |||
1223 | KBUILD_MODULES := 1 | 1223 | KBUILD_MODULES := 1 |
1224 | PHONY += crmodverdir | 1224 | PHONY += crmodverdir |
1225 | crmodverdir: | 1225 | crmodverdir: |
1226 | $(Q)mkdir -p $(MODVERDIR) | 1226 | $(cmd_crmodverdir) |
1227 | $(Q)rm -f $(MODVERDIR)/* | ||
1228 | 1227 | ||
1229 | PHONY += $(objtree)/Module.symvers | 1228 | PHONY += $(objtree)/Module.symvers |
1230 | $(objtree)/Module.symvers: | 1229 | $(objtree)/Module.symvers: |
@@ -1252,15 +1251,6 @@ _emodinst_: | |||
1252 | $(Q)mkdir -p $(MODLIB)/$(install-dir) | 1251 | $(Q)mkdir -p $(MODLIB)/$(install-dir) |
1253 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst | 1252 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst |
1254 | 1253 | ||
1255 | # Run depmod only is we have System.map and depmod is executable | ||
1256 | quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) | ||
1257 | cmd_depmod = if [ -r System.map -a -x $(DEPMOD) ]; then \ | ||
1258 | $(DEPMOD) -ae -F System.map \ | ||
1259 | $(if $(strip $(INSTALL_MOD_PATH)), \ | ||
1260 | -b $(INSTALL_MOD_PATH) -r) \ | ||
1261 | $(KERNELRELEASE); \ | ||
1262 | fi | ||
1263 | |||
1264 | PHONY += _emodinst_post | 1254 | PHONY += _emodinst_post |
1265 | _emodinst_post: _emodinst_ | 1255 | _emodinst_post: _emodinst_ |
1266 | $(call cmd,depmod) | 1256 | $(call cmd,depmod) |
@@ -1344,7 +1334,7 @@ define find-sources | |||
1344 | find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ | 1334 | find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ |
1345 | -name $1 -print; \ | 1335 | -name $1 -print; \ |
1346 | find $(__srctree) $(RCS_FIND_IGNORE) \ | 1336 | find $(__srctree) $(RCS_FIND_IGNORE) \ |
1347 | \( -name include -o -name arch \) -prune -o \ | 1337 | \( -name include -o -name arch -o -name '.tmp_*' \) -prune -o \ |
1348 | -name $1 -print; \ | 1338 | -name $1 -print; \ |
1349 | ) | 1339 | ) |
1350 | endef | 1340 | endef |
@@ -1493,9 +1483,11 @@ endif | |||
1493 | 1483 | ||
1494 | # Modules | 1484 | # Modules |
1495 | / %/: prepare scripts FORCE | 1485 | / %/: prepare scripts FORCE |
1486 | $(cmd_crmodverdir) | ||
1496 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ | 1487 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ |
1497 | $(build)=$(build-dir) | 1488 | $(build)=$(build-dir) |
1498 | %.ko: prepare scripts FORCE | 1489 | %.ko: prepare scripts FORCE |
1490 | $(cmd_crmodverdir) | ||
1499 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ | 1491 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ |
1500 | $(build)=$(build-dir) $(@:.ko=.o) | 1492 | $(build)=$(build-dir) $(@:.ko=.o) |
1501 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost | 1493 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
@@ -1509,6 +1501,19 @@ quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs))) | |||
1509 | quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) | 1501 | quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) |
1510 | cmd_rmfiles = rm -f $(rm-files) | 1502 | cmd_rmfiles = rm -f $(rm-files) |
1511 | 1503 | ||
1504 | # Run depmod only is we have System.map and depmod is executable | ||
1505 | # and we build for the host arch | ||
1506 | quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) | ||
1507 | cmd_depmod = \ | ||
1508 | if [ -r System.map -a -x $(DEPMOD) -a "$(SUBARCH)" == "$(ARCH)" ]; then \ | ||
1509 | $(DEPMOD) -ae -F System.map \ | ||
1510 | $(if $(strip $(INSTALL_MOD_PATH)), -b $(INSTALL_MOD_PATH) -r) \ | ||
1511 | $(KERNELRELEASE); \ | ||
1512 | fi | ||
1513 | |||
1514 | # Create temporary dir for module support files | ||
1515 | cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR); rm -f $(MODVERDIR)/* | ||
1516 | |||
1512 | 1517 | ||
1513 | a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \ | 1518 | a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \ |
1514 | $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ | 1519 | $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ |