Re: [dev] Special target ".POSIX" in Makefiles

From: Laslo Hunhold <>
Date: Thu, 30 Dec 2021 23:07:35 +0100

On Thu, 30 Dec 2021 21:17:32 +0100
Mattias Andrée <> wrote:

Dear Mattias,

> I've actually being thinking of writing a makefile linter.
> How interested would people be in such a tool?

very interested! Even though, when you implement the logic, you might
as well go all the way and offer a make(1) that also offers linting
(comparable to mandoc(1)).

> The reason to have a linter separate from a make utility itself
> is that it would not have to reject non-standard features that
> you don't want to implement in make. And I also think it would for
> cleaner implementation of both projects. Additionally, I would
> suspect that a lot of people would just stay with GNU make because
> it's in every distro, so having it as a separate project would
> probably give it wider adoption.

You wouldn't have to reject non-standard features, but offer printing a
warning for undefined behaviour and non-standard extensions while still
supporting them to a certain extent, something like:

   $ snake -l
   Makefile:1:1: warning: Missing ".POSIX" target. warning: "?=" is a GNU-extension.
   Makefile:20:34: warning: A prerequisite must not contain a macro.

Optionally you could also choose to always print warnings and turn
them into hard errors with the l-flag.

It would be necessary to assess how many extensions are necessary
to implement. With sbase/ubase we found out that while GNU-extensions
are used, they are not all too widespread and only a small subset of
the entire GNU bloat.

With Makefiles you don't really need the GNU extensions and they,
as usual with GNU extensions, seem to originate from a misunderstanding
or caving in to simply wrong usage-patterns (just think of cat -v) by
users who probably don't know it better or about the right tools for the

Anyway, tl;dr: Such a strict POSIX-compliant make would be really awesome!
I'm sure many would pick it up. Null program wrote a great post[0]
about this topic, indicating that there's no tool out there that is
explicit about standard conformance, _especially_ undefined behaviour.

With best regards


Received on Thu Dec 30 2021 - 23:07:35 CET

This archive was generated by hypermail 2.3.0 : Thu Dec 30 2021 - 23:12:07 CET