Subject: Re: MAKE_PROGRAM and tools.mk [Was: Re: CVS commit: pkgsrc/security/openssl]
To: Johnny C. Lam <jlam@netbsd.org>
From: Simon J. Gerraty <sjg@crufty.net>
List: tech-pkg
Date: 08/25/2003 23:23:09
>+
>+# 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?

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.

--sjg