[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC] .NOT_DEFAULT: target
From: |
Boris Kolpackov |
Subject: |
Re: [RFC] .NOT_DEFAULT: target |
Date: |
Mon, 17 May 2004 17:18:09 -0500 |
User-agent: |
Mutt/1.5.6i |
Paul D. Smith <address@hidden> writes:
> The way I typically solve this is that I always define the target I want
> to be the default first, with no prerequisites etc. Simply putting
> something like:
>
> all:
>
> by itself at the top of the first makefile is enough to force make to
> consider that target to be the default. So, in your example you could
> change your makefile to:
>
> # file: makefile
> all:
> include boostrap.make
> all: $(out_root)/driver
> $(out_root)/driver: driver.c
There are two issues with this approach
- Now make prints "nothing to be done for all" instead of
"driver is up to date" which is bad (well, if you care).
- User makefiles are bloated with those unnecessary all's.
> Alternatively, if you have a makefile which is always included at the
> top (say your bootstrap.make file) you can put the "all" target in that
> file as the first thing:
Now you are forcing user to use the same name for default target which is
not always acceptable (well, at least not in my case).
> Mm. I don't know about this. It seems like it's the wrong way
> around... if what you want to have is the default target, why have
> people declare everything that _cannot_ be the default? Why not just
> declare what _IS_ the default?
A few thoughts:
- .NOT_DEFAULT is meant for the build system developers, not "people" ;-).
Now GNU make has powerful enough inclusions/scripting mechanisms that
make "generic" build systems possible. There are however features
that are still <makefile-is-one-big-file>-minded. "Default target is
first target" is one of them.
- Default target is the choice of a user makefile not the build system.
So default target is most likely going to be specified in a user
makefile. Putting it in other words, targets declared by the build
system should not be default. That's why we may want a mechanism to
express that.
To summarize: the default target is defined by a user makefile and there
is already a mechanism for doing that. Included makefiles need to say that
targets are not default and this mechanism is lacking.
I agree that it could be considered more logical to have explicit
declaration for default targets:
.DEFAULT: $(out_dir)/driver
I think it is roughly equivalent to .NOT_DEFAULT: except it would lead
to a bit more verbose user makefiles (.NOT_DEFAULT: would be used in a
*few* system files while .DEFAULT: will be used in *each* user makefile).
And it wouldn't be backward compatible, of course ;-).
thanks,
-boris
signature.asc
Description: Digital signature