tech-pkg archive

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

Re: Makefile PATH modification with -current 'make'?



>The problem with -current 'make' only showed up when I tried to build
>"/usr/pkgsrc/wip/moto4lin".  Prior to that, I built all packages in my
>usual complement without incident (modulo pkg/51266).

So the problem is _PATH_CMD in bsd.pkg.mk
which is apparently used rarely - according to the comment.

And your failing makefile uses it with :=
so will have been broken since

var.c:
----------------------------
revision 1.201
date: 2016-01-08 16:55:17 -0800;  author: christos;  state: Exp;  lines:
+35 -27;  commitid: VJA69WRfu8Jb0cQy;
Preserve $$ in := assignments..

FOO=\$$CRAP
BAR:=${FOO}

all:
        echo ${FOO}
	echo ${BAR}
----------------------------
		
I added the .MAKE.SAVE_DOLLARS knob to be able to retain the previous
behavior which many makefiles depend on - especialy some really
important ones (to me and $work) like my dirdeps.mk:

----------------------------
revision 1.205
date: 2016-02-19 17:19:03 -0800;  author: sjg;  state: Exp;  lines: +19
-5;  commitid: Y7B9A8fKvRsLMAVy;
Add a knob .MAKE.SAVE_DOLLARS to control the behavior of $$ during :=

If TRUE '$$' are not consumed (saved).
If FALSE '$$' becomes '$' just like normal expansion rules.

default is TRUE.
----------------------------

Here's a little test makefile to demo:

ECHO= echo
PREPEND_PATH= ${HOME}/some/where

# This is very Special.  Because PREPEND_PATH is set with += in reverse order,
# this command reverses the order again (since bootstrap bmake doesn't
# yet support the :[-1..1] construct).
_PATH_CMD= \
	path=${_PATH_ORIG:Q};						\
	for i in ${PREPEND_PATH}; do path="$$i:$$path"; done;		\
	${ECHO} "$$path"
PATH=	${_PATH_CMD:sh} # DOES NOT use :=, to defer evaluation

# FAIL will work or not depending on .MAKE.SAVE_DOLLARS
# default true - it fails, if false (traditional behavor) it works
OK= ${PATH}
FAIL:= ${PATH}

all:
	@echo OK=${OK}
	@echo FAIL=${FAIL}

	

$ PATH=/bin:/usr/bin make -r -f that
OK=/homes/sjg/some/where:/bin:/usr/bin
FAIL=15489path
$
$ PATH=/bin:/usr/bin make -r -f that .MAKE.SAVE_DOLLARS=no
OK=/homes/sjg/some/where:/bin:/usr/bin
FAIL=/homes/sjg/some/where:/bin:/usr/bin
$

Options are to

a/ avoid :=
b/ .MAKE.SAVE_DOLLARS=no

--sjg



Home | Main Index | Thread Index | Old Index