summaryrefslogtreecommitdiff
path: root/mk/tools.mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2003-08-26 20:15:23 +0000
committerjlam <jlam@pkgsrc.org>2003-08-26 20:15:23 +0000
commit9fbdc941fea7d21de5d5b90812f86cfcc394704e (patch)
tree8b1c3bab1e6dabee92b179dc0fdf2dc62269e99a /mk/tools.mk
parent4826d368a2175f7a2e4026e3ee433f5c184ee2a4 (diff)
downloadpkgsrc-9fbdc941fea7d21de5d5b90812f86cfcc394704e.tar.gz
Create a symlink from the "make" requested by the package into
${TOOLS_DIR}/bin/make. If a package wants GNU make, then it should set: USE_GNU_TOOLS+= make in the package Makefile. Allow for USE_GMAKE to continue to work until we get a chance to sweep through pkgsrc and remove the usage of this now-redundant variable. This change allows us to avoid patching makefiles that use a bare "make" command to invoke sub-make processes. Idea suggested by salo@netbsd.org in pkg/22509.
Diffstat (limited to 'mk/tools.mk')
-rw-r--r--mk/tools.mk41
1 files changed, 39 insertions, 2 deletions
diff --git a/mk/tools.mk b/mk/tools.mk
index b0c6443e566..b88eaf2ac8f 100644
--- a/mk/tools.mk
+++ b/mk/tools.mk
@@ -1,4 +1,4 @@
-# $NetBSD: tools.mk,v 1.9 2003/08/17 04:06:36 jlam Exp $
+# $NetBSD: tools.mk,v 1.10 2003/08/26 20:15:27 jlam Exp $
#
# This Makefile creates a ${TOOLS_DIR} directory and populates the bin
# subdir with tools that hide the ones outside of ${TOOLS_DIR}.
@@ -113,7 +113,7 @@ ${TOOLS_DIR}/bin/makeinfo: ${_GNU_MISSING}
# defining e.g. USE_GNU_TOOLS+="awk sed". Version numbers are not
# considered.
-_TOOLS= awk grep sed
+_TOOLS= awk grep make sed
.if defined(_IGNORE_USE_GNU_TOOLS)
USE_GNU_TOOLS:= # empty
@@ -128,6 +128,7 @@ USE_GNU_TOOLS?= # empty
_TOOLS_OPSYS_HAS_GNU.awk+= FreeBSD-*-* Linux-*-* NetBSD-*-* OpenBSD-*-*
_TOOLS_OPSYS_HAS_GNU.grep+= Darwin-*-* FreeBSD-*-* Linux-*-*
_TOOLS_OPSYS_HAS_GNU.grep+= NetBSD-*-* OpenBSD-*-*
+_TOOLS_OPSYS_HAS_GNU.make+= Darwin-*-*
_TOOLS_OPSYS_HAS_GNU.sed+= Linux-*-*
# These platforms have GNUish versions of the tools available in the base
@@ -137,6 +138,7 @@ _TOOLS_OPSYS_HAS_GNU.sed+= Linux-*-*
#
_TOOLS_REPLACE_OPSYS.awk+= SunOS-*-*
_TOOLS_REPLACE_OPSYS.grep+= SunOS-*-*
+_TOOLS_REPLACE_OPSYS.make+= # empty
_TOOLS_REPLACE_OPSYS.sed+= SunOS-*-*
# These platforms have completely unusable versions of these tools, and
@@ -144,6 +146,7 @@ _TOOLS_REPLACE_OPSYS.sed+= SunOS-*-*
#
_TOOLS_OPSYS_INCOMPAT.awk+= # empty
_TOOLS_OPSYS_INCOMPAT.grep+= # empty
+_TOOLS_OPSYS_INCOMPAT.make+= # empty
_TOOLS_OPSYS_INCOMPAT.sed+= # empty
# Default to not requiring GNU tools.
@@ -214,6 +217,21 @@ _TOOLS_OVERRIDE.grep= NO
MAKEFLAGS+= _IGNORE_USE_GNU_TOOLS=
.endif
+.if ${_TOOLS_REPLACE.make} == "YES"
+_TOOLS_OVERRIDE.make= YES
+_TOOLS_PROGNAME.make= ${GMAKE}
+.endif
+.if (${_TOOLS_NEED_GNU.make} == "YES") && empty(PKGPATH:Mdevel/gmake)
+BUILD_DEPENDS+= gmake>=3.78:../../devel/gmake
+_TOOLS_OVERRIDE.make= YES
+_TOOLS_PROGNAME.make= ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}make
+GREP:= ${_TOOLS_PROGNAME.make}
+.endif
+.if !empty(PKGPATH:Mdevel/gmake)
+_TOOLS_OVERRIDE.make= NO
+MAKEFLAGS+= _IGNORE_USE_GNU_TOOLS=
+.endif
+
.if ${_TOOLS_REPLACE.sed} == "YES"
_TOOLS_OVERRIDE.sed= YES
_TOOLS_PROGNAME.sed= ${SED}
@@ -246,4 +264,23 @@ ${TOOLS_DIR}/bin/${_tool_}:
. endif
.endfor
+# 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} \
+ case ${MAKE_PROGRAM} in \
+ /*) src="${MAKE_PROGRAM}" ;; \
+ *) src=`${TYPE} ${MAKE_PROGRAM} | ${AWK} '{ print $$NF }'` ;; \
+ esac; \
+ if [ -x $$src -a ! -f ${.TARGET} ]; then \
+ ${MKDIR} ${.TARGET:H}; \
+ ${LN} -sf $$src ${.TARGET}; \
+ fi
+.endif
+
.endif # TOOLS_MK