Hi again,

Maxim Cournoyer <[email protected]> writes:

> Hi,
>
> Make (not Automake) can use the following snippet to define a newline
> variable:
>
> define newline
>
>
> endef
>
>
> 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:
>
> # Produce a warning/hint in cases where the Guix-provided hooks won't be
> # installed.
> define NL
>
>
> endef

I found a trick that works:

--8<---------------cut here---------------start------------->8---
override EMPTY :=
define NL

$(EMPTY)
endef
--8<---------------cut here---------------end--------------->8---

This preserves the $(EMPTY) variable in the Makefile, which is expands
to nothing, so that's fine.

The warning messages were then split like this:

--8<---------------cut here---------------start------------->8---
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---

The result looks like:

--8<---------------cut here---------------start------------->8---
$ make git-hooks
Makefile:8681: Not installing Guix-provided git hooks; hooks dir not found
tip: do not use container environment when using a git worktree
Makefile:8686: Not installing Guix-provided git configurations; git config file 
not found
tip: do not use container environment when using a git worktree
--8<---------------cut here---------------end--------------->8---

-- 
Thanks,
Maxim

Reply via email to