Is it possible to get make variable without recursive expansion?

Hiroki Sato hrs at FreeBSD.org
Fri Feb 7 19:46:56 UTC 2014


Lev Serebryakov <lev at freebsd.org> wrote
  in <12310461351.20140207203417 at serebryakov.spb.ru>:

le> Hello, Freebsd-hackers.
le>
le>
le>  Suppose, I have in my Makefile such construction:
le>
le> A=xxx
le> B=yyy
le> ANB=${A} and ${B}
le>
le>  Is it possible to get value of ANB without recursive expansion, i.e. string
le> "${A} and ${B} and" in this case? I know, that all expansions are done at
le> last moment (If I don't use ":=" operator), but is it possible to block
le> second- and more-level expansion?
le>
le>  I need to output "ANB=${ANB}" construction to external file without further
le> expansion...

 This may be what you want but works only with bmake:

----Makefile----
A=xxx
B=yyy
ANB=${A} and ${B}

all:
	@echo ANB=$$(make -VANB)
	@echo ANB=$$(make .MAKE.EXPAND_VARIABLES=0 -VANB)
----Makefile----

-- Hiroki
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20140208/ed707321/attachment.sig>


More information about the freebsd-hackers mailing list