pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk Simplified the code by reducing the number of diffe...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/8dab6a676cc2
branches:  trunk
changeset: 514777:8dab6a676cc2
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Jun 17 22:42:00 2006 +0000

description:
Simplified the code by reducing the number of different targets that are
evaluated. Now the SUBST_MESSAGE is only printed once when the
substitution is actually done. Before this change it had been printed
also when the subst-<class> target had been invoked a second time, but
the substitution didn't take place again, which had confused me. Also,
converted the code to use ${WARNING_MSG} and ${STEP_MSG}.

diffstat:

 mk/subst.mk |  31 +++++++++++--------------------
 1 files changed, 11 insertions(+), 20 deletions(-)

diffs (70 lines):

diff -r 6dc07d053f77 -r 8dab6a676cc2 mk/subst.mk
--- a/mk/subst.mk       Sat Jun 17 22:07:33 2006 +0000
+++ b/mk/subst.mk       Sat Jun 17 22:42:00 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: subst.mk,v 1.32 2006/01/08 01:07:35 rillig Exp $
+# $NetBSD: subst.mk,v 1.33 2006/06/17 22:42:00 rillig Exp $
 #
 # This Makefile fragment implements a general text replacement facility.
 # Package makefiles define a ``class'', for each of which a particular
@@ -32,7 +32,7 @@
 #      Command to clean up after sed(1). Defaults to ${RM} -f
 #      $$file${_SUBST_BACKUP_SUFFIX}. For debugging, set it to ${DO_NADA}.
 
-ECHO_SUBST_MSG?=       ${ECHO}
+ECHO_SUBST_MSG?=       ${STEP_MSG}
 
 # _SUBST_IS_TEXT_FILE returns 0 if $${file} is a text file.
 _SUBST_IS_TEXT_FILE?= \
@@ -50,32 +50,21 @@
 SUBST_POSTCMD.${_class_}?=     ${RM} -f "$$tmpfile"
 
 SUBST_TARGETS+=                        subst-${_class_}
-_SUBST_TARGETS.${_class_}=     subst-${_class_}-message
-_SUBST_TARGETS.${_class_}+=    ${_SUBST_COOKIE.${_class_}}
-_SUBST_TARGETS.${_class_}+=    subst-${_class_}-cookie
-
-.ORDER: ${_SUBST_TARGETS.${_class_}}
 
 .  if defined(SUBST_STAGE.${_class_})
 ${SUBST_STAGE.${_class_}}: subst-${_class_}
+.  else
+PKG_FAIL_REASON+=      "SUBST_STAGE missing for ${_class_}."
 .  endif
 
 .PHONY: subst-${_class_}
-subst-${_class_}: ${_SUBST_TARGETS.${_class_}}
+subst-${_class_}: ${_SUBST_COOKIE.${_class_}}
 
-.PHONY: subst-${_class_}-message
-subst-${_class_}-message:
+${_SUBST_COOKIE.${_class_}}:
 .  if defined(SUBST_MESSAGE.${_class_})
        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
-       ${ECHO_SUBST_MSG} "=> "${SUBST_MESSAGE.${_class_}:Q}
+       ${ECHO_SUBST_MSG} ${SUBST_MESSAGE.${_class_}:Q}
 .  endif
-
-.PHONY: subst-${_class_}-cookie
-subst-${_class_}-cookie:
-       ${_PKG_SILENT}${_PKG_DEBUG}                                     \
-       ${TOUCH} ${TOUCH_FLAGS} ${_SUBST_COOKIE.${_class_}:Q}
-
-${_SUBST_COOKIE.${_class_}}:
        ${_PKG_SILENT}${_PKG_DEBUG} set -e;                             \
        cd ${WRKSRC:Q};                                                 \
        files=${SUBST_FILES.${_class_}:Q};                              \
@@ -97,9 +86,11 @@
                                ${ECHO} "$$file" >> ${.TARGET};         \
                        fi;                                             \
                elif ${TEST} -f "$$file"; then                          \
-                       ${ECHO_SUBST_MSG} "[subst.mk] WARNING: Ignoring non-text file \"$$file\"." 1>&2; \
+                       ${WARNING_MSG} "[subst.mk] Ignoring non-text file \"$$file\"." 1>&2; \
                else                                                    \
-                       ${ECHO_SUBST_MSG} "[subst.mk] WARNING: Ignoring non-existent file \"$$file\"." 1>&2; \
+                       ${WARNING_MSG} "[subst.mk] Ignoring non-existent file \"$$file\"." 1>&2; \
                fi;                                                     \
        done
+       ${_PKG_SILENT}${_PKG_DEBUG} set -e;                             \
+       ${TOUCH} ${TOUCH_FLAGS} ${.TARGET:Q}
 .endfor



Home | Main Index | Thread Index | Old Index