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




> On Oct 5, 2026, at 2:45 PM, Valery Ushakov via gnats <gnats-admin%NetBSD.org@localhost> wrote:
> 
> 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 21:38:34 +0300
> 
>> ```
>> CPPFLAGS = -I/usr/include -I/usr/X11R7/include
>> CPPFLAGS := ${CPPFLAGS} -I${.PARSEDIR}
>> # CPPFLAGS += -I${.PARSEDIR}
>> CPPFLAGS += -I/usr/local/include
> 
> Consider the case where the first assignment to CPPFLAGS contains a
> variable reference that you do _not_ want to expand immediately when
> that := runs
> 
> -uwe


thinkpad$ cat Makefile
DELAYED = wrong value
CPPFLAGS = -I/usr/include -I/usr/X11R7/include ${DELAYED}
MYPARSEDIR := ${.PARSEDIR}
CPPFLAGS += -I${MYPARSEDIR}
CPPFLAGS += -I/usr/local/include

.include "subdir/more.mk"

.PHONY: all

all:
 	@echo cc ${CPPFLAGS}
thinkpad$ cat subdir/more.mk
DELAYED = right value
thinkpad$ make
cc -I/usr/include -I/usr/X11R7/include right value -I/home/rob/tmp_make -I/usr/include
thinkpad$ 


Home | Main Index | Thread Index | Old Index