Hi,

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---

Note the two empty lines (info "(make) Multi-Line").

I tried to use this trick with Automake, but it strips one line in the
generated Makefile.  This is how I tried using it:

--8<---------------cut here---------------start------------->8---
# Produce a warning/hint in cases where the Guix-provided hooks won't be
# installed.
define NL


endef

ifneq ($(GIT_CORE_HOOKS_PATH),)
$(warning Not installing Guix-provided git hooks; global hooks path set$(NL)\
tip: unset global git hooks path)
@ENDIF@

ifeq ($(GIT_HOOKS_DIR),)
$(warning Not installing Guix-provided git hooks; hooks dir not found$(NL)\
tip: do not use container environment when using a git worktree)
@ENDIF@

ifeq ($(GIT_CONFIG_FILE),)
$(warning Not installing Guix-provided git configurations; \
git config file not found$(NL)\
tip: do not use container environment when using a git worktree)
@ENDIF@
--8<---------------cut here---------------end--------------->8---

Note that the @ENDIF@ hack to avoid Automake tripping on Make 'endif'
syntax is from
<https://lists.gnu.org/archive/html/bug-automake/2001-11/msg00015.html>.
This part appears to work correctly here.

But the NL variable in the produced Makefile looks like:

--8<---------------cut here---------------start------------->8---
define NL

endef
--8<---------------cut here---------------end--------------->8---

Which I think is the reason the warning messages do not contain the
newline as I wanted them to:

--8<---------------cut here---------------start------------->8---
Makefile:8677: Not installing Guix-provided git hooks; hooks dir not found tip: 
do not use container environment when using a git worktree
--8<---------------cut here---------------end--------------->8---

Any idea how to accomplish this in Automake?

-- 
Thanks,
Maxim

Reply via email to