How to set CFLAGS for the build step?

Max Laier max at love2party.net
Thu Apr 3 20:06:32 UTC 2008


On Wednesday 02 April 2008 18:34:42 Max Laier wrote:
> Hi,
>
> I have some trouble with sysutils/pftop.  It seems that if a user sets
> CFLAGS in make.conf the additional "CFLAGS+= -DHAVE_ALTQ=1" I have in
> the port's Makefile doesn't get through to the build step's
> environment. This might be due to the fact that this port uses the
> bsd.*.mk scripts, but I'm puzzled as to how to do this right.  Any
> insight?

Nothing helpful yet - so maybe I wasn't clear about the problem.  Attached 
is a small test port Makefile to demonstrate the problem.  The objective 
is to change the CFLAGS setting in there in a way that will result 
in "-addme" being part of the final output of:

   make MCONF=empty clean all
   make MCONF=test1 clean all
   make MCONF=test2 clean all
   make MCONF=test3 clean all

This currently works for empty and test{1,2}, but fails for test3.

This test3 uses a make.conf (passed via MAKE_ARGS= __MAKE_CONF=...) that 
has a

	CFLAGS= -test

line.

Any help appreciated!

-- 
/"\  Best regards,                      | mlaier at freebsd.org
\ /  Max Laier                          | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | mlaier at EFnet
/ \  ASCII Ribbon Campaign              | Against HTML Mail and News
-------------- next part --------------
PORTNAME=	cflags-test
PORTVERSION=	0.1
CATEGORIES=	sysutils

MAINTAINER=	mlaier at freebsd.org
COMMENT=	Test if CFLAGS are properly propagated to the build step

.include <bsd.port.pre.mk>

.if defined(MCONF)
MAKE_ARGS=	__MAKE_CONF=${WRKSRC}/${MCONF}
.endif

# CHANGE HERE
CFLAGS+= -addme
# CHANGE HERE

do-fetch:
	echo "Nothing to do"

do-extract:
	@mkdir -p ${WRKSRC}
	@touch ${WRKSRC}/empty
	@echo "CFLAGS?= -test" > ${WRKSRC}/test1
	@echo "CFLAGS+= -test" > ${WRKSRC}/test2
	@echo "CFLAGS= -test" > ${WRKSRC}/test3
	@echo "all:" > ${WRKSRC}/Makefile
	@echo "	@echo \"'\$${CFLAGS}'\"" >> ${WRKSRC}/Makefile
	@echo ".include <bsd.prog.mk>" >> ${WRKSRC}/Makefile

.include <bsd.port.post.mk>


More information about the freebsd-ports mailing list