From: Kenn H. <ke...@us...> - 2003-03-20 00:44:45
|
Update of /cvsroot/linux-vax/kernel-2.5 In directory sc8-pr-cvs1:/tmp/cvs-serv20238 Modified Files: Makefile Rules.make Log Message: Merge with 2.5.41 Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/Makefile,v retrieving revision 1.47 retrieving revision 1.48 diff -u -r1.47 -r1.48 --- Makefile 14 Mar 2003 00:38:44 -0000 1.47 +++ Makefile 20 Mar 2003 00:44:41 -0000 1.48 @@ -1,6 +1,6 @@ VERSION = 2 PATCHLEVEL = 5 -SUBLEVEL = 40 +SUBLEVEL = 41 EXTRAVERSION = # *DOCUMENTATION* @@ -52,13 +52,6 @@ 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. # Normally, just do built-in. @@ -88,7 +81,7 @@ KBUILD_MODULES := 1 endif -export KBUILD_MODULES KBUILD_BUILTIN +export KBUILD_MODULES KBUILD_BUILTIN KBUILD_VERBOSE # Beautify output # --------------------------------------------------------------------------- @@ -105,12 +98,19 @@ # If it is set to "silent_", nothing wil be printed at all, since # the variable $(silent_cmd_cc_o_c) doesn't exist. +# For now, leave verbose as default + +ifndef KBUILD_VERBOSE + KBUILD_VERBOSE = 1 +endif + +MAKEFLAGS += --no-print-directory + # If the user wants quiet mode, echo short versions of the commands -# only and suppress the 'Entering/Leaving directory' messages +# only ifneq ($(KBUILD_VERBOSE),1) quiet=quiet_ - MAKEFLAGS += --no-print-directory endif # If the user is running make -s (silent mode), suppress echoing of @@ -120,11 +120,18 @@ quiet=silent_ endif -export quiet +export quiet KBUILD_VERBOSE -# -# Include the make variables (CC, etc...) -# +# Paths to obj / src tree + +src := . +obj := . +srctree := . +objtree := . + +export srctree objtree + +# Make variables (CC, etc...) AS = $(CROSS_COMPILE)as LD = $(CROSS_COMPILE)ld @@ -145,24 +152,21 @@ AFLAGS_MODULE = $(MODFLAGS) CFLAGS_KERNEL = AFLAGS_KERNEL = -EXPORT_FLAGS = NOSTDINC_FLAGS = -nostdinc -iwithprefix include +CPPFLAGS := -D__KERNEL__ -Iinclude +CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \ + -fomit-frame-pointer -fno-strict-aliasing -fno-common +AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS) + export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \ CONFIG_SHELL TOPDIR HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS PERL -export CPPFLAGS EXPORT_FLAGS NOSTDINC_FLAGS OBJCOPYFLAGS +export CPPFLAGS NOSTDINC_FLAGS OBJCOPYFLAGS LDFLAGS export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE -src := . -obj := . -srctree := $(TOPDIR) -objtree := $(TOPDIR) - -export srctree objtree - # The temporary file to save gcc -MD generated dependencies must not # contain a comma depfile = $(subst $(comma),_,$(@D)/.$(@F).d) @@ -183,10 +187,46 @@ .PHONY: scripts scripts: - @$(MAKE) -C scripts + +@$(call descend,scripts,) + +# Objects we will link into vmlinux / subdirs we need to visit +# --------------------------------------------------------------------------- + +init-y := init/ +drivers-y := drivers/ sound/ +net-y := net/ +libs-y := lib/ +core-y := +SUBDIRS := ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) +include-config := 1 + +-include .config + +endif + +include arch/$(ARCH)/Makefile + +core-y += kernel/ mm/ fs/ ipc/ security/ + +SUBDIRS += $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ + $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ + $(net-y) $(net-m) $(libs-y) $(libs-m))) + +ALL_SUBDIRS := $(SUBDIRS) $(patsubst %/,%,$(filter %/, $(init-n) $(init-) \ + $(core-n) $(core-) $(drivers-n) $(drivers-) \ + $(net-n) $(net-) $(libs-n) $(libs-))) + +init-y := $(patsubst %/, %/built-in.o, $(init-y)) +core-y := $(patsubst %/, %/built-in.o, $(core-y)) +drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y)) +net-y := $(patsubst %/, %/built-in.o, $(net-y)) +libs-y := $(patsubst %/, %/lib.a, $(libs-y)) + +ifdef include-config + # Here goes the main Makefile # =========================================================================== # @@ -197,8 +237,6 @@ # In this section, we need .config --include .config - # If .config doesn't exist - tough luck .config: arch/$(ARCH)/config.in $(shell find . -name Config.in) @@ -215,6 +253,10 @@ @echo '***' @exit 1 +ifdef CONFIG_MODULES +export EXPORT_FLAGS := -DEXPORT_SYMTAB +endif + # # INSTALL_PATH specifies where to place the updated kernel and system map # images. Uncomment if you want to place them anywhere other than root. @@ -231,57 +273,6 @@ MODLIB := $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) export MODLIB -# -# standard CFLAGS -# - -CPPFLAGS := -D__KERNEL__ -I$(objtree)/include - -CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \ - -fomit-frame-pointer -fno-strict-aliasing -fno-common -AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS) - -ifdef CONFIG_MODULES -EXPORT_FLAGS := -DEXPORT_SYMTAB -endif - -# Link components for vmlinux -# --------------------------------------------------------------------------- - -init-y := init/ -drivers-y := drivers/ sound/ -networks-y := net/ -libs-y := lib/ - -CORE_FILES := kernel/built-in.o mm/built-in.o fs/built-in.o \ - ipc/built-in.o security/built-in.o -SUBDIRS += kernel mm fs ipc security - -include arch/$(ARCH)/Makefile - -SUBDIRS += $(patsubst %/,%,$(filter %/, $(init-y) $(init-m))) -INIT += $(patsubst %/, %/built-in.o, $(init-y)) - -SUBDIRS += $(patsubst %/,%,$(filter %/, $(core-y) $(core-m))) -CORE_FILES := $(patsubst %/, %/built-in.o, $(core-y)) $(CORE_FILES) - -SUBDIRS += $(patsubst %/,%,$(filter %/, $(drivers-y) $(drivers-m))) -DRIVERS += $(patsubst %/, %/built-in.o, $(drivers-y)) - -SUBDIRS += $(patsubst %/,%,$(filter %/, $(networks-y) $(networks-m))) -NETWORKS += $(patsubst %/, %/built-in.o, $(networks-y)) - -SUBDIRS += $(patsubst %/,%,$(filter %/, $(libs-y) $(libs-m))) -LIBS += $(patsubst %/, %/lib.a, $(libs-y)) - -export NETWORKS DRIVERS LIBS HEAD LDFLAGS MAKEBOOT - -# boot target -# --------------------------------------------------------------------------- - -boot: vmlinux - @$(MAKE) -C arch/$(ARCH)/boot - # Build vmlinux # --------------------------------------------------------------------------- @@ -292,60 +283,71 @@ # 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) +vmlinux-objs := $(HEAD) $(init-y) $(core-y) $(libs-y) $(drivers-y) $(net-y) -quiet_cmd_link_vmlinux = LD $@ -define cmd_link_vmlinux - $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) $(HEAD) $(INIT) \ +quiet_cmd_vmlinux__ = LD $@ +define cmd_vmlinux__ + $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) $(HEAD) $(init-y) \ --start-group \ - $(CORE_FILES) \ - $(LIBS) \ - $(DRIVERS) \ - $(NETWORKS) \ + $(core-y) \ + $(libs-y) \ + $(drivers-y) \ + $(net-y) \ --end-group \ - $(filter $(kallsyms.o),$^) \ + $(filter .tmp_kallsyms%,$^) \ -o $@ endef # set -e makes the rule exit immediately on error -define rule_vmlinux +define rule_vmlinux__ set -e - echo ' Generating build number' - . scripts/mkversion > .tmp_version - mv -f .tmp_version .version - +$(MAKE) -C init - $(call cmd,link_vmlinux) - echo 'cmd_$@ := $(cmd_link_vmlinux)' > $(@D)/.$(@F).cmd + $(if $(filter .tmp_kallsyms%,$^),, + echo ' Generating build number' + . scripts/mkversion > .tmp_version + mv -f .tmp_version .version + +$(call descend,init,) + ) + $(call cmd,vmlinux__) + echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd +endef + +define rule_vmlinux + $(rule_vmlinux__) $(NM) $@ | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map endef LDFLAGS_vmlinux += -T arch/$(ARCH)/vmlinux.lds.s # Generate section listing all symbols and add it into vmlinux +# It's a three stage process: +# o .tmp_vmlinux1 has all symbols and sections, but __kallsyms is +# empty +# Running kallsyms on that gives as .tmp_kallsyms1.o with +# the right size +# o .tmp_vmlinux2 now has a __kallsyms section of the right size, +# but due to the added section, some addresses have shifted +# From here, we generate a correct .tmp_kallsyms2.o +# o The correct .tmp_kallsyms2.o is linked into the final vmlinux. ifdef CONFIG_KALLSYMS -kallsyms.o := .tmp_kallsyms.o +kallsyms.o := .tmp_kallsyms2.o quiet_cmd_kallsyms = KSYM $@ cmd_kallsyms = $(KALLSYMS) $< > $@ -.tmp_kallsyms.o: .tmp_vmlinux +.tmp_kallsyms1.o: .tmp_vmlinux1 $(call cmd,kallsyms) -# After generating .tmp_vmlinux just like vmlinux, decrement the version -# number again, so the final vmlinux gets the same one. -# Ignore return value of 'expr'. - -define rule_.tmp_vmlinux - $(rule_vmlinux) - if expr 0`cat .version` - 1 > .tmp_version; then true; fi - mv -f .tmp_version .version -endef +.tmp_kallsyms2.o: .tmp_vmlinux2 + $(call cmd,kallsyms) -.tmp_vmlinux: $(vmlinux-objs) arch/$(ARCH)/vmlinux.lds.s FORCE - $(call if_changed_rule,.tmp_vmlinux) +.tmp_vmlinux1: $(vmlinux-objs) arch/$(ARCH)/vmlinux.lds.s FORCE + $(call if_changed_rule,vmlinux__) + +.tmp_vmlinux2: $(vmlinux-objs) .tmp_kallsyms1.o arch/$(ARCH)/vmlinux.lds.s FORCE + $(call if_changed_rule,vmlinux__) endif @@ -363,7 +365,7 @@ .PHONY: $(SUBDIRS) $(SUBDIRS): .hdepend prepare - @$(MAKE) -C $@ + +@$(call descend,$@,) # Things we need done before we descend to build or make # module versions are listed in "prepare" @@ -377,7 +379,7 @@ AFLAGS_vmlinux.lds.o += -P -C -U$(ARCH) -arch/$(ARCH)/vmlinux.lds.s: arch/$(ARCH)/vmlinux.lds.S scripts FORCE +arch/$(ARCH)/vmlinux.lds.s: %.s: %.S scripts FORCE $(call if_changed_dep,as_s_S) targets += arch/$(ARCH)/vmlinux.lds.s @@ -386,17 +388,17 @@ # --------------------------------------------------------------------------- %.s: %.c FORCE - @$(MAKE) -C $(@D) $(@F) + +@$(call descend,$(@D),$@) %.i: %.c FORCE - @$(MAKE) -C $(@D) $(@F) + +@$(call descend,$(@D),$@) %.o: %.c FORCE - @$(MAKE) -C $(@D) $(@F) + +@$(call descend,$(@D),$@) %.lst: %.c FORCE - @$(MAKE) -C $(@D) $(@F) + +@$(call descend,$(@D),$@) %.s: %.S FORCE - @$(MAKE) -C $(@D) $(@F) + +@$(call descend,$(@D),$@) %.o: %.S FORCE - @$(MAKE) -C $(@D) $(@F) + +@$(call descend,$(@D),$@) # FIXME: The asm symlink changes when $(ARCH) changes. That's # hard to detect, but I suppose "make mrproper" is a good idea @@ -481,7 +483,7 @@ $(update-if-changed) $(patsubst %,_sfdep_%,$(SUBDIRS)): FORCE - @$(MAKE) -C $(patsubst _sfdep_%, %, $@) fastdep + +@$(call descend,$(patsubst _sfdep_%,%,$@),fastdep) else # !CONFIG_MODVERSIONS @@ -499,7 +501,7 @@ # Build modules ifdef CONFIG_MODVERSIONS -MODFLAGS += -include $(objtree)/include/linux/modversions.h +MODFLAGS += -include include/linux/modversions.h endif .PHONY: modules @@ -533,7 +535,7 @@ .PHONY: $(patsubst %, _modinst_%, $(SUBDIRS)) $(patsubst %, _modinst_%, $(SUBDIRS)) : - @$(MAKE) -C $(patsubst _modinst_%, %, $@) modules_install + +@$(call descend,$(patsubst _modinst_%,%,$@),modules_install) else # CONFIG_MODULES @@ -597,7 +599,7 @@ rpm -ta $(TOPDIR)/../$(KERNELPATH).tar.gz ; \ rm $(TOPDIR)/../$(KERNELPATH).tar.gz -else # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) +else # ifdef include-config ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),) @@ -631,11 +633,11 @@ make_with_config xconfig: - @$(MAKE) -C scripts kconfig.tk + +@$(call descend,scripts,scripts/kconfig.tk) wish -f scripts/kconfig.tk menuconfig: - @$(MAKE) -C scripts lxdialog + +@$(call descend,scripts,lxdialog) $(CONFIG_SHELL) $(src)/scripts/Menuconfig arch/$(ARCH)/config.in config: @@ -704,7 +706,7 @@ .version .config* config.in config.old \ .menuconfig.log \ include/asm \ - .hdepend $(TOPDIR)/include/linux/modversions.h \ + .hdepend include/linux/modversions.h \ tags TAGS kernel.spec \ .tmp* @@ -712,11 +714,7 @@ MRPROPER_DIRS += \ .tmp_export-objs \ include/config \ - $(TOPDIR)/include/linux/modules - -# That's our way to know about arch specific cleanup. - -include arch/$(ARCH)/Makefile + include/linux/modules clean: archclean @echo 'Cleaning up' @@ -725,7 +723,7 @@ -name .\*.tmp -o -name .\*.d \) -type f -print \ | grep -v lxdialog/ | xargs rm -f @rm -f $(CLEAN_FILES) - @$(MAKE) -f Documentation/DocBook/Makefile clean + +@$(call descend,Documentation/DocBook,clean) mrproper: clean archmrproper @echo 'Making mrproper' @@ -734,8 +732,8 @@ -type f -print | xargs rm -f @rm -rf $(MRPROPER_DIRS) @rm -f $(MRPROPER_FILES) - @$(MAKE) -C scripts mrproper - @$(MAKE) -f Documentation/DocBook/Makefile mrproper + +@$(call descend,scripts,mrproper) + +@$(call descend,Documentation/DocBook,mrproper) distclean: mrproper @echo 'Making distclean' @@ -822,7 +820,7 @@ # Documentation targets # --------------------------------------------------------------------------- sgmldocs psdocs pdfdocs htmldocs: scripts - @$(MAKE) -f Documentation/DocBook/Makefile $@ + +@$(call descend,Documentation/DocBook,$@) # Scripts to check various things for consistency # --------------------------------------------------------------------------- @@ -852,10 +850,11 @@ $(MAKE) $@ endif # ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),) -endif # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) +endif # ifdef include-config # FIXME Should go into a make.lib or something # =========================================================================== + echo_target = $@ a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(NOSTDINC_FLAGS) \ @@ -909,5 +908,12 @@ fi endef +# $(call descend,<dir>,<target>) +# Recursively call a sub-make in <dir> with target <target> + +ifeq ($(KBUILD_VERBOSE),1) +descend = echo '$(MAKE) -f $(1)/Makefile $(2)'; +endif +descend += $(MAKE) -f $(1)/Makefile obj=$(1) $(2) FORCE: Index: Rules.make =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/Rules.make,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- Rules.make 14 Mar 2003 00:38:44 -0000 1.21 +++ Rules.make 20 Mar 2003 00:44:42 -0000 1.22 @@ -8,23 +8,38 @@ empty := space := $(empty) $(empty) -# Figure out paths +# Some bug traps # --------------------------------------------------------------------------- -# Find the path relative to the toplevel dir, $(RELDIR), and express -# the toplevel dir as a relative path from this dir, $(TOPDIR_REL) -ifeq ($(findstring $(TOPDIR),$(CURDIR)),) - # Can only happen when something is built out of tree - RELDIR := $(CURDIR) - TOPDIR_REL := $(TOPDIR) -else - RELDIR := $(subst $(TOPDIR)/,,$(CURDIR)) - TOPDIR_REL := $(subst $(space),,$(foreach d,$(subst /, ,$(RELDIR)),../)) +ifdef O_TARGET +$(error kbuild: $(obj)/Makefile - Usage of O_TARGET := $(O_TARGET) is obsolete in 2.5. Please fix!) +endif + +ifdef L_TARGET +ifneq ($(L_TARGET),lib.a) +$(warning kbuild: $(obj)/Makefile - L_TARGET := $(L_TARGET) target shall be renamed to lib.a. Please fix!) +endif +endif + +ifdef list-multi +$(warning kbuild: $(obj)/Makefile - list-multi := $(list-multi) is obsolete in 2.5. Please fix!) endif # Some paths for the Makefiles to use # --------------------------------------------------------------------------- +# FIXME. For now, we leave it possible to use make -C or make -f +# to do work in subdirs. + +ifndef obj +obj = . +CFLAGS := $(patsubst -I%,-I$(TOPDIR)/%,$(patsubst -I$(TOPDIR)/%,-I%,$(CFLAGS))) +AFLAGS := $(patsubst -I%,-I$(TOPDIR)/%,$(patsubst -I$(TOPDIR)/%,-I%,$(AFLAGS))) +endif + +# For use in the quiet output +echo_target = $@ + # Usage: # # $(obj)/target.o : target.o in the build dir @@ -41,12 +56,7 @@ # We don't support separate source / object yet, so these are just # placeholders for now -obj := . -src := . - -# For use in the quiet output - -echo_target = $(RELDIR)/$@ +src := $(obj) # Figure out what we need to build from the various variables # =========================================================================== @@ -84,16 +94,8 @@ __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)) +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)))) # Build list of the parts of our composite objects, our composite # objects depend on those (obviously) @@ -111,6 +113,21 @@ # Only build module versions for files which are selected to be built export-objs := $(filter $(export-objs),$(real-objs-y) $(real-objs-m)) +# Add subdir path + +EXTRA_TARGETS := $(addprefix $(obj)/,$(EXTRA_TARGETS)) +obj-y := $(addprefix $(obj)/,$(obj-y)) +obj-m := $(addprefix $(obj)/,$(obj-m)) +export-objs := $(addprefix $(obj)/,$(export-objs)) +subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y)) +real-objs-y := $(addprefix $(obj)/,$(real-objs-y)) +real-objs-m := $(addprefix $(obj)/,$(real-objs-m)) +multi-used-y := $(addprefix $(obj)/,$(multi-used-y)) +multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) +multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y)) +multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m)) +subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) + # The temporary file to save gcc -MD generated dependencies must not # contain a comma depfile = $(subst $(comma),_,$(@D)/.$(@F).d) @@ -136,15 +153,15 @@ # If we don't export any symbols in this dir, just descend # --------------------------------------------------------------------------- -fastdep: sub_dirs - @echo -n +fastdep: $(subdir-ym) + @/bin/true else # This sets version suffixes on exported symbols # --------------------------------------------------------------------------- -MODVERDIR := $(TOPDIR)/include/linux/modules/$(RELDIR) +MODVERDIR := include/linux/modules/ # # Added the SMP separator to stop module accidents between uniprocessor @@ -159,7 +176,7 @@ # Don't include modversions.h, we're just about to generate it here. -CFLAGS_MODULE := $(filter-out -include $(HPATH)/linux/modversions.h,$(CFLAGS_MODULE)) +CFLAGS_MODULE := $(filter-out -include linux/modversions.h,$(CFLAGS_MODULE)) $(addprefix $(MODVERDIR)/,$(real-objs-y:.o=.ver)): modkern_cflags := $(CFLAGS_KERNEL) $(addprefix $(MODVERDIR)/,$(real-objs-m:.o=.ver)): modkern_cflags := $(CFLAGS_MODULE) @@ -174,7 +191,7 @@ # files (fix-dep filters them), so touch modversions.h if any of the .ver # files changes -quiet_cmd_cc_ver_c = MKVER include/linux/modules/$(RELDIR)/$*.ver +quiet_cmd_cc_ver_c = MKVER include/linux/modules/$*.ver cmd_cc_ver_c = $(CPP) $(c_flags) $< | $(GENKSYMS) $(genksyms_smp_prefix) \ -k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp @@ -206,9 +223,9 @@ targets := $(addprefix $(MODVERDIR)/,$(export-objs:.o=.ver)) -fastdep: $(targets) sub_dirs - @mkdir -p $(TOPDIR)/.tmp_export-objs/modules/$(RELDIR) - @touch $(addprefix $(TOPDIR)/.tmp_export-objs/modules/$(RELDIR)/,$(export-objs:.o=.ver)) +fastdep: $(targets) $(subdir-ym) + @mkdir -p $(dir $(addprefix .tmp_export-objs/modules/,$(export-objs:.o=.ver))) + @touch $(addprefix .tmp_export-objs/modules/,$(export-objs:.o=.ver)) endif # export-objs @@ -219,15 +236,17 @@ # Installing modules # ========================================================================== +quiet_cmd_modules_install = INSTALL $(obj-m) +cmd_modules_install = mkdir -p $(MODLIB)/kernel/$(obj); \ + cp $(obj-m) $(MODLIB)/kernel/$(obj) + .PHONY: modules_install -modules_install: sub_dirs +modules_install: $(subdir-ym) ifneq ($(obj-m),) - @echo Installing modules in $(MODLIB)/kernel/$(RELDIR) - @mkdir -p $(MODLIB)/kernel/$(RELDIR) - @cp $(obj-m) $(MODLIB)/kernel/$(RELDIR) + $(call cmd,modules_install) else - @echo -n + @/bin/true endif else # ! modules_install @@ -241,15 +260,18 @@ ifndef O_TARGET ifndef L_TARGET -O_TARGET := built-in.o +O_TARGET := $(obj)/built-in.o +endif endif + +ifdef L_TARGET +L_TARGET := $(obj)/$(L_TARGET) endif -# The echo suppresses the "Nothing to be done for first_rule" first_rule: $(if $(KBUILD_BUILTIN),$(O_TARGET) $(L_TARGET) $(EXTRA_TARGETS)) \ $(if $(KBUILD_MODULES),$(obj-m)) \ - sub_dirs - @echo -n + $(subdir-ym) + @/bin/true # define listing_o_c to get compiler listings from .c -> .o compilations listing_o_c = -Wa,-adnhls=$(subst $(comma),_,$(*F)).lst -g @@ -327,7 +349,7 @@ # --------------------------------------------------------------------------- # To build objects in subdirs, we need to descend into the directories -$(sort $(subdir-obj-y)): sub_dirs ; +$(sort $(subdir-obj-y)): $(subdir-ym) ; # # Rule to compile a set of .o files into one .o file @@ -363,7 +385,7 @@ # quiet_cmd_link_multi = LD $(echo_target) -cmd_link_multi = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs),$^) +cmd_link_multi = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.o=-objs)))),$^) # We would rather have a list of rules like # foo.o: $(foo-objs) @@ -383,6 +405,10 @@ host-progs-single := $(foreach m,$(host-progs),$(if $($(m)-objs),,$(m))) host-progs-multi := $(foreach m,$(host-progs),$(if $($(m)-objs),$(m))) host-progs-multi-objs := $(foreach m,$(host-progs-multi),$($(m)-objs)) +host-progs := $(addprefix $(obj)/,$(host-progs)) +host-progs-single := $(addprefix $(obj)/,$(host-progs-single)) +host-progs-multi := $(addprefix $(obj)/,$(host-progs-multi)) +host-progs-multi-objs := $(addprefix $(obj)/,$(host-progs-multi-objs)) quiet_cmd_host_cc__c = HOSTCC $(echo_target) cmd_host_cc__c = $(HOSTCC) -Wp,-MD,$(depfile) \ @@ -400,7 +426,7 @@ $(call if_changed_dep,host_cc_o_c) quiet_cmd_host_cc__o = HOSTLD $(echo_target) -cmd_host_cc__o = $(HOSTCC) $(HOSTLDFLAGS) -o $@ $($@-objs) \ +cmd_host_cc__o = $(HOSTCC) $(HOSTLDFLAGS) -o $@ $(addprefix $(obj)/,$($(subst $(obj)/,,$@)-objs)) \ $(HOST_LOADLIBES) $(host-progs-multi): %: $(host-progs-multi-objs) FORCE @@ -435,7 +461,7 @@ # --------------------------------------------------------------------------- quiet_cmd_ld = LD $(echo_target) -cmd_ld = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$@) \ +cmd_ld = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) \ $(filter-out FORCE,$^) -o $@ # Objcopy @@ -457,12 +483,10 @@ # Descending # --------------------------------------------------------------------------- -.PHONY: sub_dirs $(subdir-ym) - -sub_dirs: $(subdir-ym) +.PHONY: $(subdir-ym) $(subdir-ym): - @$(MAKE) -C $@ $(MAKECMDGOALS) + +@$(call descend,$@,$(MAKECMDGOALS)) # Add FORCE to the prequisites of a target to force it to be always rebuilt. # --------------------------------------------------------------------------- @@ -520,13 +544,6 @@ include $(cmd_files) endif -# Emacs compile mode works best with relative paths to find files (OK -# if verbose, as it tracks the make[1] entries and exits, etc.) - -ifneq ($(KBUILD_VERBOSE),1) - filter-output = 2>&1 | sed 's \(^[^/][A-Za-z0-9_./-]*:[ 0-9]\) $(RELDIR)/\1 ' -endif - # function to only execute the passed command if necessary if_changed = $(if $(strip $? \ @@ -546,7 +563,7 @@ $(filter-out $(cmd_$@),$(cmd_$(1)))),\ @set -e; \ $(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \ - $(cmd_$(1)) $(filter-output); \ + $(cmd_$(1)); \ $(TOPDIR)/scripts/fixdep $(depfile) $@ $(TOPDIR) '$(cmd_$(1))' > $(@D)/.$(@F).tmp; \ rm -f $(depfile); \ mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd) @@ -584,3 +601,10 @@ $(2) endef +# $(call descend,<dir>,<target>) +# Recursively call a sub-make in <dir> with target <target> + +ifeq ($(KBUILD_VERBOSE),1) +descend = echo '$(MAKE) -f $(1)/Makefile $(2)'; +endif +descend += $(MAKE) -f $(1)/Makefile obj=$(1) $(2) |