Messages in this thread |  | | From | Peter Samuelson <> | Date | Wed, 1 Nov 2000 09:03:23 -0600 (CST) | Subject | Re: [PATCH] list-style makefile boilerplate without reordering |
| |
[Christoph Hellwig <hch@caldera.de>] > + > +# include a local makefile, if present > +-include Makefile.local
Why?
> +%.i: %.c > + $(CPP) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) $< > $@
Why? Well, I know, it's historical, but does anyone think we actually need this?
> +%.s: %.S > + $(CPP) $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$@) $< > $@
Ditto.
> +# Rule to compile a set of .o files into one .o file > +$(O_TARGET): $(obj-y) > + rm -f $@ > + ifneq "$(strip $(obj-y))" "" > + $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(obj-y), $^) > + else > + $(AR) rcs $@ $(filter $(obj-y), $^) ^^^^^^^^^^^^^^^^^^^^^^ We have just determined that this is empty. I think it would be more readable to say
$(AR) rcs $@
The whole line is a clever hack to produce something in the event of an empty list, and this makes it more obvious what is going on.
> +# this make dependencies (not that ...) quickly > +fastdep: dummy > + $(TOPDIR)/scripts/mkdep $(wildcard *.[chS] local.h.master) > .depend > +ifdef all-subdirs > + $(MAKE) $(patsubst %,_sfdep_%,$(all-subdirs)) _FASTDEP_ALL_SUB_DIRS="$(all-subdirs)" > +endif > + > +ifdef _FASTDEP_ALL_SUB_DIRS > +$(patsubst %,_sfdep_%,$(_FASTDEP_ALL_SUB_DIRS)): > + $(MAKE) -C $(patsubst _sfdep_%,%,$@) fastdep > +endif
This needs rethinking. I know this is how Rules.make does it, but wouldn't it be faster to eliminate one level of recursion?
fastdep: dummy $(patsubst %,_sfdep_%,$(all-subdirs)) $(TOPDIR)/scripts/mkdep $(wildcard *.[chS] local.h.master) > .depend $(patsubst %,_sfdep_%,$(all-subdirs)): $(MAKE) -C $(patsubst _sfdep_%,%,$@) fastdep
Untested, but is there some reason that wouldn't work? Order of execution shouldn't matter to mkdep, right?
> +# a rule to make subdirectories > +sub_dirs: dummy $(patsubst %,_subdir_%,$(subdir-y)) > + > +ifdef subdir-y ^^^^^^^^^^^^^^ ifneq "$(strip $(subdir-y))" ""
> +PDWN=$(shell $(CONFIG_SHELL) $(TOPDIR)/scripts/pathdown.sh)
I think invoking pathdown.sh is probably unnecessary, see below.
> +.PHONY: $(patsubst %,_modinst_%,$(subdir-m)) > +$(patsubst %,_modinst_%,$(subdir-m)) : dummy > + $(MAKE) -C $(patsubst _modinst_%,%,$@) modules_install > +endif
This is the only case where $(PDWN) is needed, so IMHO we should just supply it internally -- faster than a shell process:
$(patsubst %,_modinst_%,$(subdir-m)): dummy $(MAKE) -C $(patsubst _modinst_%,%,%@ modules_install \ PDWN=$(PDWN)$(patsubst _modinst_%,%,%@)/
Or, if that looks funny, we can initialize PDWN to '.' in $(TOPDIR)/Makefile and use ...PDWN=$(PDWN)/$(patsubst _modinst_%,%,%@)
> +ifdef CONFIG_MODULES > +ifdef CONFIG_MODVERSIONS [...] > +ifdef CONFIG_SMP
Eric Raymond won't like this. He at one point was pushing for phasing out and eliminating 'ifdef CONFIG_*' from makefiles so he could define CONFIG_* to be 'n' as distinguished from ''. I think it's a good idea.
ifneq "$(CONFIG_MODULES)$(CONFIG_MODVERSIONS)" "" [...] ifneq "$(CONFIG_SMP)" ""
Peter - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
|  |