pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk mk: fix pkglint warnings about ambiguous variables



details:   https://anonhg.NetBSD.org/pkgsrc/rev/1ec0fe8f3409
branches:  trunk
changeset: 394696:1ec0fe8f3409
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Apr 20 16:32:42 2019 +0000

description:
mk: fix pkglint warnings about ambiguous variables

When a Makefile fragment contains $0, this means a Makefile variable, not
a shell or AWK variable.

The bug in ccc.mk survived unnoticed for almost 15 years. The bug in
gnu-configure.mk for MirBSD got only half as old.

diffstat:

 mk/compiler/ccc.mk            |   4 ++--
 mk/configure/gnu-configure.mk |   4 ++--
 mk/mpi.buildlink3.mk          |  10 +++++-----
 3 files changed, 9 insertions(+), 9 deletions(-)

diffs (72 lines):

diff -r 5b1141d7572f -r 1ec0fe8f3409 mk/compiler/ccc.mk
--- a/mk/compiler/ccc.mk        Sat Apr 20 15:06:28 2019 +0000
+++ b/mk/compiler/ccc.mk        Sat Apr 20 16:32:42 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: ccc.mk,v 1.19 2009/06/02 22:32:49 joerg Exp $
+# $NetBSD: ccc.mk,v 1.20 2019/04/20 16:32:42 rillig Exp $
 #
 # This is the compiler definition for the Compaq C Compilers.
 #
@@ -35,7 +35,7 @@
 
 .if exists(${CCPATH}) && !defined(CC_VERSION_STRING)
 CC_VERSION_STRING!=    ${CCPATH} -V 2>&1 | ${AWK} '{print; exit(0);}'
-CC_VERSION!=           ${CCPATH} -V 2>&1 | ${AWK} '{print "CCC-"$3; exit(0);}'
+CC_VERSION!=           ${CCPATH} -V 2>&1 | ${AWK} '{print "CCC-"$$3; exit(0);}'
 .else
 CC_VERSION_STRING?=    ${CC_VERSION}
 CC_VERSION?=           CCC
diff -r 5b1141d7572f -r 1ec0fe8f3409 mk/configure/gnu-configure.mk
--- a/mk/configure/gnu-configure.mk     Sat Apr 20 15:06:28 2019 +0000
+++ b/mk/configure/gnu-configure.mk     Sat Apr 20 16:32:42 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: gnu-configure.mk,v 1.18 2019/04/03 19:10:26 rillig Exp $
+# $NetBSD: gnu-configure.mk,v 1.19 2019/04/20 16:32:42 rillig Exp $
 #
 # Package-settable variables:
 #
@@ -170,7 +170,7 @@
                                found = 0;                              \
                        }                                               \
                }                                                       \
-               { print $0 }' $$file >$$file.override;                  \
+               { print $$0 }' $$file >$$file.override;                 \
        ${CHMOD} +x $$file.override;                                    \
        ${TOUCH} -r $$file $$file.override;                             \
        ${MV} -f $$file.override $$file
diff -r 5b1141d7572f -r 1ec0fe8f3409 mk/mpi.buildlink3.mk
--- a/mk/mpi.buildlink3.mk      Sat Apr 20 15:06:28 2019 +0000
+++ b/mk/mpi.buildlink3.mk      Sat Apr 20 16:32:42 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mpi.buildlink3.mk,v 1.3 2016/09/24 18:34:24 kamil Exp $
+# $NetBSD: mpi.buildlink3.mk,v 1.4 2019/04/20 16:32:42 rillig Exp $
 #
 # This Makefile fragment is meant to be included by packages
 # that use any MPI implementation instead of one particular one.
@@ -18,15 +18,15 @@
 .include "../../mk/bsd.prefs.mk"
 
 # Try to find if we have anything installed already
-.if exists($(LOCALBASE)/bin/mpicc)
+.if exists(${LOCALBASE}/bin/mpicc)
 _MPI_PACKAGE!= ${PKG_INFO} -Q PKGPATH -F ${LOCALBASE}/bin/mpicc
 MPI_TYPE?=     ${_MPI_PACKAGE:T}
 .else
 
 MPI_TYPE?=     mpich   # default to MPICH due to backward compatibility
-.if $(MPI_TYPE) == "mpich"
+.if ${MPI_TYPE} == "mpich"
 _MPI_PACKAGE=  parallel/mpi-ch
-.elif $(MPI_TYPE) == "openmpi"
+.elif ${MPI_TYPE} == "openmpi"
 _MPI_PACKAGE=  parallel/openmpi
 .else # invalid or unimplemented type
 PKG_FAIL_REASON+=      \
@@ -34,6 +34,6 @@
 .endif
 .endif
 
-.include "../../$(_MPI_PACKAGE)/buildlink3.mk"
+.include "../../${_MPI_PACKAGE}/buildlink3.mk"
 
 .endif # MPI_BUILDLINK3_MK



Home | Main Index | Thread Index | Old Index