return 'am__v_' . $name;
}
- # define_verbose_var (NAME, VAL)
- # ------------------------------
- # For silent rules, setup VAR and dispatcher, to expand to VAL if silent.
- sub define_verbose_var ($$)
- {
- my ($name, $val) = @_;
+ # define_verbose_var (NAME, VAL-IF-SILENT, [VAL-IF-VERBOSE])
+ # ----------------------------------------------------------
-# For 'silent-rules' mode, setup VAR and dispatcher, to expand to
-# VAL-IF-SILENT if silent, to VAL-IF-VERBOSE (defaulting to empty)
-# if not.
++# For silent rules, setup VAR and dispatcher, to expand to
++# VAL-IF-SILENT if silent, to VAL-IF-VERBOSE (defaulting to
++# empty) if not.
+ sub define_verbose_var ($$;$)
+ {
+ my ($name, $silent_val, $verbose_val) = @_;
+ $verbose_val = '' unless defined $verbose_val;
my $var = verbose_var ($name);
my $pvar = verbose_private_var ($name);
my $silent_var = $pvar . '_0';
- if (option 'silent-rules')
- {
- # For typical 'make's, 'configure' replaces AM_V (inside @@) with $(V)
- # and AM_DEFAULT_V (inside @@) with $(AM_DEFAULT_VERBOSITY).
- # For strict POSIX 2008 'make's, it replaces them with 0 or 1 instead.
- # See AM_SILENT_RULES in m4/silent.m4.
- define_variable ($var, '$(' . $pvar . '_@'.'AM_V'.'@)', INTERNAL);
- define_variable ($pvar . '_', '$(' . $pvar . '_@'.'AM_DEFAULT_V'.'@)', INTERNAL);
- Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE,
- $silent_val, '', INTERNAL, VAR_ASIS)
- if (! vardef ($silent_var, TRUE));
- Automake::Variable::define ($verbose_var, VAR_AUTOMAKE, '', TRUE,
- $verbose_val, '', INTERNAL, VAR_ASIS)
- if (! vardef ($verbose_var, TRUE));
-}
+ my $verbose_var = $pvar . '_1';
- Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE, $val,
- '', INTERNAL, VAR_ASIS)
+ # For typical 'make's, 'configure' replaces AM_V (inside @@) with $(V)
+ # and AM_DEFAULT_V (inside @@) with $(AM_DEFAULT_VERBOSITY).
+ # For strict POSIX 2008 'make's, it replaces them with 0 or 1 instead.
+ # See AM_SILENT_RULES in m4/silent.m4.
+ define_variable ($var, '$(' . $pvar . '_@'.'AM_V'.'@)', INTERNAL);
+ define_variable ($pvar . '_', '$(' . $pvar . '_@'.'AM_DEFAULT_V'.'@)',
+ INTERNAL);
++ Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE,
++ $silent_val, '', INTERNAL, VAR_ASIS)
+ if (! vardef ($silent_var, TRUE));
++ Automake::Variable::define ($verbose_var, VAR_AUTOMAKE, '', TRUE,
++ $verbose_val, '', INTERNAL, VAR_ASIS)
++ if (! vardef ($verbose_var, TRUE));
}
# Above should not be needed in the general automake code.
sub define_verbose_tagvar ($)
{
my ($name) = @_;
- if (option 'silent-rules')
- {
- define_verbose_var ($name, '@echo " '. $name . ' ' x (8 - length ($name)) . '" $@;');
- }
+ define_verbose_var ($name, '@echo " '. $name . ' ' x (8 - length ($name)) . '" $@;');
- define_verbose_var ('at', '@');
}
# define_verbose_texinfo
return verbose_flag ('lt');
}
- return unless option 'silent-rules';
+ sub handle_silent ()
+ {
- # *Always* provide the user with 'AM_V_GEN' for 'silent-rules' mode.
+ # 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', '@');
+ }
+
################################################################
. ./defs || Exit 1
cat >>configure.ac <<'EOF'
-AM_SILENT_RULES
+ AC_CONFIG_FILES([sub/Makefile])
AC_OUTPUT
EOF
- cat > Makefile.am <<'EOF'
- AUTOMAKE_OPTIONS = -Wno-portability-recursive
+ # We delegate all the work to the subdir makefile. This is done
+ # to ensure any command-line setting of $(V) gets correctly passed
+ # down to recursive make invocations.
+ echo SUBDIRS = sub > Makefile.am
+ mkdir sub
+ cat > sub/Makefile.am <<'EOF'
++AUTOMAKE_OPTIONS = -Wno-portability-recursive
my_verbose = $(my_verbose_$(V))
my_verbose_ = $(my_verbose_$(AM_DEFAULT_VERBOSITY))
- my_verbose_0 = @echo GEN $@;
+ my_verbose_0 = @echo " XGEN $@";
- all-local: foo
+ all-local: foo gen-headers
+
+ list = 0 1 2
+ .PHONY: gen-headers
+ gen-headers:
+ @headers=`for i in $(list); do echo sub/$$i.h; done`; \
+ if $(AM_V_P); then set -x; else \
+ echo " GEN [headers]"; \
+ fi; \
+ rm -f $$headers || exit 1; \
+ ## Only fake header generation.
+ : generate-header --flags $$headers
foo: foo.in
$(my_verbose)cp $(srcdir)/foo.in $@