From: Alejandro Colomar <alx@kernel.org>
To: Larry Kollar <larry.kollar@icloud.com>
Cc: Groff <groff@gnu.org>, linux-man@vger.kernel.org
Subject: Re: Using LS/LE (was: [PATCH v4 2/4] man/man5/tunables.conf: Document system-wide tunables config)
Date: Sat, 29 Aug 2026 11:02:53 +0200 [thread overview]
Message-ID: <apKgD9rwWO0ejh41@devuan> (raw)
In-Reply-To: <apKdoCfK_tYf5wX8@devuan>
[-- Attachment #1: Type: text/plain, Size: 3938 bytes --]
> Date: 2026-08-29 10:53:02+0200
> From: Alejandro Colomar <alx@kernel.org>
>
> > Date: 2026-08-29 10:45:34+0200
> > From: Alejandro Colomar <alx@kernel.org>
> >
> > > Date: 2026-08-29 10:42:14+0200
> > > From: Alejandro Colomar <alx@kernel.org>
> > >
> > > Hi Larry,
> > >
> > > > Date: 2026-08-28 22:50:50-0400
> > > > From: Larry Kollar <larry.kollar@icloud.com>
> > > >
> > > >
> > > > Alejandro Colomar <alx@kernel.org> wrote:
> > > >
> > > > > I believe that a set of makefiles that would handle all of the targets
> > > > > of a project like groff wouldn't take much more than that. It might be
> > > > > a few hundred kB. If it's well organized, it can be maintainable.
> > > > >
> > > > > Because the makefile language is so simple, bugs are easy to spot and
> > > > > fix, compared to autotools (possibly automake, but I can't distinguish
> > > > > them enough).
> > > >
> > > > I don’t know. Can a Makefile check for the presence of certain libraries
> > > > or other apps and fail gracefully (by which I mean exiting with a message
> > > > like “You need app X, plus libraries Y and Z, installed to successfully
> > > > compile this.”)? That’s one of the things that “makes" me appreciate taking
> > > > that extra step of typing `.configure` before make.
> > >
> > > Yes, it can. Here's a trivial test for that:
> > >
> > > alx@devuan:~/tmp/testlib$ cat Makefile
> > > HAS_LIBFOO := $(shell find /usr/include/foo.h >/dev/null && echo yes || echo no)
>
> You can also trivially test with gcc(1) instead of find(1):
>
> $ echo '#include <foo.h>' | gcc -x c -E >/dev/null 2>&1 && echo yes || echo no
> no
>
> If you put that expression within $(shell ...), you can use it similarly.
Of course, I had some typos there.
Here's a fully working example:
alx@devuan:~/tmp/testlib$ cat Makefile
CC ::= cc
HAS_STDLIB ::= \
$(shell \
echo '#include <stdlib.h>' \
| $(CC) -x c - -E >/dev/null \
&& echo yes \
|| echo no; \
)
HAS_LIBFOO ::= \
$(shell \
echo '#include <foo.h>' \
| $(CC) -x c - -E >/dev/null \
&& echo yes \
|| echo no; \
)
ifeq ($(HAS_STDLIB),no)
$(error You need <stdlib.h> installed to successfully compile this)
endif
ifeq ($(HAS_LIBFOO),no)
$(error You need library FOO installed to successfully compile this)
endif
all:
echo Done
alx@devuan:~/tmp/testlib$ make
<stdin>:1:10: fatal error: foo.h: No such file or directory
compilation terminated.
Makefile:23: *** You need library FOO installed to successfully compile this. Stop.
Cheers,
Alex
>
>
> Cheers,
> alex
>
> > >
> > > ifeq ($(HAS_LIBFOO),no)
> > > $(error You need library FOO installed to successfully compile this.)
> >
> > Oh, I didn't need the period here...
> >
> > > endif
> > >
> > > all:
> > > echo Done
> > > alx@devuan:~/tmp/testlib$ make
> > > find: ‘/usr/include/foo.h’: No such file or directory
> > > Makefile:4: *** You need library FOO installed to successfully compile this.. Stop.
> >
> > ... make(1) already appended one here.
> >
> > :)
> >
> > >
> > > You may of course write more complex tests if you need. Anything that
> > > you can do with a shell script, you can do it with a Makefile.
> > >
> > > That said, I personally prefer to fail compilation due to missing header
> > > files. It's simpler, and there's not much difference. After all, if
> > > compilation fails for <foo.h>, it's trivial to run
> > >
> > > $ apt-file find /include/foo.h
> > >
> > > But if you want the test, you can have it.
> > >
> > >
> > > Have a lovely day!
> > > Alex
> > >
> > > --
> > > <https://www.alejandro-colomar.es>
> >
> >
> >
> > --
> > <https://www.alejandro-colomar.es>
>
>
>
> --
> <https://www.alejandro-colomar.es>
--
<https://www.alejandro-colomar.es>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-08-29 9:02 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 19:21 [PATCH v4 2/4] man/man5/tunables.conf: Document system-wide tunables config DJ Delorie
2026-08-06 14:37 ` Alejandro Colomar
2026-08-06 15:33 ` DJ Delorie
2026-08-06 19:14 ` Alejandro Colomar
2026-08-06 20:17 ` DJ Delorie
2026-08-06 20:31 ` Alejandro Colomar
2026-08-06 20:42 ` DJ Delorie
2026-08-07 2:12 ` G. Branden Robinson
2026-08-07 3:29 ` DJ Delorie
2026-08-07 3:49 ` G. Branden Robinson
2026-08-07 4:01 ` DJ Delorie
2026-08-07 4:09 ` G. Branden Robinson
2026-08-23 12:29 ` Using LS/LE (was: [PATCH v4 2/4] man/man5/tunables.conf: Document system-wide tunables config) Alejandro Colomar
2026-08-23 13:27 ` G. Branden Robinson
2026-08-23 13:55 ` Alejandro Colomar
2026-08-23 14:16 ` G. Branden Robinson
2026-08-23 15:06 ` Alejandro Colomar
2026-08-23 16:44 ` G. Branden Robinson
2026-08-23 19:30 ` Alejandro Colomar
2026-08-23 20:40 ` G. Branden Robinson
2026-08-23 23:11 ` Alejandro Colomar
2026-08-24 1:11 ` G. Branden Robinson
2026-08-24 2:01 ` Using LS/LE Collin Funk
2026-08-24 11:08 ` Alejandro Colomar
2026-08-24 11:00 ` Using LS/LE (was: [PATCH v4 2/4] man/man5/tunables.conf: Document system-wide tunables config) Alejandro Colomar
2026-08-23 22:31 ` autotools, was: Using LS/LE Ingo Schwarze
2026-08-24 0:09 ` Alejandro Colomar
2026-08-29 4:36 ` G. Branden Robinson
2026-08-29 11:34 ` Ingo Schwarze
2026-08-29 12:51 ` Alejandro Colomar
2026-08-29 19:16 ` G. Branden Robinson
2026-08-29 21:43 ` Alejandro Colomar
[not found] ` <8DE76435-CBDB-42D6-9E0F-9E27291560B6@icloud.com>
2026-08-29 8:42 ` Using LS/LE (was: [PATCH v4 2/4] man/man5/tunables.conf: Document system-wide tunables config) Alejandro Colomar
2026-08-29 8:45 ` Alejandro Colomar
2026-08-29 8:52 ` Alejandro Colomar
2026-08-29 9:02 ` Alejandro Colomar [this message]
2026-08-29 9:39 ` Ingo Schwarze
2026-08-29 13:10 ` configure separate from make or not (was: Using LS/LE) Alejandro Colomar
2026-08-29 15:31 ` configure separate from make or not Ingo Schwarze
2026-08-29 20:49 ` Alejandro Colomar
2026-08-30 13:17 ` Alejandro Colomar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=apKgD9rwWO0ejh41@devuan \
--to=alx@kernel.org \
--cc=groff@gnu.org \
--cc=larry.kollar@icloud.com \
--cc=linux-man@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox