pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk mk: Miscellaneous performance improvements.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/25a82d274799
branches:  trunk
changeset: 388615:25a82d274799
user:      jperkin <jperkin%pkgsrc.org@localhost>
date:      Wed Nov 23 13:30:38 2022 +0000

description:
mk: Miscellaneous performance improvements.

Inline ${RUN} calls where appropriate.  Call mkdir directly rather than via
a shell when invoked as a single command.  Avoid unnecessary mkdir calls.

diffstat:

 mk/bsd.pkg.barrier.mk         |   7 ++++---
 mk/bsd.pkg.mk                 |   4 ++--
 mk/build/bsd.build.mk         |   9 +++++----
 mk/build/test.mk              |   9 +++++----
 mk/compiler.mk                |  10 +++++-----
 mk/configure/bsd.configure.mk |   9 +++++----
 mk/cwrappers.mk               |  11 ++++++-----
 mk/depends/bsd.depends.mk     |  13 +++++++------
 mk/extract/extract.mk         |  22 ++++++++++++----------
 mk/package/package.mk         |   9 +++++----
 mk/tools/bsd.tools.mk         |   9 +++++----
 11 files changed, 61 insertions(+), 51 deletions(-)

diffs (290 lines):

diff -r 8714a0579085 -r 25a82d274799 mk/bsd.pkg.barrier.mk
--- a/mk/bsd.pkg.barrier.mk     Wed Nov 23 13:20:06 2022 +0000
+++ b/mk/bsd.pkg.barrier.mk     Wed Nov 23 13:30:38 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.barrier.mk,v 1.21 2020/03/23 00:33:48 riastradh Exp $
+# $NetBSD: bsd.pkg.barrier.mk,v 1.22 2022/11/23 13:30:38 jperkin Exp $
 
 _COOKIE.barrier=       ${WRKDIR}/.barrier_cookie
 
@@ -89,5 +89,6 @@
 ### barrier-cookie creates the "barrier" cookie file.
 ###
 ${_COOKIE.barrier}:
-       ${RUN}${MKDIR} ${.TARGET:H}
-       ${RUN}${ECHO} ${PKGNAME} > ${.TARGET}
+       ${RUN}                                                          \
+       ${TEST} -d ${.TARGET:H} || ${MKDIR} ${.TARGET:H};               \
+       ${ECHO} ${PKGNAME} > ${.TARGET}
diff -r 8714a0579085 -r 25a82d274799 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Wed Nov 23 13:20:06 2022 +0000
+++ b/mk/bsd.pkg.mk     Wed Nov 23 13:30:38 2022 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.2044 2022/11/23 10:53:14 jperkin Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.2045 2022/11/23 13:30:38 jperkin Exp $
 #
 # This file is in the public domain.
 #
@@ -420,7 +420,7 @@
 .PHONY: fake-home
 fake-home: ${FAKEHOMEDIR}
 ${FAKEHOMEDIR}:
-       ${RUN} ${MKDIR} ${.TARGET}
+       @${MKDIR} ${.TARGET}
 
 # Use C-based wrappers or legacy shell versions.
 .if ${_USE_CWRAPPERS} == "yes"
diff -r 8714a0579085 -r 25a82d274799 mk/build/bsd.build.mk
--- a/mk/build/bsd.build.mk     Wed Nov 23 13:20:06 2022 +0000
+++ b/mk/build/bsd.build.mk     Wed Nov 23 13:30:38 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.build.mk,v 1.13 2019/05/07 19:36:43 rillig Exp $
+# $NetBSD: bsd.build.mk,v 1.14 2022/11/23 13:30:38 jperkin Exp $
 #
 # This Makefile fragment is included by bsd.pkg.mk and provides all
 # variables and targets related to building sources for a package.
@@ -55,6 +55,7 @@
 ###
 .PHONY: build-cookie
 build-cookie:
-       ${RUN}${TEST} ! -f ${_COOKIE.build} || ${FALSE}
-       ${RUN}${MKDIR} ${_COOKIE.build:H}
-       ${RUN}${ECHO} ${PKGNAME} > ${_COOKIE.build}
+       ${RUN}                                                          \
+       ${TEST} ! -f ${_COOKIE.build} || ${FALSE};                      \
+       ${TEST} -d ${_COOKIE.build:H} || ${MKDIR} ${_COOKIE.build:H};   \
+       ${ECHO} ${PKGNAME} > ${_COOKIE.build}
diff -r 8714a0579085 -r 25a82d274799 mk/build/test.mk
--- a/mk/build/test.mk  Wed Nov 23 13:20:06 2022 +0000
+++ b/mk/build/test.mk  Wed Nov 23 13:30:38 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: test.mk,v 1.24 2020/03/23 00:33:48 riastradh Exp $
+# $NetBSD: test.mk,v 1.25 2022/11/23 13:30:38 jperkin Exp $
 #
 # After the "build" phase, many packages provide some sort of self-test
 # that can be run on the not-yet installed package. To enable these
@@ -181,9 +181,10 @@
 ###
 .PHONY: test-cookie
 test-cookie:
-       ${RUN}${TEST} ! -f ${_COOKIE.test} || ${FALSE}
-       ${RUN}${MKDIR} ${_COOKIE.test:H}
-       ${RUN}${ECHO} ${PKGNAME} > ${_COOKIE.test}
+       ${RUN}                                                          \
+       ${TEST} ! -f ${_COOKIE.test} || ${FALSE};                       \
+       ${TEST} -d ${_COOKIE.test:H} || ${MKDIR} ${_COOKIE.test:H};     \
+       ${ECHO} ${PKGNAME} > ${_COOKIE.test}
 
 ######################################################################
 ### test-clean (PRIVATE)
diff -r 8714a0579085 -r 25a82d274799 mk/compiler.mk
--- a/mk/compiler.mk    Wed Nov 23 13:20:06 2022 +0000
+++ b/mk/compiler.mk    Wed Nov 23 13:30:38 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: compiler.mk,v 1.98 2022/07/05 17:32:24 jperkin Exp $
+# $NetBSD: compiler.mk,v 1.99 2022/11/23 13:30:38 jperkin Exp $
 #
 # This Makefile fragment implements handling for supported C/C++/Fortran
 # compilers.
@@ -252,8 +252,8 @@
 
 .PHONY: fail-wrapper
 fail-wrapper: .USE
-       ${RUN}${MKDIR} ${.TARGET:H}
-       ${RUN}                                  \
+       ${RUN}                                                          \
+       ${TEST} -d ${.TARGET:H} || ${MKDIR} ${.TARGET:H};               \
        exec 1>${.TARGET};                                              \
        ${ECHO} '#!'${TOOLS_SHELL:Q};                                   \
        ${ECHO} 'wrapperlog="$${TOOLS_WRAPPER_LOG-'${_TOOLS_WRAP_LOG:Q}'}"'; \
@@ -263,8 +263,8 @@
        ${ECHO} '${ECHO} "$$msg" > ${WARNING_DIR}/${.TARGET:T}'; \
        ${ECHO} '${ECHO} "PKGSRC-WARNING: Something is trying to run the $$lang compiler," 1>&2'; \
        ${ECHO} '${ECHO} "PKGSRC-WARNING: but it is not added to USE_LANGUAGES in the package Makefile." 1>&2'; \
-       ${ECHO} 'exit 1'
-       ${RUN}${CHMOD} +x ${.TARGET}
+       ${ECHO} 'exit 1';                                               \
+       ${CHMOD} +x ${.TARGET}
 
 .if empty(USE_LANGUAGES:Mc) && empty(USE_LANGUAGES:Mobjc) && empty(USE_LANGUAGES:Mobjc-c++)
 PKG_CC:=               ${_FAIL_WRAPPER.CC}
diff -r 8714a0579085 -r 25a82d274799 mk/configure/bsd.configure.mk
--- a/mk/configure/bsd.configure.mk     Wed Nov 23 13:20:06 2022 +0000
+++ b/mk/configure/bsd.configure.mk     Wed Nov 23 13:30:38 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.configure.mk,v 1.12 2019/05/07 19:36:44 rillig Exp $
+# $NetBSD: bsd.configure.mk,v 1.13 2022/11/23 13:30:38 jperkin Exp $
 #
 # This Makefile fragment is included by bsd.pkg.mk and provides all
 # variables and targets related to configuring packages for building.
@@ -35,6 +35,7 @@
 
 # Creates the "configure" cookie file.
 _configure-cookie: .PHONY
-       ${RUN} [ ! -f ${_COOKIE.configure} ]    # XXX: What's the purpose of this assertion?
-       ${RUN} ${MKDIR} ${_COOKIE.configure:H}
-       ${RUN} ${ECHO} ${PKGNAME} > ${_COOKIE.configure}
+       ${RUN}                                                          \
+       [ ! -f ${_COOKIE.configure} ];                                  \
+       ${TEST} -d ${_COOKIE.configure:H} || ${MKDIR} ${_COOKIE.configure:H}; \
+       ${ECHO} ${PKGNAME} > ${_COOKIE.configure}
diff -r 8714a0579085 -r 25a82d274799 mk/cwrappers.mk
--- a/mk/cwrappers.mk   Wed Nov 23 13:20:06 2022 +0000
+++ b/mk/cwrappers.mk   Wed Nov 23 13:30:38 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cwrappers.mk,v 1.37 2022/11/23 10:44:16 jperkin Exp $
+# $NetBSD: cwrappers.mk,v 1.38 2022/11/23 13:30:38 jperkin Exp $
 #
 # This Makefile fragment implements integration of pkgtools/cwrappers.
 
@@ -147,7 +147,7 @@
 
 .PHONY: wrapper-dirs
 wrapper-dirs:
-       ${RUN}${MKDIR} ${CWRAPPERS_CONFIG_DIR} ${WRAPPER_BINDIR}
+       @${MKDIR} ${CWRAPPERS_CONFIG_DIR} ${WRAPPER_BINDIR}
 
 .PHONY: pre-wrapper do-wrapper post-wrapper
 
@@ -170,6 +170,7 @@
 
 .PHONY: wrapper-cookie
 wrapper-cookie:
-       ${RUN} [ ! -f ${_COOKIE.wrapper} ]
-       ${RUN} ${MKDIR} ${_COOKIE.wrapper:H}
-       ${RUN} ${ECHO} ${PKGNAME} > ${_COOKIE.wrapper}
+       ${RUN}                                                          \
+       [ ! -f ${_COOKIE.wrapper} ];                                    \
+       ${TEST} -d ${_COOKIE.wrapper:H} || ${MKDIR} ${_COOKIE.wrapper:H}; \
+       ${ECHO} ${PKGNAME} > ${_COOKIE.wrapper}
diff -r 8714a0579085 -r 25a82d274799 mk/depends/bsd.depends.mk
--- a/mk/depends/bsd.depends.mk Wed Nov 23 13:20:06 2022 +0000
+++ b/mk/depends/bsd.depends.mk Wed Nov 23 13:30:38 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.depends.mk,v 1.32 2022/04/13 22:02:36 rillig Exp $
+# $NetBSD: bsd.depends.mk,v 1.33 2022/11/23 13:30:38 jperkin Exp $
 #
 # This Makefile fragment is included by bsd.pkg.mk and provides all
 # variables and targets related to dependencies.
@@ -112,8 +112,8 @@
 ### target so that "depends" may be re-invoked.
 ###
 depends-clean:
-       ${RUN}${RM} -f ${_COOKIE.depends}
-       ${RUN}                                  \
+       ${RUN}                                                          \
+       ${RM} -f ${_COOKIE.depends};                                    \
        ${RMDIR} -p ${_COOKIE.depends:H} 2>/dev/null || ${TRUE}
 
 ######################################################################
@@ -124,9 +124,10 @@
 ###
 .PHONY: depends-cookie
 depends-cookie:
-       ${RUN}${TEST} ! -f ${_COOKIE.depends} || ${FALSE}
-       ${RUN}${MKDIR} ${_COOKIE.depends:H}
-       ${RUN}${TOUCH} ${TOUCH_ARGS} ${_COOKIE.depends}
+       ${RUN}                                                          \
+       ${TEST} ! -f ${_COOKIE.depends} || ${FALSE};                    \
+       ${TEST} -d ${_COOKIE.depends:H} || ${MKDIR} ${_COOKIE.depends:H}; \
+       ${TOUCH} ${TOUCH_ARGS} ${_COOKIE.depends}
 
 # show-depends:
 #      Prints the dependencies that need to be installed before this
diff -r 8714a0579085 -r 25a82d274799 mk/extract/extract.mk
--- a/mk/extract/extract.mk     Wed Nov 23 13:20:06 2022 +0000
+++ b/mk/extract/extract.mk     Wed Nov 23 13:30:38 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: extract.mk,v 1.43 2022/01/06 10:19:11 schmonz Exp $
+# $NetBSD: extract.mk,v 1.44 2022/11/23 13:30:38 jperkin Exp $
 #
 # The following variables may be set by the package Makefile and
 # specify how extraction happens:
@@ -112,9 +112,9 @@
 
 .PHONY: extract-dir
 extract-dir:
-       ${RUN}${MKDIR} ${EXTRACT_DIR}
+       @${MKDIR} ${EXTRACT_DIR}
 .for f in ${EXTRACT_ONLY}
-       ${RUN}${MKDIR} ${EXTRACT_DIR.${f}}
+       @${MKDIR} ${EXTRACT_DIR.${f}}
 .endfor
 
 ######################################################################
@@ -126,10 +126,11 @@
 .PHONY: extract-check-interactive
 extract-check-interactive:
 .if !empty(INTERACTIVE_STAGE:Mextract) && defined(BATCH)
-       @${ERROR_MSG} "The extract stage of this package requires user interaction"
-       @${ERROR_MSG} "Please extract manually with:"
-       @${ERROR_MSG} "    \"cd ${.CURDIR} && ${MAKE} extract\""
-       ${RUN} ${FALSE}
+       ${RUN}                                                          \
+       ${ERROR_MSG} "The extract stage of this package requires user interaction"; \
+       ${ERROR_MSG} "Please extract manually with:";                   \
+       ${ERROR_MSG} "    \"cd ${.CURDIR} && ${MAKE} extract\"";        \
+       ${FALSE}
 .else
        @${DO_NADA}
 .endif
@@ -142,9 +143,10 @@
 ###
 .PHONY: extract-cookie
 extract-cookie:
-       ${RUN}${TEST} ! -f ${_COOKIE.extract} || ${FALSE}
-       ${RUN}${MKDIR} ${_COOKIE.extract:H}
-       ${RUN}${ECHO} ${PKGNAME} > ${_COOKIE.extract}
+       ${RUN}                                                          \
+       ${TEST} ! -f ${_COOKIE.extract} || ${FALSE};                    \
+       ${TEST} -d ${_COOKIE.extract:H} || ${MKDIR} ${_COOKIE.extract:H}; \
+       ${ECHO} ${PKGNAME} > ${_COOKIE.extract}
 
 ######################################################################
 ### pre-extract, do-extract, post-extract (PUBLIC, override)
diff -r 8714a0579085 -r 25a82d274799 mk/package/package.mk
--- a/mk/package/package.mk     Wed Nov 23 13:20:06 2022 +0000
+++ b/mk/package/package.mk     Wed Nov 23 13:30:38 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: package.mk,v 1.27 2019/05/07 19:36:44 rillig Exp $
+# $NetBSD: package.mk,v 1.28 2022/11/23 13:30:38 jperkin Exp $
 #
 # This file provides the code for the "package" phase.
 #
@@ -63,9 +63,10 @@
 ###
 .PHONY: package-cookie
 package-cookie:
-       ${RUN} ${TEST} ! -f ${_COOKIE.package} || ${FALSE}
-       ${RUN} ${MKDIR} ${_COOKIE.package:H}
-       ${RUN} ${ECHO} ${PKGNAME} > ${_COOKIE.package}
+       ${RUN}                                                          \
+       ${TEST} ! -f ${_COOKIE.package} || ${FALSE};                    \
+       ${TEST} -d ${_COOKIE.package:H} || ${MKDIR} ${_COOKIE.package:H}; \
+       ${ECHO} ${PKGNAME} > ${_COOKIE.package}
 
 ######################################################################
 ### The targets below are run with elevated privileges.
diff -r 8714a0579085 -r 25a82d274799 mk/tools/bsd.tools.mk
--- a/mk/tools/bsd.tools.mk     Wed Nov 23 13:20:06 2022 +0000
+++ b/mk/tools/bsd.tools.mk     Wed Nov 23 13:30:38 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.tools.mk,v 1.64 2021/05/02 11:06:13 nia Exp $
+# $NetBSD: bsd.tools.mk,v 1.65 2022/11/23 13:30:38 jperkin Exp $
 #
 # Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -111,9 +111,10 @@
 ###
 .PHONY: tools-cookie
 tools-cookie:
-       ${RUN} ${TEST} ! -f ${_COOKIE.tools} || ${FALSE}
-       ${RUN} ${MKDIR} ${_COOKIE.tools:H}
-       ${RUN} ${ECHO} ${USE_TOOLS:Q} > ${_COOKIE.tools}
+       ${RUN}                                                          \
+       ${TEST} ! -f ${_COOKIE.tools} || ${FALSE};                      \
+       ${TEST} -d ${_COOKIE.tools:H} || ${MKDIR} ${_COOKIE.tools:H};   \
+       ${ECHO} ${USE_TOOLS:Q} > ${_COOKIE.tools}
 
 ######################################################################
 ### override-tools (PRIVATE)



Home | Main Index | Thread Index | Old Index