NetBSD-Bugs archive

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

Re: bin/60850: Make could do with a syntax for immediate var expansion



The following reply was made to PR bin/60850; it has been noted by GNATS.

From: Valery Ushakov <uwe%stderr.spb.ru@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/60850: Make could do with a syntax for immediate var
 expansion
Date: Mon, 5 Oct 2026 14:07:10 +0300

 A slighly less kludgy (but still kludgy) way to do that is to use the
 fact that the for-loop variables are expanded immediately:
 
 $ cat Makefile
 VAR = private
 .for VAR_VALUE in $(VAR)
 a += "-D$(VAR_VALUE)"
 .endfor
 
 VAR = include
 .for VAR_VALUE in $(VAR)
 a += "-I/path/$(VAR_VALUE)"
 .endfor
 
 default:
 	@echo "VAR=$(VAR)"
 	@echo a=$(a)
 $ make
 VAR=include
 a=-Dprivate -I/path/include
 $ 
 
 -uwe
 



Home | Main Index | Thread Index | Old Index