tags and cscope support really belongs in a shell script
[safe/jmp/linux-2.6] / Makefile
index f448e00..be462cf 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
 VERSION = 2
 PATCHLEVEL = 6
-SUBLEVEL = 27
-EXTRAVERSION = -rc5
-NAME = Rotary Wombat
+SUBLEVEL = 28
+EXTRAVERSION = -rc7
+NAME = Erotic Pickled Herring
 
 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"
@@ -336,7 +336,7 @@ LINUXINCLUDE    := -Iinclude \
                    -I$(srctree)/arch/$(hdr-arch)/include               \
                    -include include/linux/autoconf.h
 
-KBUILD_CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
+KBUILD_CPPFLAGS := -D__KERNEL__
 
 KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
                   -fno-strict-aliasing -fno-common \
@@ -437,7 +437,7 @@ ifeq ($(config-targets),1)
 # KBUILD_DEFCONFIG may point out an alternative default configuration
 # used for 'make defconfig'
 include $(srctree)/arch/$(SRCARCH)/Makefile
-export KBUILD_DEFCONFIG
+export KBUILD_DEFCONFIG KBUILD_KCONFIG
 
 config %config: scripts_basic outputmakefile FORCE
        $(Q)mkdir -p include/linux include/config
@@ -536,7 +536,7 @@ KBUILD_CFLAGS       += -g
 KBUILD_AFLAGS  += -gdwarf-2
 endif
 
-ifdef CONFIG_FTRACE
+ifdef CONFIG_FUNCTION_TRACER
 KBUILD_CFLAGS  += -pg
 endif
 
@@ -926,7 +926,7 @@ PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
 # 2) Create the include2 directory, used for the second asm symlink
 prepare3: include/config/kernel.release
 ifneq ($(KBUILD_SRC),)
-       @echo '  Using $(srctree) as source for kernel'
+       @$(kecho) '  Using $(srctree) as source for kernel'
        $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \
                echo "  $(srctree) is not clean, please run 'make mrproper'";\
                echo "  in the '$(srctree)' directory.";\
@@ -961,6 +961,7 @@ export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
 
 # 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                                        \
@@ -970,6 +971,10 @@ define check-symlink
                        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
 
@@ -978,7 +983,7 @@ endef
 # directory for generated filesas used by some architectures.
 define create-symlink
        if [ ! -L include/asm ]; then                                      \
-                       echo '  SYMLINK $@ -> include/asm-$(SRCARCH)';     \
+                       $(kecho) '  SYMLINK $@ -> include/asm-$(SRCARCH)'; \
                        if [ ! -d include/asm-$(SRCARCH) ]; then           \
                                mkdir -p include/asm-$(SRCARCH);           \
                        fi;                                                \
@@ -1091,7 +1096,7 @@ all: modules
 PHONY += modules
 modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
        $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
-       @echo '  Building modules, stage 2.';
+       @$(kecho) '  Building modules, stage 2.';
        $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
        $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild
 
@@ -1355,7 +1360,7 @@ $(module-dirs): crmodverdir $(objtree)/Module.symvers
        $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
 
 modules: $(module-dirs)
-       @echo '  Building modules, stage 2.';
+       @$(kecho) '  Building modules, stage 2.';
        $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
 
 PHONY += modules_install
@@ -1404,122 +1409,12 @@ endif # KBUILD_EXTMOD
 
 # Generate tags for editors
 # ---------------------------------------------------------------------------
+quiet_cmd_tags = GEN     $@
+      cmd_tags = $(CONFIG_SHELL) $(srctree)/scripts/tags.sh $@
 
-#We want __srctree to totally vanish out when KBUILD_OUTPUT is not set
-#(which is the most common case IMHO) to avoid unneeded clutter in the big tags file.
-#Adding $(srctree) adds about 20M on i386 to the size of the output file!
-
-ifeq ($(src),$(obj))
-__srctree =
-else
-__srctree = $(srctree)/
-endif
-
-ifeq ($(ALLSOURCE_ARCHS),)
-ifeq ($(ARCH),um)
-ALLINCLUDE_ARCHS := $(ARCH) $(SUBARCH)
-else
-ALLINCLUDE_ARCHS := $(SRCARCH)
-endif
-else
-#Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behaviour.
-ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS)
-endif
-
-ALLSOURCE_ARCHS := $(SRCARCH)
-
-define find-sources
-        ( for arch in $(ALLSOURCE_ARCHS) ; do \
-              find $(__srctree)arch/$${arch} $(RCS_FIND_IGNORE) \
-                   -name $1 -print; \
-         done ; \
-         find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \
-              -name $1 -print; \
-         find $(__srctree)include $(RCS_FIND_IGNORE) \
-              \( -name config -o -name 'asm-*' \) -prune \
-              -o -name $1 -print; \
-         for arch in $(ALLINCLUDE_ARCHS) ; do \
-              test -e $(__srctree)include/asm-$${arch} && \
-                 find $(__srctree)include/asm-$${arch} $(RCS_FIND_IGNORE) \
-                   -name $1 -print; \
-              test -e $(__srctree)arch/$${arch}/include/asm && \
-                find $(__srctree)arch/$${arch}/include/asm $(RCS_FIND_IGNORE) \
-                   -name $1 -print; \
-         done ; \
-         find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \
-              -name $1 -print; \
-         find $(__srctree) $(RCS_FIND_IGNORE) \
-              \( -name include -o -name arch -o -name '.tmp_*' \) -prune -o \
-              -name $1 -print; \
-         )
-endef
-
-define all-sources
-       $(call find-sources,'*.[chS]')
-endef
-define all-kconfigs
-       $(call find-sources,'Kconfig*')
-endef
-define all-defconfigs
-       $(call find-sources,'defconfig')
-endef
-
-define xtags
-       if $1 --version 2>&1 | grep -iq exuberant; then \
-           $(all-sources) | xargs $1 -a \
-               -I __initdata,__exitdata,__acquires,__releases \
-               -I __read_mostly,____cacheline_aligned,____cacheline_aligned_in_smp,____cacheline_internodealigned_in_smp \
-               -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
-               --extra=+f --c-kinds=+px \
-               --regex-asm='/^ENTRY\(([^)]*)\).*/\1/'; \
-           $(all-kconfigs) | xargs $1 -a \
-               --langdef=kconfig \
-               --language-force=kconfig \
-               --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/'; \
-           $(all-defconfigs) | xargs -r $1 -a \
-               --langdef=dotconfig \
-               --language-force=dotconfig \
-               --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'; \
-       elif $1 --version 2>&1 | grep -iq emacs; then \
-           $(all-sources) | xargs $1 -a; \
-           $(all-kconfigs) | xargs $1 -a \
-               --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'; \
-           $(all-defconfigs) | xargs -r $1 -a \
-               --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \
-       else \
-           $(all-sources) | xargs $1 -a; \
-       fi
-endef
-
-quiet_cmd_cscope-file = FILELST cscope.files
-      cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files
-
-quiet_cmd_cscope = MAKE    cscope.out
-      cmd_cscope = cscope -b -f cscope.out
-
-cscope: FORCE
-       $(call cmd,cscope-file)
-       $(call cmd,cscope)
-
-quiet_cmd_TAGS = MAKE   $@
-define cmd_TAGS
-       rm -f $@; \
-       $(call xtags,etags)
-endef
-
-TAGS: FORCE
-       $(call cmd,TAGS)
-
-quiet_cmd_tags = MAKE   $@
-define cmd_tags
-       rm -f $@; \
-       $(call xtags,ctags)
-endef
-
-tags: FORCE
+tags TAGS cscope: FORCE
        $(call cmd,tags)
 
-
 # Scripts to check various things for consistency
 # ---------------------------------------------------------------------------
 
@@ -1632,7 +1527,7 @@ cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \
                   $(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*)
 
 a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \
-         $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \
+         $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(KBUILD_CPPFLAGS) \
          $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o)
 
 quiet_cmd_as_o_S = AS      $@