From: James S. <jsi...@us...> - 2002-06-15 19:17:44
|
Update of /cvsroot/linuxconsole/ruby/linux In directory usw-pr-cvs1:/tmp/cvs-serv22898/linux Modified Files: Makefile Log Message: Synced to 2.5.21 Index: Makefile =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/Makefile,v retrieving revision 1.62 retrieving revision 1.63 diff -u -d -r1.62 -r1.63 --- Makefile 4 Jun 2002 19:45:03 -0000 1.62 +++ Makefile 15 Jun 2002 19:17:07 -0000 1.63 @@ -1,8 +1,8 @@ VERSION = 2 PATCHLEVEL = 5 -SUBLEVEL = 20 +SUBLEVEL = 21 EXTRAVERSION = -ruby - + # We are using a recursive build, so we need to do a little thinking # to get the ordering right. # @@ -37,6 +37,56 @@ CROSS_COMPILE = +# That's our default target when none is given on the command line + +all: vmlinux + +# Print entire command lines instead of short version +# For now, leave the default + +ifndef KBUILD_VERBOSE + KBUILD_VERBOSE = 1 +endif + +# Decide whether to build built-in, modular, or both + +KBUILD_MODULES := 1 +KBUILD_BUILTIN := 1 + +export KBUILD_MODULES KBUILD_BUILTIN + +# Beautify output +# --------------------------------------------------------------------------- +# +# Normally, we echo the whole command before executing it. By making +# that echo $($(quiet)$(cmd)), we now have the possibility to set +# $(quiet) to choose other forms of output instead, e.g. +# +# quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@ +# cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< +# +# If $(quiet) is empty, the whole command will be printed. +# If it is set to "quiet_", only the short version will be printed. +# If it is set to "silent_", nothing wil be printed at all, since +# the variable $(silent_cmd_cc_o_c) doesn't exist. + +# If the user wants quiet mode, echo short versions of the commands +# only and suppress the 'Entering/Leaving directory' messages + +ifneq ($(KBUILD_VERBOSE),1) + quiet=quiet_ + MAKEFLAGS += --no-print-directory +endif + +# If the user is running make -s (silent mode), suppress echoing of +# commands + +ifneq ($(findstring s,$(MAKEFLAGS)),) + quiet=silent_ +endif + +export quiet + # # Include the make variables (CC, etc...) # @@ -56,33 +106,46 @@ PERL = perl MODFLAGS = -DMODULE CFLAGS_MODULE = $(MODFLAGS) -AFLAGS_MODULE = +AFLAGS_MODULE = $(MODFLAGS) CFLAGS_KERNEL = AFLAGS_KERNEL = EXPORT_FLAGS = +NOSTDINC_FLAGS = -nostdinc -iwithprefix include export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \ CONFIG_SHELL TOPDIR HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS PERL -export CPPFLAGS EXPORT_FLAGS +export CPPFLAGS EXPORT_FLAGS NOSTDINC_FLAGS export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE -all: do-it-all +noconfig_targets := xconfig menuconfig config oldconfig randconfig \ + defconfig allyesconfig allnoconfig allmodconfig \ + clean mrproper distclean +ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) + +# Here goes the main Makefile +# =========================================================================== # -# Make "config" the default target if there is no configuration file or -# "depend" the target if there is no top-level dependency information. -# +# If the user gave a *config target, it'll be handled in another +# section below, since in this case we cannot include .config +# Same goes for other targets like clean/mrproper etc, which +# don't need .config, either -ifeq (.config,$(wildcard .config)) -include .config -do-it-all: vmlinux -else -CONFIGURATION = config -do-it-all: config -endif +# In this section, we need .config + +-include .config + +# If .config doesn't exist - tough luck + +.config: + @echo '***' + @echo '*** You have not yet configured your kernel!' + @echo '*** Please run "make xconfig/menuconfig/config/oldconfig"' + @echo '***' + @exit 1 # # INSTALL_PATH specifies where to place the updated kernel and system map @@ -114,18 +177,14 @@ EXPORT_FLAGS := -DEXPORT_SYMTAB endif -INIT =init/init.o -CORE_FILES =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o -NETWORKS =net/network.o - -LIBS =$(TOPDIR)/lib/lib.a -SUBDIRS =init kernel lib drivers mm fs net ipc sound - -DRIVERS-y = drivers/built-in.o -DRIVERS-$(CONFIG_SOUND) += sound/sound.o - -DRIVERS := $(DRIVERS-y) - +# Link components for vmlinux +# --------------------------------------------------------------------------- +SUBDIRS := init kernel mm fs ipc lib drivers sound net +INIT := init/init.o +CORE_FILES := kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o +LIBS := lib/lib.a +DRIVERS := drivers/built-in.o sound/sound.o +NETWORKS := net/network.o include arch/$(ARCH)/Makefile @@ -149,6 +208,7 @@ vmlinux-objs := $(HEAD) $(INIT) $(CORE_FILES) $(LIBS) $(DRIVERS) $(NETWORKS) +quiet_cmd_link_vmlinux = LD $@ cmd_link_vmlinux = $(LD) $(LINKFLAGS) $(HEAD) $(INIT) \ --start-group \ $(CORE_FILES) \ @@ -166,13 +226,13 @@ . scripts/mkversion > .tmpversion mv -f .tmpversion .version $(MAKE) -C init - echo $(cmd_link_vmlinux) + $(call cmd,cmd_link_vmlinux) $(cmd_link_vmlinux) echo 'cmd_$@ := $(cmd_link_vmlinux)' > $(@D)/.$(@F).cmd $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map endef -vmlinux: $(CONFIGURATION) $(vmlinux-objs) FORCE +vmlinux: $(vmlinux-objs) FORCE $(call if_changed_rule,link_vmlinux) # The actual objects are generated when descending, @@ -183,15 +243,14 @@ # Handle descending into subdirectories listed in $(SUBDIRS) .PHONY: $(SUBDIRS) -$(SUBDIRS): prepare +$(SUBDIRS): .hdepend prepare include/config/MARKER @$(MAKE) -C $@ -# Things we need done before we even start the actual build. -# The dependency on .hdepend will in turn take care of -# include/asm, include/linux/version etc. +# Things we need done before we descend to build or make +# module versions are listed in "prepare" .PHONY: prepare -prepare: .hdepend include/config/MARKER +prepare: include/linux/version.h include/asm # Single targets # --------------------------------------------------------------------------- @@ -202,6 +261,8 @@ @$(MAKE) -C $(@D) $(@F) %.o: %.c FORCE @$(MAKE) -C $(@D) $(@F) +%.lst: %.c FORCE + @$(MAKE) -C $(@D) $(@F) %.s: %.S FORCE @$(MAKE) -C $(@D) $(@F) %.o: %.S FORCE @@ -214,14 +275,23 @@ include/asm: @echo 'Making asm->asm-$(ARCH) symlink' @ln -s asm-$(ARCH) $@ - @echo 'Making directory include/linux/modules' - @mkdir include/linux/modules # Split autoconf.h into include/linux/config/* include/config/MARKER: scripts/split-include include/linux/autoconf.h - scripts/split-include include/linux/autoconf.h include/config - @ touch include/config/MARKER + @echo 'Splitting include/linux/autoconf.h -> include/config' + @scripts/split-include include/linux/autoconf.h include/config + @touch $@ + +# if .config is newer than include/linux/autoconf.h, someone tinkered +# with it and forgot to run make oldconfig + +include/linux/autoconf.h: .config + @echo '***' + @echo '*** You changed .config w/o running make *config?' + @echo '*** Please run "make oldconfig"' + @echo '***' + @exit 1 # Generate some files # --------------------------------------------------------------------------- @@ -229,64 +299,77 @@ # version.h changes when $(KERNELRELEASE) etc change, as defined in # this Makefile +uts_len := 64 + include/linux/version.h: Makefile - @echo Generating $@ - @. scripts/mkversion_h $@ $(KERNELRELEASE) $(VERSION) $(PATCHLEVEL) $(SUBLEVEL) + @if expr length "$(KERNELRELEASE)" \> $(uts_len) >/dev/null ; then \ + echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \ + exit 1; \ + fi; + @echo -n 'Generating $@' + @(echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; \ + echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \ + echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \ + ) > $@.tmp + @$(update-if-changed) # Helpers built in scripts/ # --------------------------------------------------------------------------- -scripts/mkdep scripts/split-include : FORCE +scripts/fixdep scripts/split-include : scripts ; + +.PHONY: scripts +scripts: @$(MAKE) -C scripts -# Generate dependencies +# Generate module versions # --------------------------------------------------------------------------- -# In the same pass, generate module versions, that's why it's -# all mixed up here. +# The targets are still named depend / dep for traditional +# reasons, but the only thing we do here is generating +# the module version checksums. +# FIXME: For now, we are also calling "archdep" from here, +# which should be replaced by a more sensible solution. .PHONY: depend dep $(patsubst %,_sfdep_%,$(SUBDIRS)) depend dep: .hdepend -# .hdepend is missing prerequisites - in fact dependencies need -# to be redone basically each time anything changed - since -# that's too expensive, we traditionally rely on the user to -# run "make dep" manually whenever necessary. In this case, -# we make "FORCE" a prequisite, to force redoing the -# dependencies. Yeah, that's ugly, and it'll go away soon. +# .hdepend is our (misnomed) marker for whether we've run +# generated module versions and made archdep + +.hdepend: $(if $(filter dep depend,$(MAKECMDGOALS)),FORCE) + @$(MAKE) archdep include/linux/modversions.h + @touch $@ -.hdepend: scripts/mkdep include/linux/version.h include/asm \ - $(if $(filter dep depend,$(MAKECMDGOALS)),FORCE) - scripts/mkdep -- `find $(FINDHPATH) -name SCCS -prune -o -follow -name \*.h ! -name modversions.h -print` > $@ - @$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) ifdef CONFIG_MODVERSIONS - @$(MAKE) include/linux/modversions.h -endif - @$(MAKE) archdep + +# Update modversions.h, but only if it would change. + +include/linux/modversions.h: scripts/fixdep prepare FORCE + @rm -rf .tmp_export-objs + @$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) + @echo -n 'Generating $@' + @( echo "#ifndef _LINUX_MODVERSIONS_H";\ + echo "#define _LINUX_MODVERSIONS_H"; \ + echo "#include <linux/modsetver.h>"; \ + for f in `cd .tmp_export-objs; find modules -name \*.ver -print`; do \ + echo "#include <linux/$${f}>"; \ + done; \ + echo "#endif"; \ + ) > $@.tmp; \ + $(update-if-changed) $(patsubst %,_sfdep_%,$(SUBDIRS)): FORCE @$(MAKE) -C $(patsubst _sfdep_%, %, $@) fastdep -# Update modversions.h, but only if it would change. +else # !CONFIG_MODVERSIONS -include/linux/modversions.h: FORCE - @(echo "#ifndef _LINUX_MODVERSIONS_H";\ - echo "#define _LINUX_MODVERSIONS_H"; \ - echo "#include <linux/modsetver.h>"; \ - cd $(TOPDIR)/include/linux/modules; \ - for f in *.ver; do \ - if [ -f $$f ]; then echo "#include <linux/modules/$${f}>"; fi; \ - done; \ - echo "#endif"; \ - ) > $@.tmp - @if [ -r $@ ] && cmp -s $@ $@.tmp; then \ - echo $@ was not updated; \ - rm -f $@.tmp; \ - else \ - echo $@ was updated; \ - mv -f $@.tmp $@; \ - fi +.PHONY: include/linux/modversions.h + +include/linux/modversions.h: + +endif # CONFIG_MODVERSIONS # --------------------------------------------------------------------------- # Modules @@ -300,11 +383,8 @@ endif .PHONY: modules -modules: $(patsubst %, _mod_%, $(SUBDIRS)) - -.PHONY: $(patsubst %, _mod_%, $(SUBDIRS)) -$(patsubst %, _mod_%, $(SUBDIRS)) : include/linux/version.h include/config/MARKER - @$(MAKE) -C $(patsubst _mod_%, %, $@) modules +modules: + @$(MAKE) KBUILD_BUILTIN= $(SUBDIRS) # Install modules @@ -369,7 +449,7 @@ TAGS: FORCE { find include/asm-${ARCH} -name '*.h' -print ; \ find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print ; \ - find $(SUBDIRS) init -name '*.[ch]' ; } | grep -v SCCS | etags - + find $(SUBDIRS) init arch/${ARCH} -name '*.[chS]' ; } | grep -v SCCS | etags - # Exuberant ctags works better with -I tags: FORCE @@ -412,28 +492,82 @@ rpm -ta $(TOPDIR)/../$(KERNELPATH).tar.gz ; \ rm $(TOPDIR)/../$(KERNELPATH).tar.gz +else # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) + # Targets which don't need .config # =========================================================================== +# +# These targets basically have their own Makefile - not quite, but at +# least its own exclusive section in the same Makefile. The reason for +# this is the following: +# To know the configuration, the main Makefile has to include +# .config. That's a obviously a problem when .config doesn't exist +# yet, but that could be kludged around with only including it if it +# exists. +# However, the larger problem is: If you run make *config, make will +# include the old .config, then execute your *config. It will then +# notice that a piece it included (.config) did change and restart from +# scratch. Which will cause execution of *config again. You get the +# picture. +# If we don't explicitly let the Makefile know that .config is changed +# by *config (the old way), it won't reread .config after *config, +# thus working with possibly stale values - we don't that either. +# +# So we divide things: This part here is for making *config targets, +# and other targets which should work when no .config exists yet. +# The main part above takes care of the rest after a .config exists. # Kernel configuration # --------------------------------------------------------------------------- -.PHONY: oldconfig xconfig menuconfig config - -oldconfig: - $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in +.PHONY: oldconfig xconfig menuconfig config \ + make_with_config xconfig: @$(MAKE) -C scripts kconfig.tk wish -f scripts/kconfig.tk menuconfig: - @$(MAKE) -C scripts/lxdialog all + @$(MAKE) -C scripts lxdialog $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in config: $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in +oldconfig: + $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in + +randconfig: + $(CONFIG_SHELL) scripts/Configure -r arch/$(ARCH)/config.in + +allyesconfig: + $(CONFIG_SHELL) scripts/Configure -y arch/$(ARCH)/config.in + +allnoconfig: + $(CONFIG_SHELL) scripts/Configure -n arch/$(ARCH)/config.in + +allmodconfig: + $(CONFIG_SHELL) scripts/Configure -m arch/$(ARCH)/config.in + +defconfig: + yes '' | $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in + +# How we generate .config depends on which *config the +# user chose when calling make + +.config: $(filter oldconfig xconfig menuconfig config,$(MAKECMDGOALS)) ; + +# If the user gave commands from both the need / need not +# .config sections, we need to call make again after +# .config is generated, now to take care of the remaining +# targets we know nothing about in this section + +remaining_targets := $(filter-out $(noconfig_targets),$(MAKECMDGOALS)) + +$(remaining_targets) : make_with_config + +make_with_config: .config + @$(MAKE) $(remaining_targets) # Cleaning up # --------------------------------------------------------------------------- @@ -461,10 +595,6 @@ net/khttpd/times.h \ submenu* -# directories removed with 'make clean' -CLEAN_DIRS += \ - modules - # files removed with 'make mrproper' MRPROPER_FILES += \ include/linux/autoconf.h include/linux/version.h \ @@ -483,34 +613,43 @@ scripts/lxdialog/*.o scripts/lxdialog/lxdialog \ .menuconfig.log \ include/asm \ - .hdepend scripts/mkdep scripts/split-include scripts/docproc \ - $(TOPDIR)/include/linux/modversions.h \ - kernel.spec + .hdepend scripts/split-include scripts/docproc \ + scripts/fixdep $(TOPDIR)/include/linux/modversions.h \ + tags TAGS kernel.spec \ # directories removed with 'make mrproper' MRPROPER_DIRS += \ include/config \ $(TOPDIR)/include/linux/modules +# That's our way to know about arch specific cleanup. + +include arch/$(ARCH)/Makefile clean: archclean - find . \( -name '*.[oas]' -o -name core -o -name '.*.cmd' \) -type f -print \ + @echo 'Cleaning up' + @find . \( -name \*.[oas] -o -name core -o -name .\*.cmd -o \ + -name .\*.tmp -o -name .\*.d \) -type f -print \ | grep -v lxdialog/ | xargs rm -f - rm -f $(CLEAN_FILES) - rm -rf $(CLEAN_DIRS) + @rm -rf $(CLEAN_FILES) @$(MAKE) -C Documentation/DocBook clean mrproper: clean archmrproper - find . \( -size 0 -o -name .depend \) -type f -print | xargs rm -f - rm -f $(MRPROPER_FILES) - rm -rf $(MRPROPER_DIRS) + @echo 'Making mrproper' + @find . \( -size 0 -o -name .depend \) -type f -print | xargs rm -f + @rm -f $(MRPROPER_FILES) + @rm -rf $(MRPROPER_DIRS) @$(MAKE) -C Documentation/DocBook mrproper distclean: mrproper - rm -f core `find . \( -not -type d \) -and \ - \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ + @echo 'Making distclean' + @find . \( -not -type d \) -and \ + \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ - -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f -print` TAGS tags + -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f \ + -print | xargs rm -f + +endif # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) # FIXME Should go into a make.lib or something # =========================================================================== @@ -530,5 +669,20 @@ $(filter-out $(cmd_$(1)),$(cmd_$(@F)))\ $(filter-out $(cmd_$(@F)),$(cmd_$(1)))),\ @$(rule_$(1))) + +# If quiet is set, only print short version of rule + +cmd = @$(if $($(quiet)$(1)),echo ' $($(quiet)$(1))' &&) $($(1)) + +define update-if-changed + if [ -r $@ ] && cmp -s $@ $@.tmp; then \ + echo ' (unchanged)'; \ + rm -f $@.tmp; \ + else \ + echo ' (updated)'; \ + mv -f $@.tmp $@; \ + fi +endef + FORCE: |