From: Kenn H. <ke...@us...> - 2003-01-09 22:01:23
|
Update of /cvsroot/linux-vax/kernel-2.5 In directory sc8-pr-cvs1:/tmp/cvs-serv15808 Modified Files: Makefile Rules.make Log Message: Merge with 2.5.18 Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/Makefile,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- Makefile 7 Jan 2003 00:33:40 -0000 1.21 +++ Makefile 9 Jan 2003 22:01:10 -0000 1.22 @@ -1,6 +1,6 @@ VERSION = 2 PATCHLEVEL = 5 -SUBLEVEL = 17 +SUBLEVEL = 18 EXTRAVERSION = KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) @@ -37,15 +37,21 @@ MAKEFILES = $(TOPDIR)/.config GENKSYMS = /sbin/genksyms DEPMOD = /sbin/depmod +PERL = perl MODFLAGS = -DMODULE +CFLAGS_MODULE = $(MODFLAGS) +AFLAGS_MODULE = CFLAGS_KERNEL = AFLAGS_KERNEL = -PERL = perl -#MAKE = make -j3 +EXPORT_FLAGS = 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 MODFLAGS PERL + CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS PERL + +export CPPFLAGS EXPORT_FLAGS +export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE +export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE all: do-it-all @@ -93,6 +99,10 @@ -fomit-frame-pointer -fno-strict-aliasing -fno-common AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS) +ifdef CONFIG_MODULES +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 @@ -114,10 +124,10 @@ drivers/misc/misc.o \ drivers/net/net.o \ drivers/media/media.o -DRIVERS-$(CONFIG_NUBUS) += drivers/nubus/nubus.a +DRIVERS-$(CONFIG_NUBUS) += drivers/nubus/built-in.o DRIVERS-$(CONFIG_ATM) += drivers/atm/atm.o DRIVERS-$(CONFIG_IDE) += drivers/ide/idedriver.o -DRIVERS-$(CONFIG_FC4) += drivers/fc4/fc4.a +DRIVERS-$(CONFIG_FC4) += drivers/fc4/built-in.o DRIVERS-$(CONFIG_SCSI) += drivers/scsi/scsidrv.o DRIVERS-$(CONFIG_FUSION) += drivers/message/message.o DRIVERS-$(CONFIG_IEEE1394) += drivers/ieee1394/ieee1394drv.o @@ -129,16 +139,16 @@ DRIVERS-$(CONFIG_SOUND) += sound/sound.o DRIVERS-$(CONFIG_MTD) += drivers/mtd/mtdlink.o DRIVERS-$(CONFIG_PCMCIA) += drivers/pcmcia/pcmcia.o -DRIVERS-$(CONFIG_DIO) += drivers/dio/dio.a +DRIVERS-$(CONFIG_DIO) += drivers/dio/built-in.o DRIVERS-$(CONFIG_SBUS) += drivers/sbus/sbus_all.o DRIVERS-$(CONFIG_ZORRO) += drivers/zorro/driver.o DRIVERS-$(CONFIG_ALL_PPC) += drivers/macintosh/macintosh.o DRIVERS-$(CONFIG_MAC) += drivers/macintosh/macintosh.o DRIVERS-$(CONFIG_PNP) += drivers/pnp/pnp.o -DRIVERS-$(CONFIG_SGI_IP22) += drivers/sgi/sgi.a +DRIVERS-$(CONFIG_SGI_IP22) += drivers/sgi/built-in.o DRIVERS-$(CONFIG_VT) += drivers/video/video.o -DRIVERS-$(CONFIG_PARIDE) += drivers/block/paride/paride.a -DRIVERS-$(CONFIG_TC) += drivers/tc/tc.a +DRIVERS-$(CONFIG_PARIDE) += drivers/block/paride/built-in.o +DRIVERS-$(CONFIG_TC) += drivers/tc/built-in.o DRIVERS-$(CONFIG_USB) += drivers/usb/usbdrv.o DRIVERS-$(CONFIG_INPUT) += drivers/input/inputdrv.o DRIVERS-$(CONFIG_GAMEPORT) += drivers/input/gameport/gamedrv.o @@ -163,18 +173,27 @@ include arch/$(ARCH)/Makefile -export CPPFLAGS CFLAGS CFLAGS_KERNEL AFLAGS AFLAGS_KERNEL - export NETWORKS DRIVERS LIBS HEAD LDFLAGS LINKFLAGS MAKEBOOT ASFLAGS -# Build vmlinux / boot target +# boot target # --------------------------------------------------------------------------- boot: vmlinux @$(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" AFLAGS="$(AFLAGS) $(AFLAGS_KERNEL)" -C arch/$(ARCH)/boot -vmlinux: include/linux/version.h $(CONFIGURATION) linuxsubdirs - $(LD) $(LINKFLAGS) $(HEAD) $(INIT) \ +# Build vmlinux +# --------------------------------------------------------------------------- + +# This is a bit tricky: If we need to relink vmlinux, we want +# the version number incremented, which means recompile init/version.o +# and relink init/init.o. However, we cannot do this during the +# normal descending-into-subdirs phase, since at that time +# we cannot yet know if we will need to relink vmlinux. +# So we descend into init/ inside the rule for vmlinux again. + +vmlinux-objs := $(HEAD) $(INIT) $(CORE_FILES) $(LIBS) $(DRIVERS) $(NETWORKS) + +cmd_link_vmlinux = $(LD) $(LINKFLAGS) $(HEAD) $(INIT) \ --start-group \ $(CORE_FILES) \ $(LIBS) \ @@ -182,10 +201,33 @@ $(NETWORKS) \ --end-group \ -o vmlinux + +# set -e makes the rule exit immediately on error + +define rule_link_vmlinux + set -e + echo Generating build number + . scripts/mkversion > .tmpversion + mv -f .tmpversion .version + $(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" AFLAGS="$(AFLAGS) $(AFLAGS_KERNEL)" -C init + echo $(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) dummy + $(call if_changed_rule,link_vmlinux) + +# The actual objects are generated when descending, make sure +# no implicit rule kicks in + +$(sort $(vmlinux-objs)): linuxsubdirs + @ # Handle descending into subdirectories listed in $(SUBDIRS) +.PHONY: linuxsubdirs linuxsubdirs: $(patsubst %, _dir_%, $(SUBDIRS)) $(patsubst %, _dir_%, $(SUBDIRS)) : dummy include/linux/version.h include/config/MARKER @@ -222,8 +264,6 @@ include/config/MARKER: scripts/split-include include/linux/autoconf.h scripts/split-include include/linux/autoconf.h include/config @ touch include/config/MARKER - . scripts/mkversion > .tmpversion - @mv -f .tmpversion .version # Generate some files @@ -263,7 +303,7 @@ .PHONY: $(patsubst %, _mod_%, $(SUBDIRS)) $(patsubst %, _mod_%, $(SUBDIRS)) : include/linux/version.h include/config/MARKER - @$(MAKE) -C $(patsubst _mod_%, %, $@) CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules + @$(MAKE) -C $(patsubst _mod_%, %, $@) CFLAGS="$(CFLAGS) $(CFLAGS_MODULE)" AFLAGS="$(AFLAGS) $(AFLAGS_MODULE)" modules # Install modules @@ -338,6 +378,8 @@ drivers/zorro/devlist.h drivers/zorro/gen-devlist \ sound/oss/bin2hex sound/oss/hex2hex \ drivers/atm/fore200e_mkfirm drivers/atm/{pca,sba}*{.bin,.bin1,.bin2} \ + drivers/scsi/aic7xxx/aic7xxx_seq.h \ + drivers/scsi/aic7xxx/aic7xxx_reg.h \ drivers/scsi/aic7xxx/aicasm/aicasm_gram.c \ drivers/scsi/aic7xxx/aicasm/aicasm_scan.c \ drivers/scsi/aic7xxx/aicasm/y.tab.h \ @@ -476,3 +518,12 @@ sums: find . -type f -print | sort | xargs sum > .SUMS + +# FIXME Should go into a make.lib or something +# --------------------------------------------------------------------------- + +if_changed_rule = $(if $(strip $? \ + $(filter-out $(cmd_$(1)),$(cmd_$(@F)))\ + $(filter-out $(cmd_$(@F)),$(cmd_$(1)))),\ + @$(rule_$(1))) + Index: Rules.make =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/Rules.make,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- Rules.make 7 Jan 2003 00:30:56 -0000 1.9 +++ Rules.make 9 Jan 2003 22:01:14 -0000 1.10 @@ -29,25 +29,80 @@ unexport subdir-m unexport subdir-n unexport subdir- +unexport mod-subdirs comma := , -# +# Figure out what we need to build from the various variables +# =========================================================================== + # When an object is listed to be built compiled-in and modular, # only build the compiled-in version -# + obj-m := $(filter-out $(obj-y),$(obj-m)) -# -# Get things started. -# -first_rule: all_targets +# Handle objects in subdirs +# --------------------------------------------------------------------------- +# o if we encounter foo/ in $(obj-y), replace it by foo/built-in.o +# and add the directory to the list of dirs to descend into: $(subdir-y) +# o if we encounter foo/ in $(obj-m), remove it from $(obj-m) +# and add the directory to the list of dirs to descend into: $(subdir-m) + +__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) +subdir-y += $(__subdir-y) +__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) +subdir-m += $(__subdir-m) +__subdir-n := $(patsubst %/,%,$(filter %/, $(obj-n))) +subdir-n += $(__subdir-n) +__subdir- := $(patsubst %/,%,$(filter %/, $(obj-))) +subdir- += $(__subdir-) +obj-y := $(patsubst %/, %/built-in.o, $(obj-y)) +obj-m := $(filter-out %/, $(obj-m)) + +# If a dir is selected in $(subdir-y) and also mentioned in $(mod-subdirs), +# add it to $(subdir-m) both-m := $(filter $(mod-subdirs), $(subdir-y)) SUB_DIRS := $(subdir-y) MOD_SUB_DIRS := $(sort $(subdir-m) $(both-m)) ALL_SUB_DIRS := $(sort $(subdir-y) $(subdir-m) $(subdir-n) $(subdir-)) +# export.o is never a composite object, since $(export-objs) has a +# fixed meaning (== objects which EXPORT_SYMBOL()) +__obj-y = $(filter-out export.o,$(obj-y)) +__obj-m = $(filter-out export.o,$(obj-m)) + +# if $(foo-objs) exists, foo.o is a composite object +__multi-used-y := $(sort $(foreach m,$(__obj-y), $(if $($(m:.o=-objs)), $(m)))) +__multi-used-m := $(sort $(foreach m,$(__obj-m), $(if $($(m:.o=-objs)), $(m)))) + +# FIXME: Rip this out later +# Backwards compatibility: if a composite object is listed in +# $(list-multi), skip it here, since the Makefile will have an explicit +# link rule for it + +multi-used-y := $(filter-out $(list-multi),$(__multi-used-y)) +multi-used-m := $(filter-out $(list-multi),$(__multi-used-m)) + +# Build list of the parts of our composite objects, our composite +# objects depend on those (obviously) +multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs))) +multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs))) + +# $(subdir-obj-y) is the list of objects in $(obj-y) which do not live +# in the local directory +subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o))) + +# Replace multi-part objects by their individual parts, look at local dir only +real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $($(m:.o=-objs)),$($(m:.o=-objs)),$(m))) +real-objs-m := $(foreach m, $(obj-m), $(if $($(m:.o=-objs)),$($(m:.o=-objs)),$(m))) + +# ========================================================================== +# +# Get things started. +# +first_rule: all_targets + # # Common rules # @@ -55,7 +110,10 @@ # define listing_o_c to get compiler listings from .c -> .o compilations listing_o_c = -Wa,-adnhls=$(subst $(comma),_,$(subst -,_,$(*F))).lst -g -# export_flags will be set to -DEXPORT_SYMBOL for objects in $(export-objs) +# Compile C sources (.c) +# --------------------------------------------------------------------------- + +$(export-objs): export_flags := $(EXPORT_FLAGS) c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(export_flags) @@ -74,11 +132,8 @@ %.o: %.c dummy $(call if_changed,cmd_cc_o_c) -# Old makefiles define their own rules for compiling .S files, -# but these standard rules are available for any Makefile that -# wants to use them. Our plan is to incrementally convert all -# the Makefiles to these standard rules. -- rmk, mec -ifdef USE_STANDARD_AS_RULE +# Compile assembler sources (.S) +# --------------------------------------------------------------------------- a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) @@ -92,24 +147,28 @@ %.o: %.S dummy $(call if_changed,cmd_as_o_S) -endif - -# FIXME is anybody using this rule? Why does it have EXTRA_CFLAGS? -%.o: %.s - $(AS) $(AFLAGS) $(EXTRA_CFLAGS) -o $@ $< +# FIXME %.lst: %.c $(CC) $(c_flags) -g -c -o $*.o $< $(TOPDIR)/scripts/makelst $* $(TOPDIR) $(OBJDUMP) -# -# -# + + +# If a Makefile does define neither O_TARGET nor L_TARGET, +# use a standard O_TARGET named "built-in.o" + +ifndef O_TARGET +ifndef L_TARGET +O_TARGET := built-in.o +endif +endif + +# Build the compiled-in targets +# --------------------------------------------------------------------------- + all_targets: $(O_TARGET) $(L_TARGET) sub_dirs -# $(subdir-obj-y) is the list of objects in $(obj-y) which do not live -# in the local directory -subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o))) -# Do build these objects, we need to descend into the directories +# To build objects in subdirs, we need to descend into the directories $(subdir-obj-y): sub_dirs # @@ -139,26 +198,6 @@ # Rule to link composite objects # -# export.o is never a composite object, since $(export-objs) has a -# fixed meaning (== objects which EXPORT_SYMBOL()) -__obj-y = $(filter-out export.o,$(obj-y)) -__obj-m = $(filter-out export.o,$(obj-m)) - -# if $(foo-objs) exists, foo.o is a composite object -__multi-used-y := $(sort $(foreach m,$(__obj-y), $(if $($(basename $(m))-objs), $(m)))) -__multi-used-m := $(sort $(foreach m,$(__obj-m), $(if $($(basename $(m))-objs), $(m)))) - -# Backwards compatibility: if a composite object is listed in -# $(list-multi), skip it here, since the Makefile will have an explicit -# link rule for it - -multi-used-y := $(filter-out $(list-multi),$(__multi-used-y)) -multi-used-m := $(filter-out $(list-multi),$(__multi-used-m)) - -# Build list of the parts of our composite objects, our composite -# objects depend on those (obviously) -multi-objs-y := $(foreach m, $(multi-used-y), $($(basename $(m))-objs)) -multi-objs-m := $(foreach m, $(multi-used-m), $($(basename $(m))-objs)) cmd_link_multi = $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs),$^) @@ -322,7 +361,6 @@ ifneq "$(strip $(export-objs))" "" $(export-objs): $(TOPDIR)/include/linux/modversions.h -$(export-objs): export_flags := -DEXPORT_SYMTAB endif @@ -381,7 +419,7 @@ # function to only execute the passed command if necessary if_changed = $(if $(strip $? \ - $(filter-out $($(1)),$(cmd_$@))\ - $(filter-out $(cmd_$@),$($(1)))),\ - @echo $($(1)); $($(1)); echo 'cmd_$@ := $($(1))' > .$@.cmd) + $(filter-out $($(1)),$(cmd_$(@F)))\ + $(filter-out $(cmd_$(@F)),$($(1)))),\ + @echo '$($(1))' && $($(1)) && echo 'cmd_$@ := $($(1))' > $(@D)/.$(@F).cmd) |