Download raw body.
SUBST_VARS= or SUBST_VARS+= ?
22.11.2025 20:00, Stuart Cassoff пишет:
> I count about 300 ports using += and 200 using =.
> Which is correct?
> If there is a correct one, could it be put into Makefile.template?
For SUBST_VARS both = and += will do the same, assuming it happens
before the bsd.port.mk include, after which defaults will only be
added to it.
Other variables like CFLAGS, however, do behave differently as they
are already defined outside the ports framework:
$ make -f /dev/null -V CFLAGS
-O2 ${PIPE} ${DEBUG}
Personally, I try to strictly use = on the first assignment and +=
later on unless I want to the keep the defaults like for CFLAGS.
Reading += makes me think there was an assignment already somewhere
above in the file.
My impression is others sometimes write FOO += bar in the spirit of
"add this to whatever bsd.port.mk comes up with", which in the end
works out, but is not what really happens.
Given Makefile.template uses = consistently except for DIST_TUPLES
and ERRORS, I'd argue any future amendment should use =.
My 2 cents, anyways.
SUBST_VARS= or SUBST_VARS+= ?