help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: is there a make style guide somewhere?


From: David
Subject: Re: is there a make style guide somewhere?
Date: Sat, 2 Nov 2019 14:37:56 +1100

On Fri, 1 Nov 2019 at 02:08, Robert P. J. Day <address@hidden> wrote:

[...]

>   my suggestion was, for any targets for which it is feasible to
> invoke directly, add a redirection(?) target with a meaningful name:
>
>   turn_src_into_elf: $(OUTPUT_DIR)/target.elf
>   $(OUTPUT_DIR)/target.elf: $(INPUT_DIR)/src.c
>         ... do what it takes to turn src.c into target.elf ...
>
> at which point, of course:
>
>   $ make turn_src_into_elf
>
> does this make sense? is it a well-known make idiom? is there a list
> somewhere of such idioms and style recommendations?

Makes sense to me.

FYI, because the recipe does not actually create a file named
"turn_src_into_elf", it is named a "phony target", and it is a
good idea to inform make that fact, using this statement:
.phony turn_src_into_elf

Doing so has some benefits, which are documented here:
https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targets

I use them a lot, so I consider them well known.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]