From: Peter Samuelson <peter@cadcamlab.org>
To: Christoph Hellwig <hch@caldera.de>
Cc: torvalds@transmeta.com, linux-kbuild@torque.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] list-style makefile boilerplate without reordering
Date: Wed, 1 Nov 2000 09:03:23 -0600 (CST) [thread overview]
Message-ID: <14848.12475.791640.17546@wire.cadcamlab.org> (raw)
In-Reply-To: <20001101125837.A28861@caldera.de>
[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/
next prev parent reply other threads:[~2000-11-01 15:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-11-01 11:58 Christoph Hellwig
2000-11-01 15:03 ` Peter Samuelson [this message]
2000-11-02 12:52 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=14848.12475.791640.17546@wire.cadcamlab.org \
--to=peter@cadcamlab.org \
--cc=hch@caldera.de \
--cc=linux-kbuild@torque.net \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®