Hi Jan,

Jan Engelhardt <[email protected]> writes:

> On Tuesday 2026-06-02 15:35, Maxim Cournoyer wrote:
>>
>>Make (not Automake) can use the following snippet to define a newline
>>variable:
>>
>>--8<---------------cut here---------------start------------->8---
>>define newline
>>
>>
>>endef
>>--8<---------------cut here---------------end--------------->8---
>
> I do not think POSIX make supports that.
> So there is no guarantee it passes through automake.
>
> Portably, it's probably going to need
>
>       newline = $(printf '\n')
>
> (subject to availability of printf)
>
>       newline = $(echo)

I see. It'd be nice to have an Automake switch to tell it to
unapologetically target GNU Make ;-).  We already have GNU Make
constructs used in the Makefile.am file of the Guix project, and since
it can only run on GNU/Linux (or Hurd) systems, it doesn't seem a
problem to me that it depends on GNU Make for its build system.

>
>>ifneq ($(GIT_CORE_HOOKS_PATH),)
>
> Also not supported by POSIX make.
>
>>$(warning Not installing Guix-provided git hooks; global hooks path set$(NL)\
>>tip: unset global git hooks path)
>
> Also not supported by POSIX make.
>
> Have a pre-requisite instead and add it to everyting else:
>
> ```
> abcdef:
>       if test -z "$(GIT_CORE_HOOKS_PATH),)"; then \
>               echo Not installing...; \
>               echo Hint: ...; 
>       fi
>
> whatever: abcdef
> ```
>
> This also does away with the need for $(NL).

Thanks for the suggestions; I tried to implement it that way, but the
warning targets are phony targets, which when added as a prerequisite
cause its dependents targets to always run, which I'd like to avoid.

Perhaps I'll stick with the non-portable GNU Make tricks for now.

-- 
Thanks,
Maxim

Reply via email to