On Thu, Dec 30, 2021 at 09:17:32PM +0100, Mattias Andrée wrote:
> I've actually being thinking of writing a makefile linter.
> How interested would people be in such a tool?
>
> 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.
I'd definitely be interested in such a tool. Weather it be in form of a
make implementation or linter doesn't matter a whole lot to me as long
as the end goal of having a tool to help write portable makefile is
achieved.
On Thu, Dec 30, 2021 at 11:07:35PM +0100, Laslo Hunhold wrote:
> $ snake -l
> Makefile:1:1: warning: Missing ".POSIX" target.
> config.mk:2:4: warning: "?=" is a GNU-extension.
> Makefile:20:34: warning: A prerequisite must not contain a macro.
> $
Hmm, I was under the impression that `?=` was accepted into POSIX. But I
cannot find any mention of it in the posix manpage (man 1p make) so I
guess I was wrong.
What would be a posix replacement for `?=` ? I assume something like:
VAR = $$(if test -n "$$VAR"; then printf "%s" "$$VAR"; else printf
"fallback"; fi)
- NRK