Hi Larry, > Date: 2026-08-28 22:50:50-0400 > From: Larry Kollar <[email protected]> > > > Alejandro Colomar <[email protected]> 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)
ifeq ($(HAS_LIBFOO),no)
$(error You need library FOO installed to successfully compile this.)
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.
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>
signature.asc
Description: PGP signature
