summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2007-01-02 23:01:24 +0000
committerrillig <rillig@pkgsrc.org>2007-01-02 23:01:24 +0000
commit0e9dbd1f6b9672e9db82ff917dc114f8093da8ac (patch)
treea1054e2cab623c03a983bf8979ab130d249db501
parente36a2e4ab4abd486fbd47591ba600a30365fb064 (diff)
downloadpkgsrc-0e9dbd1f6b9672e9db82ff917dc114f8093da8ac.tar.gz
Outside of packages, the :M* operator has to be used sometimes.
When .PHONY appears as the source in a dependency line, all targets are considered "virtual" targets.
-rw-r--r--pkgtools/pkglint/files/pkglint.pl14
1 files changed, 12 insertions, 2 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index 960f627ff52..b1464068df0 100644
--- a/pkgtools/pkglint/files/pkglint.pl
+++ b/pkgtools/pkglint/files/pkglint.pl
@@ -1,5 +1,5 @@
#! @PERL@
-# $NetBSD: pkglint.pl,v 1.689 2007/01/02 22:27:44 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.690 2007/01/02 23:01:24 rillig Exp $
#
# pkglint - static analyzer and checker for pkgsrc packages
@@ -3900,7 +3900,9 @@ sub checkline_mk_varuse($$$$) {
# configure scripts.
my $need_mstar = false;
if ($varname =~ regex_gnu_configure_volatile_vars) {
- if (defined($pkgctx_vardef) && exists($pkgctx_vardef->{"GNU_CONFIGURE"})) {
+ # When we are not checking a package, but some other file,
+ # the :M* operator is needed for safety.
+ if (!defined($pkgctx_vardef) || exists($pkgctx_vardef->{"GNU_CONFIGURE"})) {
$need_mstar = true;
}
}
@@ -5991,6 +5993,14 @@ sub checklines_mk($) {
$opt_debug_misc and $line->log_debug("targets=${targets}, dependencies=${dependencies}");
$mkctx_target = $targets;
+ foreach my $source (split(/\s+/, $dependencies)) {
+ if ($source eq ".PHONY") {
+ foreach my $target (split(/\s+/, $targets)) {
+ $allowed_targets->{$target} = true;
+ }
+ }
+ }
+
foreach my $target (split(/\s+/, $targets)) {
if ($target eq ".PHONY") {
foreach my $dep (split(qr"\s+", $dependencies)) {