Subject: Re: MAKE_PROGRAM and [Was: Re: CVS commit: pkgsrc/security/openssl]
To: Simon J. Gerraty <>
From: Johnny C. Lam <>
List: tech-pkg
Date: 08/26/2003 07:16:01
On Mon, Aug 25, 2003 at 11:23:09PM -0700, Simon J. Gerraty wrote:
> >+
> >+# Always provide a symlink from ${TOOLS_DIR}/bin/make to the "make"
> >+# used to build the package.  The following only creates the symlink
> >+# if GNU make isn't required (and already symlinked from above).
> >+#
> >+override-tools: ${TOOLS_DIR}/bin/make
> >+
> >+.if !target(${TOOLS_DIR}/bin/make)
> >+${TOOLS_DIR}/bin/make:
> >+	${_PKG_SILENT}${_PKG_DEBUG}					\
> >+	src=`${TYPE} ${MAKE_PROGRAM} | ${AWK} '{ print $$NF }'`;	\
> >+	if [ -x $$src -a ! -f ${.TARGET} ]; then			\
> >+		${MKDIR} ${.TARGET:H};					\
> >+		${LN} -sf $$src ${.TARGET};				\
> >+	fi
> >+.endif
> I don't claim to have been following this thread, so no comments on
> the notion of ${TOOLS_DIR}/bin/make ... though I gather its trying to 
> cater for folk who put bare 'make' commands in makefiles?

Yes, that's right.  It allows us to avoid patching those Makefiles if
we don't want to.  The software author is clearly wrong to put bare
"make" commands into Makefiles, but it's common enough that it's
annoying to keep patching around.

> Anyway, the above looks rather expensive.  How often will this be invoked?
> Once per-package?  Why not at least put an .if !exists(${TOOLS_DIR}/bin/make)
> in there to avoid running awk.

This gets invoked once per package.  I thought that I had the logic
correct: if ${TOOLS_DIR}/bin/make already exists, then the target is
already up-to-date so the target commands won't be executed, right?
So, I shouldn't need to put in the .if !exists(...) because make(1)
already does the equivalent thing as part of its dependency checking.
Is that right?


	-- Johnny Lam <>