From bf2737d1cbcf0e85857e759efaa261ed3fa449cf Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 11 Oct 2002 00:24:45 +0200 Subject: kbuild: Distributed clean infrastructure Today there is a huge list of files in the top-level Makefile that is deleted during make clean and make mrproper. This patch add infrastructure to get rid of this centralised list. Within a makefile simply use: clean-files := files-to-be-deleted or eventually clean-rule := command to be executed to delete files Files specified by host-progs and EXTRA_TARGETS are deleted during cleaning, and the same is all *.[oas] .*.cmd .*.tmp .*.d in the visited directories. Deleting core files is moved down to mrporper time Patches utilising this and the centralised list will dismiss. Based on a concept originally made by Kai Germaschewski --- Makefile | 53 ++++++++++++++++++++++++++++++++++------------------- Rules.make | 34 +++++++++++++++++++++++----------- 2 files changed, 57 insertions(+), 30 deletions(-) diff --git a/Makefile b/Makefile index 3fbefd64e887..9cea95bbb220 100644 --- a/Makefile +++ b/Makefile @@ -661,10 +661,15 @@ allmodconfig: defconfig: yes '' | $(CONFIG_SHELL) $(src)/scripts/Configure -d arch/$(ARCH)/config.in -# Cleaning up -# --------------------------------------------------------------------------- - -# files removed with 'make clean' +### +# Cleaning is done on three levels. +# make clean Delete all automatically generated files, including +# tools and firmware. +# make mrproper Delete the current configuration, and related files +# Any core files spread around is deleted as well +# make distclean Remove editor backup files, patch leftover files and the like + +# Files removed with 'make clean' CLEAN_FILES += \ include/linux/compile.h \ vmlinux System.map \ @@ -690,7 +695,7 @@ CLEAN_FILES += \ net/khttpd/make_times_h net/khttpd/times.h \ submenu* -# files removed with 'make mrproper' +# Files removed with 'make mrproper' MRPROPER_FILES += \ include/linux/autoconf.h include/linux/version.h \ drivers/net/hamradio/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h \ @@ -712,33 +717,43 @@ MRPROPER_FILES += \ tags TAGS kernel.spec \ .tmp* -# directories removed with 'make mrproper' +# Directories removed with 'make mrproper' MRPROPER_DIRS += \ .tmp_export-objs \ include/config \ include/linux/modules -clean: archclean - @echo 'Cleaning up' - @find . $(RCS_FIND_IGNORE) \ - \( -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) - +@$(call descend,Documentation/DocBook,clean) +# clean - Delete all intermidiate files +# +clean-dirs += $(ALL_SUBDIRS) Documentation/DocBook +cleanprint: + @echo ' Cleaning the srctree' +$(addprefix _clean_,$(clean-dirs)): cleanprint + +@$(call descend,$(patsubst _clean_%,%,$@), subdirclean) + +quiet_cmd_rmclean = RM $$(CLEAN_FILES) +cmd_rmclean = rm -f $(CLEAN_FILES) +clean: archclean $(addprefix _clean_,$(clean-dirs)) + $(call cmd,rmclean) + +# mrproper - delete configuration + modules + core files +# +quiet_cmd_mrproper = RM $$(MRPROPER_DIRS) + $$(MRPROPER_FILES) +cmd_mrproper = rm -rf $(MRPROPER_DIRS) && rm -f $(MRPROPER_FILES) mrproper: clean archmrproper - @echo 'Making mrproper' + @echo ' Making mrproper in the srctree' @find . $(RCS_FIND_IGNORE) \ - \( -name .depend -o -name .\*.cmd \) \ + \( -name .depend -o -name .\*.cmd -o -name core \) \ -type f -print | xargs rm -f - @rm -rf $(MRPROPER_DIRS) - @rm -f $(MRPROPER_FILES) + $(call cmd,mrproper) +@$(call descend,scripts,mrproper) +@$(call descend,Documentation/DocBook,mrproper) +# distclean - remove all temporaries left behind by patch, vi, emacs etc. +# distclean: mrproper - @echo 'Making distclean' + @echo ' Making distclean in the srctree' @find . $(RCS_FIND_IGNORE) \ \( -not -type d \) -and \ \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ diff --git a/Rules.make b/Rules.make index 1b06db4c2b91..bd4ebc76a49b 100644 --- a/Rules.make +++ b/Rules.make @@ -87,6 +87,7 @@ obj-m := $(filter-out %/, $(obj-m)) # Subdirectories we need to descend into subdir-ym := $(sort $(subdir-y) $(subdir-m)) +subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-)) # export.o is never a composite object, since $(export-objs) has a # fixed meaning (== objects which EXPORT_SYMBOL()) @@ -113,6 +114,10 @@ real-objs-m := $(foreach m, $(obj-m), $(if $($(m:.o=-objs)),$($(m:.o=-objs)),$(m # Only build module versions for files which are selected to be built export-objs := $(filter $(export-objs),$(real-objs-y) $(real-objs-m)) +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)) + # Add subdir path EXTRA_TARGETS := $(addprefix $(obj)/,$(EXTRA_TARGETS)) @@ -127,12 +132,19 @@ 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)) +subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) +clean-files := $(addprefix $(obj)/,$(clean-files)) +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)) # The temporary file to save gcc -MD generated dependencies must not # contain a comma depfile = $(subst $(comma),_,$(@D)/.$(@F).d) -# We're called for one of three purposes: +# We're called for one of four purposes: +# o subdirclean: Delete intermidiate files in the current directory # o fastdep: build module version files (.ver) for $(export-objs) in # the current directory # o modules_install: install the modules in the current directory @@ -142,6 +154,13 @@ depfile = $(subst $(comma),_,$(@D)/.$(@F).d) # When targets are given directly (like foo.o), we just build these # targets (That happens when someone does make some/dir/foo.[ois]) +ifeq ($(MAKECMDGOALS),subdirclean) +subdirclean: $(subdir-ymn) + @/bin/true + @rm -f $(EXTRA_TARGETS) $(host-progs) $(clean-files) \ + $(addprefix $(obj)/,*.[oas] .*.cmd .*.tmp .*.d) + @$(clean-rule) +else ifeq ($(MAKECMDGOALS),fastdep) # =========================================================================== @@ -399,14 +418,6 @@ targets += $(multi-used-y) $(multi-used-m) # Compile programs on the host # =========================================================================== -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) \ $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \ @@ -431,6 +442,7 @@ $(host-progs-multi): %: $(host-progs-multi-objs) FORCE targets += $(host-progs-single) $(host-progs-multi-objs) $(host-progs-multi) +endif # ! subdirclean endif # ! modules_install endif # ! fastdep @@ -480,9 +492,9 @@ cmd_gzip = gzip -f -9 < $< > $@ # Descending # --------------------------------------------------------------------------- -.PHONY: $(subdir-ym) +.PHONY: $(subdir-ymn) -$(subdir-ym): +$(subdir-ymn): +@$(call descend,$@,$(MAKECMDGOALS)) # Add FORCE to the prequisites of a target to force it to be always rebuilt. -- cgit v1.2.3 From 3309b35ce34e00874451e521a6f6ce50b0dc6de0 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 11 Oct 2002 00:44:28 +0200 Subject: scsi+aic7xxx: Utilise distributed clean List files to be deleted during make clean where they are created --- Makefile | 9 --------- drivers/scsi/Makefile | 6 +++++- drivers/scsi/aic7xxx/Makefile | 14 +++++++++++--- drivers/scsi/aic7xxx/aicasm/Makefile | 2 +- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 9cea95bbb220..5ccf80013b75 100644 --- a/Makefile +++ b/Makefile @@ -681,15 +681,6 @@ CLEAN_FILES += \ 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 \ - drivers/scsi/aic7xxx/aicasm/aicasm \ - drivers/scsi/53c700_d.h drivers/scsi/sim710_d.h \ - drivers/scsi/53c7xx_d.h drivers/scsi/53c7xx_u.h \ - drivers/scsi/53c8xx_d.h drivers/scsi/53c8xx_u.h \ net/802/cl2llc.c net/802/transit/pdutr.h net/802/transit/timertr.h \ net/802/pseudo/pseudocode.h \ net/khttpd/make_times_h net/khttpd/times.h \ diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index c025acfb85d5..11fb8d314474 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile @@ -132,6 +132,10 @@ a100u2w-objs := inia100.o i60uscsi.o cpqfc-objs := cpqfcTSinit.o cpqfcTScontrol.o cpqfcTSi2c.o \ cpqfcTSworker.o cpqfcTStrigger.o +# Files generated that shall be removed upon make clean +clean-files := 53c8xx_d.h 53c7xx_d.h sim710_d.h 53c700_d.h \ + 53c8xx_u.h 53c7xx_u.h sim710_u.h 53c700_u.h + include $(TOPDIR)/Rules.make $(obj)/53c7,8xx.o: $(obj)/53c8xx_d.h $(obj)/53c8xx_u.h @@ -162,4 +166,4 @@ $(obj)/sim710_u.h: $(obj)/sim710_d.h $(obj)/53c700_d.h: $(src)/53c700.scr $(src)/script_asm.pl $(PERL) -s $(src)/script_asm.pl -ncr7x0_family $@ $(@:_d.h=_u.h) < $< -endif \ No newline at end of file +endif diff --git a/drivers/scsi/aic7xxx/Makefile b/drivers/scsi/aic7xxx/Makefile index d92ba2bdc047..ea95d8a13309 100644 --- a/drivers/scsi/aic7xxx/Makefile +++ b/drivers/scsi/aic7xxx/Makefile @@ -20,6 +20,13 @@ endif #EXTRA_CFLAGS += -g +# Files generated that shall be removed upon make clean +clean-files := aic7xxx_seq.h aic7xxx_reg.h + +# Command to be executed upon make clean +# Note: Assignment without ':' to force late evaluation of $(src) +clean-rule = @$(MAKE) -C $(src)/aicasm clean + include $(TOPDIR)/Rules.make # Dependencies for generated files need to be listed explicitly @@ -30,12 +37,13 @@ $(addprefix $(obj)/,$(aic7xxx-objs)): $(obj)/aic7xxx_reg.h ifeq ($(CONFIG_AIC7XXX_BUILD_FIRMWARE),y) -$(obj)/aic7xxx_seq.h $(obj)/aic7xxx_reg.h: $(src)/aic7xxx.seq \ - $(src)/aic7xxx.reg \ - $(obj)/aicasm/aicasm +$(obj)/aic7xxx_seq.h: $(src)/aic7xxx.seq $(src)/aic7xxx.reg \ + $(obj)/aicasm/aicasm $(obj)/aicasm/aicasm -I. -r $(obj)/aic7xxx_reg.h \ -o $(obj)/aic7xxx_seq.h $(src)/aic7xxx.seq +$(obj)/aic7xxx_reg.h: $(obj)/aix7xxx_seq.h + $(obj)/aicasm/aicasm: $(src)/aicasm/*.[chyl] $(MAKE) -C $(src)/aicasm diff --git a/drivers/scsi/aic7xxx/aicasm/Makefile b/drivers/scsi/aic7xxx/aicasm/Makefile index 790402e0dd68..39acae36dcac 100644 --- a/drivers/scsi/aic7xxx/aicasm/Makefile +++ b/drivers/scsi/aic7xxx/aicasm/Makefile @@ -43,7 +43,7 @@ aicdb.h: fi clean: - rm -f $(CLEANFILES) $(PROG) + @rm -f $(CLEANFILES) $(PROG) y.tab.h aicasm_gram.c: aicasm_gram.y $(YACC) $(YFLAGS) aicasm_gram.y -- cgit v1.2.3 From b5bea3b09ea47add09d6e800529bf2d8b7105c81 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 11 Oct 2002 00:50:19 +0200 Subject: drivers/{atm,char,pci,video,zorro}: ditributed clean Move list of files to be deleted during make clean out where they are made. host-progs files taken care of automagically --- Makefile | 7 ------- drivers/atm/Makefile | 6 +++++- drivers/char/Makefile | 3 +++ drivers/pci/Makefile | 3 +++ drivers/video/Makefile | 3 +++ drivers/zorro/Makefile | 3 +++ 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 5ccf80013b75..33b6f06d2aba 100644 --- a/Makefile +++ b/Makefile @@ -673,14 +673,8 @@ defconfig: CLEAN_FILES += \ include/linux/compile.h \ vmlinux System.map \ - drivers/char/consolemap_deftbl.c drivers/video/promcon_tbl.c \ - drivers/char/conmakehash \ drivers/char/drm/*-mod.c \ - drivers/char/defkeymap.c drivers/char/qtronixmap.c \ - drivers/pci/devlist.h drivers/pci/classlist.h drivers/pci/gen-devlist \ - 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} \ net/802/cl2llc.c net/802/transit/pdutr.h net/802/transit/timertr.h \ net/802/pseudo/pseudocode.h \ net/khttpd/make_times_h net/khttpd/times.h \ @@ -698,7 +692,6 @@ MRPROPER_FILES += \ sound/oss/msndperm.c \ sound/oss/pndsperm.c \ sound/oss/pndspini.c \ - drivers/atm/fore200e_*_fw.c drivers/atm/.fore200e_*.fw \ .version .config* config.in config.old \ scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp \ scripts/lxdialog/*.o scripts/lxdialog/lxdialog \ diff --git a/drivers/atm/Makefile b/drivers/atm/Makefile index ccae789befa9..2d88513912c0 100644 --- a/drivers/atm/Makefile +++ b/drivers/atm/Makefile @@ -8,6 +8,10 @@ export-objs := uPD98402.o suni.o idt77105.o fore_200e-objs := fore200e.o host-progs := fore200e_mkfirm +# Files generated that shall be removed upon make clean +clean-files := {atmsar11,pca200e,pca200e_ecd,sba200e_ecd}.{bin,bin1,bin2} +# Firmware generated that shall be removed upon make clean +clean-files += fore200e_pca_fw.c fore200e_sba_fw.c obj-$(CONFIG_ATM_ZATM) += zatm.o uPD98402.o obj-$(CONFIG_ATM_NICSTAR) += nicstar.o @@ -61,6 +65,6 @@ $(obj)/fore200e_sba_fw.c: $(patsubst "%", %, $(CONFIG_ATM_FORE200E_SBA_FW)) \ -i $(CONFIG_ATM_FORE200E_SBA_FW) -o $@ # deal with the various suffixes of the binary firmware images -$(obj)/%.bin $(obj)/%.bin1 $(obj)/%.bin2: $(obj)/%.data +$(obj)/%.bin $(obj)/%.bin1 $(obj)/%.bin2: $(src)/%.data objcopy -Iihex $< -Obinary $@.gz gzip -df $@.gz diff --git a/drivers/char/Makefile b/drivers/char/Makefile index 80a28ced908c..58ee9dc5e471 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile @@ -103,6 +103,9 @@ obj-$(CONFIG_AGP) += agp/ obj-$(CONFIG_DRM) += drm/ obj-$(CONFIG_PCMCIA) += pcmcia/ +# Files generated that shall be removed upon make clean +clean-files := consolemap_deftbl.c defkeymap.c qtronixmap.c + include $(TOPDIR)/Rules.make $(obj)/consolemap_deftbl.c: $(src)/$(FONTMAPFILE) diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index 307ea814439a..d26c2e02ef62 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile @@ -31,6 +31,9 @@ endif host-progs := gen-devlist +# Files generated that shall be removed upon make clean +clean-files := devlist.h classlist.h + include $(TOPDIR)/Rules.make # Dependencies on generated files need to be listed explicitly diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 53d5a335d832..9eb41edb4a49 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -119,6 +119,9 @@ obj-$(CONFIG_FBCON_HGA) += fbcon-hga.o obj-$(CONFIG_FBCON_STI) += fbcon-sti.o obj-$(CONFIG_FBCON_ACCEL) += fbcon-accel.o +# Files generated that shall be removed upon make clean +clean-files := promcon_tbl.c + include $(TOPDIR)/Rules.make $(obj)/promcon_tbl.c: $(src)/prom.uni diff --git a/drivers/zorro/Makefile b/drivers/zorro/Makefile index 9bde458b4322..2131c57fccfa 100644 --- a/drivers/zorro/Makefile +++ b/drivers/zorro/Makefile @@ -9,6 +9,9 @@ obj-$(CONFIG_PROC_FS) += proc.o host-progs := gen-devlist +# Files generated that shall be removed upon make clean +clean-files := devlist.h + include $(TOPDIR)/Rules.make # Dependencies on generated files need to be listed explicitly -- cgit v1.2.3 From 87547a922b6f5a03db24fa3e59b62d60ae2d58b1 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 11 Oct 2002 00:52:41 +0200 Subject: drivers/net/hamradio/soundmodem: distributed clean Move list of files out where it belongs --- Makefile | 4 ---- drivers/net/hamradio/soundmodem/Makefile | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 33b6f06d2aba..8145d90e8802 100644 --- a/Makefile +++ b/Makefile @@ -683,10 +683,6 @@ CLEAN_FILES += \ # Files removed with 'make mrproper' MRPROPER_FILES += \ include/linux/autoconf.h include/linux/version.h \ - drivers/net/hamradio/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h \ - drivers/net/hamradio/soundmodem/sm_tbl_{hapn4800,psk4800}.h \ - drivers/net/hamradio/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h \ - drivers/net/hamradio/soundmodem/gentbl \ sound/oss/*_boot.h sound/oss/.*.boot \ sound/oss/msndinit.c \ sound/oss/msndperm.c \ diff --git a/drivers/net/hamradio/soundmodem/Makefile b/drivers/net/hamradio/soundmodem/Makefile index a3fe3f4e61cd..77de2ca25c87 100644 --- a/drivers/net/hamradio/soundmodem/Makefile +++ b/drivers/net/hamradio/soundmodem/Makefile @@ -19,6 +19,12 @@ soundmodem-objs := $(soundmodem-y) host-progs := gentbl HOST_LOADLIBES := -lm +# Files generated that shall be removed upon make clean +clean-files := sm_tbl_afsk1200.h sm_tbl_afsk2400_7.h \ + sm_tbl_afsk2400_8.h sm_tbl_afsk2666.h \ + sm_tbl_psk4800.h sm_tbl_hapn4800.h \ + sm_tbl_fsk9600.h + include $(TOPDIR)/Rules.make # Dependencies on generates files need to be listed explicitly -- cgit v1.2.3 From 57733624e0e31138658b680957a6e6a48d3c5014 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 11 Oct 2002 00:57:03 +0200 Subject: kbuild: Distributed clean, misc. o Move sound/oss file list to sound/oss/Makefile o Remove files non-existing in the tree (khttp,net/802/submenu) o scripts/* are handled by scripts makefile o Do not delete .config*, be more explicit o Add MC* - files generated by Menuconfig in toplevel dir --- Makefile | 19 ++----------------- init/Makefile | 10 +++++++--- sound/oss/Makefile | 4 ++++ 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 8145d90e8802..a5b06d2e69bd 100644 --- a/Makefile +++ b/Makefile @@ -670,27 +670,12 @@ defconfig: # make distclean Remove editor backup files, patch leftover files and the like # Files removed with 'make clean' -CLEAN_FILES += \ - include/linux/compile.h \ - vmlinux System.map \ - drivers/char/drm/*-mod.c \ - sound/oss/bin2hex sound/oss/hex2hex \ - net/802/cl2llc.c net/802/transit/pdutr.h net/802/transit/timertr.h \ - net/802/pseudo/pseudocode.h \ - net/khttpd/make_times_h net/khttpd/times.h \ - submenu* +CLEAN_FILES += vmlinux System.map MC* # Files removed with 'make mrproper' MRPROPER_FILES += \ include/linux/autoconf.h include/linux/version.h \ - sound/oss/*_boot.h sound/oss/.*.boot \ - sound/oss/msndinit.c \ - sound/oss/msndperm.c \ - sound/oss/pndsperm.c \ - sound/oss/pndspini.c \ - .version .config* config.in config.old \ - scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp \ - scripts/lxdialog/*.o scripts/lxdialog/lxdialog \ + .version .config .config.old config.in config.old \ .menuconfig.log \ include/asm \ .hdepend include/linux/modversions.h \ diff --git a/init/Makefile b/init/Makefile index 90b477436bfd..ccf60634b9c4 100644 --- a/init/Makefile +++ b/init/Makefile @@ -4,17 +4,21 @@ obj-y := main.o version.o do_mounts.o +# files to be removed upon make clean +clean-files := ../include/linux/compile.h + include $(TOPDIR)/Rules.make # dependencies on generated files need to be listed explicitly -$(obj)/version.o: $(objtree)/include/linux/compile.h +$(obj)/version.o: $(obj)/../include/linux/compile.h # compile.h changes depending on hostname, generation number, etc, # so we regenerate it always. # mkcompile_h will make sure to only update the # actual file if its content has changed. -$(objtree)/include/linux/compile.h: FORCE - @echo -n ' Generating $@' +$(obj)/../include/linux/compile.h: FORCE + @echo -n ' Generating $(echo_target)' @$(srctree)/scripts/mkcompile_h $@ "$(ARCH)" "$(CONFIG_SMP)" "$(CC) $(CFLAGS)" + diff --git a/sound/oss/Makefile b/sound/oss/Makefile index c24a584bc43d..de9f457b82cc 100644 --- a/sound/oss/Makefile +++ b/sound/oss/Makefile @@ -96,6 +96,10 @@ wavefront-objs := wavfront.o wf_midi.o yss225.o host-progs := bin2hex hex2hex +# Files generated that shall be removed upon make clean +clean-files := maui_boot.h msndperm.c msndinit.c pndsperm.c pndspini.c \ + pss_boot.h trix_boot.h + include $(TOPDIR)/Rules.make # Firmware files that need translation -- cgit v1.2.3 From cf2098d9437d0abcb5a491953f902e192681b37f Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 11 Oct 2002 01:04:21 +0200 Subject: docbook: Makefile cleanup o Removed special rules for JBD, covered by the general mechanishm o Use $(obj)/ instead of Documentation/DocBook o Introduced usage of Distributed clean o No longer delete *~ files in top-level directory during clean --- Documentation/DocBook/Makefile | 52 +++++++++++++++++------------------------- Makefile | 1 - 2 files changed, 21 insertions(+), 32 deletions(-) diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 89e68b688fba..2e3a7333354e 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile @@ -13,14 +13,6 @@ DOCBOOKS := wanbook.sgml z8530book.sgml mcabook.sgml videobook.sgml \ writing_usb_driver.sgml scsidrivers.sgml sis900.sgml \ kernel-api.sgml journal-api.sgml lsm.sgml -JBDSOURCES := $(TOPDIR)/include/linux/jbd.h \ - $(TOPDIR)/fs/jbd/journal.c \ - $(TOPDIR)/fs/jbd/recovery.c \ - $(TOPDIR)/fs/jbd/transaction.c - -journal-api.sgml: journal-api.tmpl $(JBDSOURCES) - $(TOPDIR)/scripts/docgen $(JBDSOURCES) \ - journal-api.sgml ### # The build process is as follows (targets): # (sgmldocs) @@ -32,7 +24,7 @@ journal-api.sgml: journal-api.tmpl $(JBDSOURCES) # The targets that may be used. .PHONY: sgmldocs psdocs pdfdocs htmldocs clean mrproper -BOOKS := $(addprefix Documentation/DocBook/,$(DOCBOOKS)) +BOOKS := $(addprefix $(obj)/,$(DOCBOOKS)) sgmldocs: $(BOOKS) PS := $(patsubst %.sgml, %.ps, $(BOOKS)) @@ -86,19 +78,19 @@ $(BOOKS): $(KERNELDOC) ### # procfs guide uses a .c file as example code. # This requires an explicit dependency -C-procfs-example = Documentation/DocBook/procfs_example.sgml -Documentation/DocBook/procfs-guide.sgml: $(C-procfs-example) +C-procfs-example = procfs_example.sgml +C-procfs-example2 = $(addprefix $(obj)/,$(C-procfs-example)) +$(obj)/procfs-guide.sgml: $(C-procfs-example2) ### # The parportbook includes a few images. # Force them to be build before the books IMG-parportbook := parport-share.fig parport-multi.fig parport-structure.fig -IMG-parportbook2 := $(addprefix Documentation/DocBook/,$(IMG-parportbook)) +IMG-parportbook2 := $(addprefix $(obj)/,$(IMG-parportbook)) EPS-parportbook := $(patsubst %.fig,%.eps, $(IMG-parportbook2)) PNG-parportbook := $(patsubst %.fig,%.png, $(IMG-parportbook2)) -Documentation/DocBook/parportbook.html: $(PNG-parportbook) -Documentation/DocBook/parportbook.ps Documentation/DocBook/parportbook.pdf:\ - $(EPS-parportbook) +$(obj)/parportbook.html: $(PNG-parportbook) +$(obj)/parportbook.ps $(obj)/parportbook.pdf: $(EPS-parportbook) ### # Rules to generate postscript, PDF and HTML @@ -155,22 +147,20 @@ dochelp: ### # clean and mrproper as used by the top-level makefile # Temporary files left by various tools -DVI := $(patsubst %.sgml, %.dvi, $(BOOKS)) -AUX := $(patsubst %.sgml, %.aux, $(BOOKS)) -TEX := $(patsubst %.sgml, %.tex, $(BOOKS)) -LOG := $(patsubst %.sgml, %.log, $(BOOKS)) -OUT := $(patsubst %.sgml, %.out, $(BOOKS)) - -clean: - @rm -f core *~ - @rm -f $(BOOKS) - @rm -f $(DVI) $(AUX) $(TEX) $(LOG) $(OUT) - @rm -f $(PNG-parportbook) $(EPS-parportbook) - @rm -f $(C-procfs-example) - -mrproper: - @rm -f $(PS) $(PDF) - @rm -f -r $(HTML) $(patsubst %.html,%,$(HTML)) +clean-files := $(DOCBOOKS) \ + $(patsubst %.sgml, %.dvi, $(DOCBOOKS)) \ + $(patsubst %.sgml, %.aux, $(DOCBOOKS)) \ + $(patsubst %.sgml, %.tex, $(DOCBOOKS)) \ + $(patsubst %.sgml, %.log, $(DOCBOOKS)) \ + $(patsubst %.sgml, %.out, $(DOCBOOKS)) \ + $(patsubst %.sgml, %.ps, $(DOCBOOKS)) \ + $(patsubst %.sgml, %.pdf, $(DOCBOOKS)) \ + $(patsubst %.sgml, %.html, $(DOCBOOKS)) \ + $(patsubst %.fig,%.eps, $(IMG-parportbook)) \ + $(patsubst %.fig,%.png, $(IMG-parportbook)) \ + $(C-procfs-example) + +clean-rule := rm -rf $(patsubst %.html,%,$(HTML)) include $(TOPDIR)/Rules.make diff --git a/Makefile b/Makefile index a5b06d2e69bd..478eab90591e 100644 --- a/Makefile +++ b/Makefile @@ -713,7 +713,6 @@ mrproper: clean archmrproper -type f -print | xargs rm -f $(call cmd,mrproper) +@$(call descend,scripts,mrproper) - +@$(call descend,Documentation/DocBook,mrproper) # distclean - remove all temporaries left behind by patch, vi, emacs etc. # -- cgit v1.2.3 From cc1d5f88c269605d482112169f87b982ff1710e8 Mon Sep 17 00:00:00 2001 From: Kai Germaschewski Date: Sun, 13 Oct 2002 05:47:12 -0500 Subject: Move kallsyms section next to other read-only sections As noted by Keith Owens, for some setups it may make sense to have all read-only sections grouped together. --- arch/i386/vmlinux.lds.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/i386/vmlinux.lds.S b/arch/i386/vmlinux.lds.S index 4469f4e5d584..fda1d6b144db 100644 --- a/arch/i386/vmlinux.lds.S +++ b/arch/i386/vmlinux.lds.S @@ -29,6 +29,10 @@ SECTIONS __ksymtab : { *(__ksymtab) } __stop___ksymtab = .; + __start___kallsyms = .; /* All kernel symbols */ + __kallsyms : { *(__kallsyms) } + __stop___kallsyms = .; + .data : { /* Data */ *(.data) CONSTRUCTORS @@ -77,10 +81,6 @@ SECTIONS . = ALIGN(32); .data.cacheline_aligned : { *(.data.cacheline_aligned) } - __start___kallsyms = .; /* All kernel symbols */ - __kallsyms : { *(__kallsyms) } - __stop___kallsyms = .; - __bss_start = .; /* BSS */ .bss : { *(.bss) } __bss_stop = .; -- cgit v1.2.3 From 1ab37c01a3f683643f14a493837b180d209c7bb0 Mon Sep 17 00:00:00 2001 From: Kai Germaschewski Date: Sun, 13 Oct 2002 06:03:17 -0500 Subject: Clean up arch/i386/vmlinux.lds.S Add some comments indicating read-only, writeable and freed-after-init sections. Move .data_nosave, .data.page_aligned, .data.cacheline_aligned next to the "normal" data area, the only difference this should make, apart from being more logical, is a more truthful printk() during boot. --- arch/i386/vmlinux.lds.S | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/arch/i386/vmlinux.lds.S b/arch/i386/vmlinux.lds.S index fda1d6b144db..f48a09762c36 100644 --- a/arch/i386/vmlinux.lds.S +++ b/arch/i386/vmlinux.lds.S @@ -8,6 +8,7 @@ jiffies = jiffies_64; SECTIONS { . = 0xC0000000 + 0x100000; + /* read-only */ _text = .; /* Text and read-only data */ .text : { *(.text) @@ -33,16 +34,30 @@ SECTIONS __kallsyms : { *(__kallsyms) } __stop___kallsyms = .; + /* writeable */ .data : { /* Data */ *(.data) CONSTRUCTORS } + . = ALIGN(4096); + __nosave_begin = .; + .data_nosave : { *(.data.nosave) } + . = ALIGN(4096); + __nosave_end = .; + + . = ALIGN(4096); + .data.page_aligned : { *(.data.idt) } + + . = ALIGN(32); + .data.cacheline_aligned : { *(.data.cacheline_aligned) } + _edata = .; /* End of data section */ . = ALIGN(8192); /* init_task */ .data.init_task : { *(.data.init_task) } + /* will be freed after init */ . = ALIGN(4096); /* Init code and data */ __init_begin = .; .text.init : { *(.text.init) } @@ -68,19 +83,8 @@ SECTIONS __per_cpu_end = .; . = ALIGN(4096); __init_end = .; - - . = ALIGN(4096); - __nosave_begin = .; - .data_nosave : { *(.data.nosave) } - . = ALIGN(4096); - __nosave_end = .; - - . = ALIGN(4096); - .data.page_aligned : { *(.data.idt) } - - . = ALIGN(32); - .data.cacheline_aligned : { *(.data.cacheline_aligned) } - + /* freed after init ends here */ + __bss_start = .; /* BSS */ .bss : { *(.bss) } __bss_stop = .; -- cgit v1.2.3 From 9f174d6eb46f7c05ca8f8f975e210cd2050f6644 Mon Sep 17 00:00:00 2001 From: Kai Germaschewski Date: Sun, 13 Oct 2002 06:06:30 -0500 Subject: kbuild: Add build dep for UML Using .S -> .s needs scripts/fixdep, which is not necessarily there so early during the build, so add a dependency on it. --- arch/um/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/um/Makefile b/arch/um/Makefile index c8889424b773..25d0b9690e54 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile @@ -71,7 +71,7 @@ LDFLAGS_vmlinux = -r $(ARCH_DIR)/main.o vmlinux: $(ARCH_DIR)/main.o -$(ARCH_DIR)/uml.lds.s : $(ARCH_DIR)/uml.lds.S +$(ARCH_DIR)/uml.lds.s : $(ARCH_DIR)/uml.lds.S scripts FORCE $(call if_changed_dep,as_s_S) AFLAGS_uml.lds.o = -U$(SUBARCH) -DSTART=$$(($(TOP_ADDR) - $(SIZE))) \ -- cgit v1.2.3 From c3ef0e8389e22306f6ce56a2b7c234da7d7bafaf Mon Sep 17 00:00:00 2001 From: Kai Germaschewski Date: Sun, 13 Oct 2002 07:56:24 -0500 Subject: kbuild: More cleaning work... o Having .config depend on all Config.in's via a find is annoying, since it causes a long break before "make" actually gets going. Comment it out for now. o Fix some "make -j" issues with generating module versions. o Unify "make distclean" and "make mrproper", they were doing nearly the same thing anyway. o Use the new "make clean" infrastructure for arch/i386/boot/ and scripts/ o Reorganize the "make clean" stuff a little, do the find -name '*.[oas]' | xargs rm -f from the top-level Makefile again and only use the per-subdir rule for special cases like generated files, host-progs and the like. --- Makefile | 45 ++++++++++++++++++-------------------- Rules.make | 14 ++++++++---- arch/i386/Makefile | 2 +- arch/i386/boot/Makefile | 7 ++---- arch/i386/boot/compressed/Makefile | 4 ---- scripts/Makefile | 9 ++++---- scripts/lxdialog/Makefile | 3 --- 7 files changed, 38 insertions(+), 46 deletions(-) diff --git a/Makefile b/Makefile index 2ee1e894092f..78de51a75a75 100644 --- a/Makefile +++ b/Makefile @@ -239,7 +239,7 @@ ifdef include-config # If .config doesn't exist - tough luck -.config: arch/$(ARCH)/config.in $(shell find . -name Config.in) +.config: arch/$(ARCH)/config.in # FIXME $(shell find . -name Config.in) @echo '***' @if [ -f $@ ]; then \ echo '*** The tree was updated, so your .config may be'; \ @@ -456,18 +456,23 @@ include/linux/version.h: Makefile depend dep: .hdepend -# .hdepend is our (misnomed) marker for whether we've run +# .hdepend is our (misnomed) marker for whether we've # generated module versions -.hdepend: $(if $(filter dep depend,$(MAKECMDGOALS)),FORCE) +make-versions := $(strip $(if $(filter dep depend,$(MAKECMDGOALS)),1) \ + $(if $(wildcard .hdepend),,1)) + +.hdepend: prepare FORCE +ifneq ($(make-versions),) @$(MAKE) include/linux/modversions.h @touch $@ +endif ifdef CONFIG_MODVERSIONS # Update modversions.h, but only if it would change. -include/linux/modversions.h: scripts/fixdep prepare FORCE +include/linux/modversions.h: FORCE @rm -rf .tmp_export-objs @$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) @echo -n ' Generating $@' @@ -688,42 +693,34 @@ MRPROPER_DIRS += \ include/config \ include/linux/modules -# clean - Delete all intermidiate files +# clean - Delete all intermediate files # -clean-dirs += $(ALL_SUBDIRS) Documentation/DocBook -cleanprint: - @echo ' Cleaning the srctree' +clean-dirs += $(ALL_SUBDIRS) Documentation/DocBook scripts -$(addprefix _clean_,$(clean-dirs)): cleanprint +$(addprefix _clean_,$(clean-dirs)): +@$(call descend,$(patsubst _clean_%,%,$@), subdirclean) quiet_cmd_rmclean = RM $$(CLEAN_FILES) cmd_rmclean = rm -f $(CLEAN_FILES) clean: archclean $(addprefix _clean_,$(clean-dirs)) $(call cmd,rmclean) + @find . $(RCS_FIND_IGNORE) \ + \( -name '*.[oas]' -o -name '.*.cmd' -o -name '.*.d' \ + -o -name '.*.tmp' \) -type f -print | xargs rm -f # mrproper - delete configuration + modules + core files # quiet_cmd_mrproper = RM $$(MRPROPER_DIRS) + $$(MRPROPER_FILES) cmd_mrproper = rm -rf $(MRPROPER_DIRS) && rm -f $(MRPROPER_FILES) -mrproper: clean archmrproper - @echo ' Making mrproper in the srctree' - @find . $(RCS_FIND_IGNORE) \ - \( -name .depend -o -name .\*.cmd -o -name core \) \ - -type f -print | xargs rm -f - $(call cmd,mrproper) - +@$(call descend,scripts,mrproper) - -# distclean - remove all temporaries left behind by patch, vi, emacs etc. -# -distclean: mrproper - @echo ' Making distclean in the srctree' +mrproper distclean: clean archmrproper + @echo ' Making $@ in the srctree' @find . $(RCS_FIND_IGNORE) \ - \( -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 | xargs rm -f + -o -name '.*.rej' -o -size 0 \ + -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \ + -type f -print | xargs rm -f + $(call cmd,mrproper) # Generate tags for editors # --------------------------------------------------------------------------- diff --git a/Rules.make b/Rules.make index 6ed53f769e0d..56e62f97f333 100644 --- a/Rules.make +++ b/Rules.make @@ -155,11 +155,17 @@ depfile = $(subst $(comma),_,$(@D)/.$(@F).d) # targets (That happens when someone does make some/dir/foo.[ois]) ifeq ($(MAKECMDGOALS),subdirclean) + +__clean-files := $(wildcard $(EXTRA_TARGETS) $(host-progs) $(clean-files)) + subdirclean: $(subdir-ymn) +ifneq ($(strip $(__clean-files) $(clean-rule)),) + rm -f $(__clean-files) + $(clean-rule) +else @/bin/true - @rm -f $(EXTRA_TARGETS) $(host-progs) $(clean-files) \ - $(addprefix $(obj)/,*.[oas] .*.cmd .*.tmp .*.d) - @$(clean-rule) +endif + else ifeq ($(MAKECMDGOALS),fastdep) @@ -180,7 +186,7 @@ else # This sets version suffixes on exported symbols # --------------------------------------------------------------------------- -MODVERDIR := include/linux/modules/ +MODVERDIR := include/linux/modules # # Added the SMP separator to stop module accidents between uniprocessor diff --git a/arch/i386/Makefile b/arch/i386/Makefile index 9d822af70fcb..7d5862c05d40 100644 --- a/arch/i386/Makefile +++ b/arch/i386/Makefile @@ -86,6 +86,6 @@ install: vmlinux +@$(call makeboot,BOOTIMAGE=$(BOOTIMAGE) install) archclean: - +@$(call makeboot,clean) + +@$(call makeboot,subdirclean) archmrproper: diff --git a/arch/i386/boot/Makefile b/arch/i386/boot/Makefile index 3369bfc67700..b06bab8ccd43 100644 --- a/arch/i386/boot/Makefile +++ b/arch/i386/boot/Makefile @@ -28,6 +28,8 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA EXTRA_TARGETS := vmlinux.bin bootsect bootsect.o \ setup setup.o zImage bzImage +subdir- := compressed + host-progs := tools/build # Default @@ -79,11 +81,6 @@ zlilo: $(BOOTIMAGE) install: $(BOOTIMAGE) sh $(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" -clean: - @echo 'Cleaning up (boot)' - @rm -f $(host-progs) $(EXTRA_TARGETS) - +@$(call descend,$(obj)/compressed) clean - archhelp: @echo '* bzImage - Compressed kernel image (arch/$(ARCH)/boot/bzImage)' @echo ' install - Install kernel using' diff --git a/arch/i386/boot/compressed/Makefile b/arch/i386/boot/compressed/Makefile index 53af39a4408e..16383b2df2fb 100644 --- a/arch/i386/boot/compressed/Makefile +++ b/arch/i386/boot/compressed/Makefile @@ -24,7 +24,3 @@ LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T $(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE $(call if_changed,ld) - -clean: - @echo 'Cleaning up (boot/compressed)' - @rm -f $(EXTRA_TARGETS) diff --git a/scripts/Makefile b/scripts/Makefile index 0921e79c6c79..6032efe0f0aa 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -11,6 +11,8 @@ EXTRA_TARGETS := fixdep split-include docproc conmakehash +subdir- := lxdialog + # Yikes. We need to build this stuff here even if the user only wants # modules. @@ -24,6 +26,8 @@ KBUILD_BUILTIN := 1 host-progs := fixdep split-include conmakehash docproc tkparse tkparse-objs := tkparse.o tkcond.o tkgen.o +clean-files := kconfig.tk + include $(TOPDIR)/Rules.make # In reality kconfig.tk should depend on all Config.in files, @@ -56,8 +60,3 @@ lxdialog: # fixdep is needed to compile other host programs $(obj)/split-include $(obj)/docproc $(addprefix $(obj)/,$(tkparse-objs)) \ $(obj)/conmakehash lxdialog: $(obj)/fixdep - -mrproper: - @rm -f $(host-progs) $(addprefix $(obj)/,$(tkparse-objs) kconfig.tk core) - @$(call descend,scripts/lxdialog,mrproper) - diff --git a/scripts/lxdialog/Makefile b/scripts/lxdialog/Makefile index da5e5a1ab32d..252c5bf86cd1 100644 --- a/scripts/lxdialog/Makefile +++ b/scripts/lxdialog/Makefile @@ -42,6 +42,3 @@ ncurses: echo ;\ exit 1 ;\ fi - -mrproper: - @rm -f $(host-progs) $(addprefix $(obj)/,$(lxdialog-objs)) -- cgit v1.2.3