summaryrefslogtreecommitdiff
path: root/lib/Automake/SilentRules.pm
blob: c57ddb59928c828e2de1f9c30a24d188774608a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Copyright (C) 2003-2018 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

package Automake::SilentRules;

use Automake::Utils;
use Automake::Variable;
use Exporter 'import';

use vars qw (@EXPORT);

@EXPORT = qw (verbose_flag verbose_nodep_flag silent_flag
    define_verbose_texinfo define_verbose_libtool handle_silent);

# Silent rules handling functions.

# verbose_flag (NAME)
# -------------------
# Contents of '%VERBOSE%' variable to expand before rule command.
sub verbose_flag
{
    my ($name) = @_;
    return '$(' . verbose_var ($name) . ')';
}

sub verbose_nodep_flag
{
    my ($name) = @_;
    return '$(' . verbose_var ($name) . subst ('am__nodep') . ')';
}

# silent_flag
# -----------
# Contents of %SILENT%: variable to expand to '@' when silent.
sub silent_flag ()
{
    return verbose_flag ('at');
}

# Engage the needed silent rules machinery for assorted texinfo commands.
sub define_verbose_texinfo ()
{
  my @tagvars = ('DVIPS', 'MAKEINFO', 'INFOHTML', 'TEXI2DVI', 'TEXI2PDF');
  foreach my $tag (@tagvars)
    {
      define_verbose_tagvar($tag);
    }
  define_verbose_var('texinfo', '-q');
  define_verbose_var('texidevnull', '> /dev/null');
}

# Engage the needed silent rules machinery for 'libtool --silent'.
sub define_verbose_libtool ()
{
    define_verbose_var ('lt', '--silent');
    return verbose_flag ('lt');
}

sub handle_silent ()
{
    # Define "$(AM_V_P)", expanding to a shell conditional that can be
    # used in make recipes to determine whether we are being run in
    # silent mode or not.  The choice of the name derives from the LISP
    # convention of appending the letter 'P' to denote a predicate (see
    # also "the '-P' convention" in the Jargon File); we do so for lack
    # of a better convention.
    define_verbose_var ('P', 'false', ':');
    # *Always* provide the user with '$(AM_V_GEN)', unconditionally.
    define_verbose_tagvar ('GEN');
    define_verbose_var ('at', '@');
}

1;