> Date: 2026-08-29 10:45:34+0200
> From: Alejandro Colomar <[email protected]>
>
> > Date: 2026-08-29 10:42:14+0200
> > From: Alejandro Colomar <[email protected]>
> >
> > 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)

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.


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>

Attachment: signature.asc
Description: PGP signature

        • ... Alejandro Colomar
  • ... Ingo Schwarze
    • ... Alejandro Colomar
    • ... Larry Kollar via discussion of the GNU roff typesetting system and related software
    • ... G. Branden Robinson
      • ... Ingo Schwarze
        • ... Alejandro Colomar
  • ... Larry Kollar via discussion of the GNU roff typesetting system and related software
    • ... Alejandro Colomar
      • ... Alejandro Colomar
        • ... Alejandro Colomar
          • ... Alejandro Colomar
    • ... Ingo Schwarze
      • ... Alejandro Colomar

Reply via email to