<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>The first target is the default target only if you do not specify any. Not sure that's what the OP was asking.</p>
<p>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.</p>
<p>-A</p>
<p>On 2020-06-10 13:38, Derek Carter via Ale wrote:</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<div dir="ltr">
<div>make it the first target in the makefile</div>
<div> </div>
<div>```</div>
<div>.PHONY: all</div>
<div> </div>
<div>all: foo</div>
<div> </div>
<div>foo: foo.c</div>
<div> gcc -o foo foo.c</div>
<div>```</div>
</div>
<br />
<div class="gmail_quote">
<div class="gmail_attr" dir="ltr">On Wed, Jun 10, 2020 at 7:30 AM Chris Fowler via Ale <<a href="mailto:ale@ale.org">ale@ale.org</a>> wrote:</div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;">
<div>
<div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000;">
<div>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'.</div>
<div> </div>
<div>Chris</div>
</div>
</div>
_______________________________________________<br /> Ale mailing list<br /> <a href="mailto:Ale@ale.org">Ale@ale.org</a><br /> <a href="https://mail.ale.org/mailman/listinfo/ale" target="_blank" rel="noopener noreferrer">https://mail.ale.org/mailman/listinfo/ale</a><br /> See JOBS, ANNOUNCE and SCHOOLS lists at<br /> <a href="http://mail.ale.org/mailman/listinfo" target="_blank" rel="noopener noreferrer">http://mail.ale.org/mailman/listinfo</a></blockquote>
</div>
<br />
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">_______________________________________________<br /> Ale mailing list<br /> <a href="mailto:Ale@ale.org">Ale@ale.org</a><br /> <a href="https://mail.ale.org/mailman/listinfo/ale" target="_blank" rel="noopener noreferrer">https://mail.ale.org/mailman/listinfo/ale</a><br /> See JOBS, ANNOUNCE and SCHOOLS lists at<br /> <a href="http://mail.ale.org/mailman/listinfo" target="_blank" rel="noopener noreferrer">http://mail.ale.org/mailman/listinfo</a></div>
</blockquote>
<p><br /></p>
</body></html>