bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

embedded newlines in shell function variable expansion


From: Byrnes, Robert
Subject: embedded newlines in shell function variable expansion
Date: Fri, 9 Oct 2020 15:03:24 +0000

If I use this Makefile ...

----------------
bash$ cat Makefile
FOO := $(shell echo $(ENTRIES) ; )
BAR := $(shell echo $(ENTRIES)   )

all:
        @echo FOO = $(FOO)
        @echo BAR = $(BAR)

.PHONY: all
----------------

... and set ENTRIES with embedded newlines, then this happens:

----------------
bash$ make 'ENTRIES=
blartz
blurfl
'
FOO = blartzblurfl
BAR = blartz blurfl
----------------

Why is the embedded whitespace removed in the first (FOO) case?  It seems 
related to the semicolon shell metacharacter ...

----------------
bash$ make --version
GNU Make 4.3
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
----------------

Thanks,

--
Bob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]