Help writing a port: ENV variable

I'm trying to write a port for some work I'm doing and I have trouble with the conceptuals of the makefile.

Makefile:
# The ./configure script tries to use pkg-config to derive the SSL CFLAGS and
# libraries, but pkg-config requires libssl.pc which is only installed by the
# ports' security/openssl and not present in the base system. So if we are to
# use the base's SSL, then we trick ./configure to not use pkg-config by
# setting some related environment variables.
.if ${SSL_DEFAULT} == base
CONFIGURE_ENV+= CRYPTO_CFLAGS="-I${OPENSSLINC}" \
                CRYPTO_LIBS="-lcrypto" \
                SSL_CFLAGS="-I${OPENSSLINC}" \
                SSL_LIBS="-lssl"
.endif

pre-configure:
.if ! ${PORT_OPTIONS:MWALLET_BDBMODERN}
        @${SH} ${WRKSRC}/contrib/install_db4.sh ${WRKSRC}
        export BDB := "${WRKSRC}/db4"
        echo ${BDB}
        exit
.endif
        @${SH} ${WRKSRC}/autogen.sh

.include <bsd.port.mk>

The 'install_db4.sh' gets and installs db4 into the ${WRKSRC} successfully, but after that I need to set the environment variable BDB for ./configure to ${WRKSRC}/db4. No matter what I do, I don't get anything in ${BDB}.
I tried various "export" commands, and also the shell-style "BDB=${WRKSRC}" but no dice.
How do you set an environment variable in Makefile?
 
I found a workaround, no need for this, instead a little bit above I can set the env variables directly using the normal syntax instead of the "command:" mode


Makefile:
BDB_PREFIX=             ${WRKSRC}/db4
BDB_LIBS=               -L${BDB_PREFIX}/lib -ldb_cxx-4.8
BDB_CFLAGS=             -I${BDB_PREFIX}/include
CONFIGURE_ENV+=         BDB_LIBS="${BDB_LIBS}" BDB_CFLAGS="${BDB_CFLAGS}"
 
Back
Top