* Makefile: Use standard variables and locations
@ 2021-03-20 21:03 Alejandro Colomar (man-pages)
2021-03-25 22:06 ` Jakub Wilk
0 siblings, 1 reply; 3+ messages in thread
From: Alejandro Colomar (man-pages) @ 2021-03-20 21:03 UTC (permalink / raw)
To: Michael Kerrisk (man-pages); +Cc: linux-man
Hi Michael,
There are a few points I think we should fix in the Makefile:
- Use standard variables:
* mandir (instead of MANDIR)
* htmldir (instead of HTDIR)
(see
<https://www.gnu.org/software/make/manual/html_node/Directory-Variables.html>)
- Use standard targets:
* separate html into html and install-html
* installdirs (instead of having 'mkdir -p'/'install -d' embedded in
targets)
(see
<https://www.gnu.org/software/make/manual/html_node/Standard-Targets.html#Standard-Targets>)
- '?=' is not needed, I think. When a user defines a variable in the
command line, that overwrites any definition in the Makefile.
- Is '|| exit $$?' really needed? AFAIK, make exits on error. Maybe
there's a corner case that make doesn't handle well and exit does,
though. I don't know.
- Use $(INSTALL_DATA) instead of using install directly.
- Specify SHELL = /bin/sh
Any thoughts?
Cheers,
Alex
--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Makefile: Use standard variables and locations
2021-03-20 21:03 Makefile: Use standard variables and locations Alejandro Colomar (man-pages)
@ 2021-03-25 22:06 ` Jakub Wilk
2021-03-28 11:57 ` Alejandro Colomar (man-pages)
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Wilk @ 2021-03-25 22:06 UTC (permalink / raw)
To: Alejandro Colomar; +Cc: Michael Kerrisk, linux-man
* Alejandro Colomar <alx.manpages@gmail.com>, 2021-03-20, 22:03:
>- Is '|| exit $$?' really needed? AFAIK, make exits on error.
Make catches errors, but shell doesn't by default. So if a recipe
contains more than a simple command, you need to care of error handling
yourself. For example:
$ printf 'all:\n\tfalse; echo moo\n' > Makefile
$ make
false; echo moo
moo
$ echo $?
0
>- Specify SHELL = /bin/sh
This is the default on Unix-like systems.
--
Jakub Wilk
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Makefile: Use standard variables and locations
2021-03-25 22:06 ` Jakub Wilk
@ 2021-03-28 11:57 ` Alejandro Colomar (man-pages)
0 siblings, 0 replies; 3+ messages in thread
From: Alejandro Colomar (man-pages) @ 2021-03-28 11:57 UTC (permalink / raw)
To: Jakub Wilk; +Cc: Michael Kerrisk, linux-man
Hi Jakub,
On 3/25/21 11:06 PM, Jakub Wilk wrote:
> * Alejandro Colomar <alx.manpages@gmail.com>, 2021-03-20, 22:03:
>> - Is '|| exit $$?' really needed? AFAIK, make exits on error.
>
> Make catches errors, but shell doesn't by default. So if a recipe
> contains more than a simple command, you need to care of error handling
> yourself. For example:
>
> $ printf 'all:\n\tfalse; echo moo\n' > Makefile
>
> $ make
> false; echo moo
> moo
>
> $ echo $?
> 0
Ahh, I see.
>
>> - Specify SHELL = /bin/sh
>
> This is the default on Unix-like systems.
Humm, yes, it feels better to not specify it. I was just following GNU
recommendations, but this one doesn't make much sense. I'll remove it.
Thanks,
Alex
--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-28 11:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-20 21:03 Makefile: Use standard variables and locations Alejandro Colomar (man-pages)
2021-03-25 22:06 ` Jakub Wilk
2021-03-28 11:57 ` Alejandro Colomar (man-pages)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox