Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelv...
[sfrench/cifs-2.6.git] / Makefile
index 924c62ee4d61143464beec016ce21f2613d0122c..8491b21b553727ce472ed9929226c0378fae7542 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -336,7 +336,7 @@ CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
 # Needed to be compatible with the O= option
 LINUXINCLUDE    := -I$(srctree)/arch/$(hdr-arch)/include -Iinclude \
                    $(if $(KBUILD_SRC), -I$(srctree)/include) \
-                   -include include/linux/autoconf.h
+                   -include include/generated/autoconf.h
 
 KBUILD_CPPFLAGS := -D__KERNEL__
 
@@ -464,7 +464,7 @@ ifeq ($(KBUILD_EXTMOD),)
 # Carefully list dependencies so we do not try to build scripts twice
 # in parallel
 PHONY += scripts
-scripts: scripts_basic include/config/auto.conf
+scripts: scripts_basic include/config/auto.conf include/config/tristate.conf
        $(Q)$(MAKE) $(build)=$(@)
 
 # Objects we will link into vmlinux / subdirs we need to visit
@@ -491,18 +491,18 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
 # with it and forgot to run make oldconfig.
 # if auto.conf.cmd is missing then we are probably in a cleaned tree so
 # we execute the config step to be sure to catch updated Kconfig files
-include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
+include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
        $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
 else
-# external modules needs include/linux/autoconf.h and include/config/auto.conf
+# external modules needs include/generated/autoconf.h and include/config/auto.conf
 # but do not care if they are up-to-date. Use auto.conf to trigger the test
 PHONY += include/config/auto.conf
 
 include/config/auto.conf:
-       $(Q)test -e include/linux/autoconf.h -a -e $@ || (              \
+       $(Q)test -e include/generated/autoconf.h -a -e $@ || (          \
        echo;                                                           \
        echo "  ERROR: Kernel configuration is invalid.";               \
-       echo "         include/linux/autoconf.h or $@ are missing.";    \
+       echo "         include/generated/autoconf.h or $@ are missing.";\
        echo "         Run 'make oldconfig && make prepare' on kernel src to fix it.";  \
        echo;                                                           \
        /bin/false)
@@ -876,6 +876,9 @@ $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
 PHONY += $(vmlinux-dirs)
 $(vmlinux-dirs): prepare scripts
        $(Q)$(MAKE) $(build)=$@
+ifdef CONFIG_MODULES
+       $(Q)$(MAKE) $(modbuiltin)=$@
+endif
 
 # Build the kernel release string
 #
@@ -967,8 +970,8 @@ endif
 # prepare2 creates a makefile if using a separate output directory
 prepare2: prepare3 outputmakefile
 
-prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \
-                   include/asm include/config/auto.conf
+prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \
+                   include/config/auto.conf
        $(cmd_crmodverdir)
 
 archprepare: prepare1 scripts_basic
@@ -980,42 +983,6 @@ prepare0: archprepare FORCE
 # All the preparing..
 prepare: prepare0
 
-# The asm symlink changes when $(ARCH) changes.
-# Detect this and ask user to run make mrproper
-# If asm is a stale symlink (point to dir that does not exist) remove it
-define check-symlink
-       set -e;                                                            \
-       if [ -L include/asm ]; then                                        \
-               asmlink=`readlink include/asm | cut -d '-' -f 2`;          \
-               if [ "$$asmlink" != "$(SRCARCH)" ]; then                   \
-                       echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \
-                       echo "       set ARCH or save .config and run 'make mrproper' to fix it";             \
-                       exit 1;                                            \
-               fi;                                                        \
-               test -e $$asmlink || rm include/asm;                       \
-       elif [ -d include/asm ]; then                                      \
-               echo "ERROR: $@ is a directory but a symlink was expected";\
-               exit 1;                                                    \
-       fi
-endef
-
-# We create the target directory of the symlink if it does
-# not exist so the test in check-symlink works and we have a
-# directory for generated filesas used by some architectures.
-define create-symlink
-       if [ ! -L include/asm ]; then                                      \
-                       $(kecho) '  SYMLINK $@ -> include/asm-$(SRCARCH)'; \
-                       if [ ! -d include/asm-$(SRCARCH) ]; then           \
-                               mkdir -p include/asm-$(SRCARCH);           \
-                       fi;                                                \
-                       ln -fsn asm-$(SRCARCH) $@;                         \
-       fi
-endef
-
-include/asm: FORCE
-       $(Q)$(check-symlink)
-       $(Q)$(create-symlink)
-
 # Generate some files
 # ---------------------------------------------------------------------------
 
@@ -1040,7 +1007,7 @@ endef
 include/linux/version.h: $(srctree)/Makefile FORCE
        $(call filechk,version.h)
 
-include/linux/utsrelease.h: include/config/kernel.release FORCE
+include/generated/utsrelease.h: include/config/kernel.release FORCE
        $(call filechk,utsrelease.h)
 
 PHONY += headerdep
@@ -1116,6 +1083,7 @@ all: modules
 PHONY += modules
 modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
        $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
+       $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.builtin) > $(objtree)/modules.builtin
        @$(kecho) '  Building modules, stage 2.';
        $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
        $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild
@@ -1145,6 +1113,7 @@ _modinst_:
                ln -s $(objtree) $(MODLIB)/build ; \
        fi
        @cp -f $(objtree)/modules.order $(MODLIB)/
+       @cp -f $(objtree)/modules.builtin $(MODLIB)/
        $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
 
 # This depmod is only for convenience to give the initial
@@ -1184,10 +1153,9 @@ CLEAN_FILES +=   vmlinux System.map \
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config usr/include include/generated
-MRPROPER_FILES += .config .config.old include/asm .version .old_version \
-                  include/linux/autoconf.h include/linux/version.h      \
-                  include/linux/utsrelease.h                            \
-                 Module.symvers Module.markers tags TAGS cscope*
+MRPROPER_FILES += .config .config.old .version .old_version             \
+                  include/linux/version.h                               \
+                 Module.symvers tags TAGS cscope*
 
 # clean - Delete most, but leave enough to build external modules
 #
@@ -1206,7 +1174,7 @@ clean: archclean $(clean-dirs)
                \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
                -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
                -o -name '*.symtypes' -o -name 'modules.order' \
-               -o -name 'Module.markers' -o -name '.tmp_*.o.*' \
+               -o -name modules.builtin -o -name '.tmp_*.o.*' \
                -o -name '*.gcno' \) -type f -print | xargs rm -f
 
 # mrproper - Delete all generated files, including .config
@@ -1404,8 +1372,8 @@ $(clean-dirs):
 
 clean: rm-dirs := $(MODVERDIR)
 clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers \
-                   $(KBUILD_EXTMOD)/Module.markers \
-                   $(KBUILD_EXTMOD)/modules.order
+                   $(KBUILD_EXTMOD)/modules.order \
+                   $(KBUILD_EXTMOD)/modules.builtin
 clean: $(clean-dirs)
        $(call cmd,rmdirs)
        $(call cmd,rmfiles)