aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile71
1 files changed, 38 insertions, 33 deletions
diff --git a/Makefile b/Makefile
index 68ef80b30340..f9c264e243a2 100644
--- a/Makefile
+++ b/Makefile
@@ -887,10 +887,7 @@ prepare2: prepare3 outputmakefile
887 887
888prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \ 888prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \
889 include/asm include/config/auto.conf 889 include/asm include/config/auto.conf
890ifneq ($(KBUILD_MODULES),) 890 $(cmd_crmodverdir)
891 $(Q)mkdir -p $(MODVERDIR)
892 $(Q)rm -f $(MODVERDIR)/*
893endif
894 891
895archprepare: prepare1 scripts_basic 892archprepare: prepare1 scripts_basic
896 893
@@ -906,14 +903,24 @@ prepare: prepare0
906 903
907export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) 904export 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 909include/asm: FORCE
913include/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.
1031ifeq "$(strip $(INSTALL_MOD_PATH))" ""
1032depmod_opts :=
1033else
1034depmod_opts := -b $(INSTALL_MOD_PATH) -r
1035endif
1036PHONY += _modinst_post 1036PHONY += _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
1040else # CONFIG_MODULES 1040else # CONFIG_MODULES
1041 1041
@@ -1223,8 +1223,7 @@ else # KBUILD_EXTMOD
1223KBUILD_MODULES := 1 1223KBUILD_MODULES := 1
1224PHONY += crmodverdir 1224PHONY += crmodverdir
1225crmodverdir: 1225crmodverdir:
1226 $(Q)mkdir -p $(MODVERDIR) 1226 $(cmd_crmodverdir)
1227 $(Q)rm -f $(MODVERDIR)/*
1228 1227
1229PHONY += $(objtree)/Module.symvers 1228PHONY += $(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
1256quiet_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
1264PHONY += _emodinst_post 1254PHONY += _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 )
1350endef 1340endef
@@ -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)))
1509quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) 1501quiet_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
1506quiet_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
1515cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR); rm -f $(MODVERDIR)/*
1516
1512 1517
1513a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \ 1518a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \
1514 $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ 1519 $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \