summaryrefslogtreecommitdiff
path: root/mk/misc
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2007-01-02 21:29:07 +0000
committerrillig <rillig@pkgsrc.org>2007-01-02 21:29:07 +0000
commit43908c44cca56bed0b7ed87b40a229fd90321771 (patch)
treed570516cf0c477f61fa2608a856c32c27a0adc76 /mk/misc
parentb57f0d45fb836d211db389b7e4125d1097496cb6 (diff)
downloadpkgsrc-43908c44cca56bed0b7ed87b40a229fd90321771.tar.gz
Moved the show-tools target to misc/show.mk.
Moved the changes-entry target to misc/developer.mk. To save some time, that file is only included when PKG_DEVELOPER is defined. Moved the build-defs-message target to misc/show.mk and renamed it to show-build-defs, since almost all other *-message targets just print a single line.
Diffstat (limited to 'mk/misc')
-rw-r--r--mk/misc/developer.mk44
-rw-r--r--mk/misc/show.mk67
2 files changed, 111 insertions, 0 deletions
diff --git a/mk/misc/developer.mk b/mk/misc/developer.mk
new file mode 100644
index 00000000000..1ee5f7eb47f
--- /dev/null
+++ b/mk/misc/developer.mk
@@ -0,0 +1,44 @@
+# changes-entry appends a correctly-formatted entry to the pkgsrc
+# CHANGES file.
+#
+# The following variables may be set:
+#
+# CTYPE is the type of entry to add and is one of "Added", "Updated",
+# "Renamed", "Moved", of "Removed". The default CTYPE is "Updated".
+#
+# NETBSD_LOGIN_NAME is the login name assigned by the NetBSD Project.
+# It defaults to the local login name.
+#
+# PKGSRC_CHANGES is the path to the CHANGES file to which the entry
+# is appended. It defaults to ${PKGSRCDIR}/doc/CHANGES-YYYY.
+#
+# Example usage:
+#
+# % cd /usr/pkgsrc/category/package
+# % make changes-entry CTYPE=Added
+#
+CTYPE?= Updated
+NETBSD_LOGIN_NAME?= ${_NETBSD_LOGIN_NAME_cmd:sh}
+PKGSRC_CHANGES?= ${PKGSRCDIR}/doc/CHANGES-${_CYEAR_cmd:sh}
+
+_CYEAR_cmd= ${DATE} -u +%Y
+_CDATE_cmd= ${DATE} -u +%Y-%m-%d
+_NETBSD_LOGIN_NAME_cmd= ${ID} -nu
+
+_CTYPE1= " "${CTYPE:Q}" "${PKGPATH:Q}
+.if !empty(CTYPE:MUpdated)
+_CTYPE2= " to "${PKGVERSION:Q}
+.elif !empty(CTYPE:MAdded)
+_CTYPE2= " version "${PKGVERSION:Q}
+.elif !empty(CTYPE:MRenamed) || !empty(CTYPE:MMoved)
+_CTYPE2= " to XXX"
+.else
+_CTYPE2=
+.endif
+_CTYPE3= " ["${NETBSD_LOGIN_NAME:Q}" "${_CDATE_cmd:sh:Q}"]"
+
+.PHONY: changes-entry
+changes-entry:
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${ECHO} ${_CTYPE1}${_CTYPE2}${_CTYPE3} >> ${PKGSRC_CHANGES:Q}
+
diff --git a/mk/misc/show.mk b/mk/misc/show.mk
new file mode 100644
index 00000000000..cbe21c0ea07
--- /dev/null
+++ b/mk/misc/show.mk
@@ -0,0 +1,67 @@
+# $NetBSD: show.mk,v 1.1 2007/01/02 21:29:07 rillig Exp $
+#
+# This file contains some targets that print information gathered from
+# variables. They do not modify any variables.
+#
+
+# show-tools:
+# Emits a /bin/sh shell script that defines all known tools
+# to the values they have in the pkgsrc infrastructure.
+#
+show-tools: .PHONY
+.for t in ${_USE_TOOLS}
+. if defined(_TOOLS_VARNAME.${t})
+ @${ECHO} ${_TOOLS_VARNAME.${t}:Q}=${${_TOOLS_VARNAME.${t}}:Q:Q}
+. endif
+.endfor
+
+# show-build-defs:
+# Prints the variables that can be configured by the pkgsrc user
+# in mk.conf, and the effects that those settings have.
+#
+
+BUILD_DEFS?= # none
+BUILD_DEFS_EFFECTS?= # none
+
+.if !empty(PKGSRC_SHOW_BUILD_DEFS:M[yY][eE][sS])
+pre-depends-hook: show-build-defs
+.endif
+
+show-build-defs: .PHONY
+.if !empty(BUILD_DEFS:M*)
+ @${ECHO} "=========================================================================="
+ @${ECHO} "The following variables will affect the build process of this package,"
+ @${ECHO} "${PKGNAME}. Their current value is shown below:"
+ @${ECHO} ""
+. for var in ${BUILD_DEFS:O}
+. if !defined(${var})
+ @${ECHO} " * ${var} (not defined)"
+. elif defined(${var}) && empty(${var})
+ @${ECHO} " * ${var} (defined)"
+. else
+ @${ECHO} " * ${var} = "${${var}:Q}
+. endif
+. endfor
+. if !empty(BUILD_DEFS_EFFECTS:M*)
+ @${ECHO} ""
+ @${ECHO} "Based on these variables, the following variables have been set:"
+ @${ECHO} ""
+. endif
+. for var in ${BUILD_DEFS_EFFECTS:O}
+. if !defined(${var})
+ @${ECHO} " * ${var} (not defined)"
+. elif defined(${var}) && empty(${var})
+ @${ECHO} " * ${var} (defined, but empty)"
+. else
+ @${ECHO} " * ${var} = "${${var}:Q}
+. endif
+. endfor
+ @${ECHO} ""
+ @${ECHO} "You may want to abort the process now with CTRL-C and change their value"
+ @${ECHO} "before continuing. Be sure to run \`${MAKE} clean' after"
+ @${ECHO} "the changes."
+ @${ECHO} "=========================================================================="
+.endif
+
+# @deprecated -- remove after 2007Q1
+build-defs-message: show-build-defs .PHONY