[ale] GNU Makefile auto target

alan at alanlee.org alan at alanlee.org
Thu Jun 11 11:42:34 EDT 2020


The first target is the default target only if you do not specify any. 
Not sure that's what the OP was asking. 

If you want something to always run before (eg. from the original email)
'all', make a .PHONY target (means no build products) 'foo' and make it
a dependency of all the rest of your targets.  I don't believe there is
a way to say target 'foo' is a dependency of everything else without
expressly adding it to each of their dependency lines.  Otherwise you
could have 'bar' with the same global directive and it would not be able
to reconcile the execution order priority between the two. 

-A 

On 2020-06-10 13:38, Derek Carter via Ale wrote:

> make it the first target in the makefile 
> 
> ``` 
> .PHONY: all 
> 
> all: foo 
> 
> foo: foo.c 
> gcc -o foo foo.c 
> ``` 
> 
> On Wed, Jun 10, 2020 at 7:30 AM Chris Fowler via Ale <ale at ale.org> wrote: 
> 
>> Is it possible to declare a target in GNU make which will always be execute first?  Even is I specify a target on the command line as in 'make all'. 
>> 
>> Chris _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> https://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> https://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.ale.org/pipermail/ale/attachments/20200611/e6f38174/attachment.html>


More information about the Ale mailing list