mkdir $(distdir)
(cd $(srcdir) && automake --include-deps --output-dir=$(distdir))
@for file in $(DISTFILES); do \
- test -f $(distdir)/$$file || { \
- echo linking $$file; \
- ln $(srcdir)/$$file $(distdir)/$$file; \
- } || { \
- echo copying $$file instead; \
- cp -p $(srcdir)/$$file $(distdir)/$$file; \
- }; \
+ test -f $(distdir)/$$file \
+ || ln $(srcdir)/$$file $(distdir)/$$file \
+ || cp -p $(srcdir)/$$file $(distdir)/$$file; \
done
@sublist="$(DIST_SUBDIRS)"; \
for dir in $$sublist; do \
install-data: install-info install-pkgdataDATA
install: install-exec install-data
+ :
uninstall: uninstall-binSCRIPTS uninstall-info uninstall-pkgdataDATA
installdirs:
- $(top_srcdir)/mkinstalldirs $(bindir) $(infodir) $(pkgdatadir)
+ $(top_srcdir)/mkinstalldirs $(bindir) $(infodir) $(pkgdatadir)
mostlyclean-generic:
test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
maintainer-clean-generic:
test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-mostlyclean: mostlyclean-binSCRIPTS mostlyclean-vti mostlyclean-info mostlyclean-tags mostlyclean-generic
+mostlyclean: mostlyclean-binSCRIPTS mostlyclean-vti mostlyclean-info \
+mostlyclean-tags mostlyclean-generic
-clean: mostlyclean clean-binSCRIPTS clean-vti clean-info clean-tags clean-generic
-distclean: clean distclean-binSCRIPTS distclean-vti distclean-info distclean-tags distclean-generic
+clean: clean-binSCRIPTS clean-vti clean-info clean-tags clean-generic \
+mostlyclean
+
+
+distclean: distclean-binSCRIPTS distclean-vti distclean-info \
+distclean-tags distclean-generic clean
+
rm -f config.status
-maintainer-clean: distclean maintainer-clean-binSCRIPTS maintainer-clean-vti maintainer-clean-info maintainer-clean-tags maintainer-clean-generic
+maintainer-clean: maintainer-clean-binSCRIPTS maintainer-clean-vti \
+maintainer-clean-info maintainer-clean-tags maintainer-clean-generic \
+distclean
+
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
+ rm -f config.status
+
+.PHONY: default binSCRIPTS uninstall-binSCRIPTS mostlyclean-vti \
+distclean-vti clean-vti maintainer-clean-vti install-info \
+uninstall-info mostlyclean-info distclean-info clean-info \
+maintainer-clean-info uninstall-pkgdataDATA tags id mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags dist all info dvi check \
+installcheck install-exec install-data install uninstall installdirs \
+mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
# Some simple checks:
# * syntax check with perl4 and perl5.
# These are only really guaranteed to work on my machine.
maintainer-check: automake
@PERL@ -c -w automake
- if grep '^[^#].*true' $(srcdir)/[a-z]*.am; then \
+ @if grep '^[^#].*true' $(srcdir)/[a-z]*.am; then \
echo "can't use 'true' in GNU Makefile" 1>&2; \
exit 1; \
else :; fi
- if test `fgrep '$${' $(srcdir)/[a-z]*.am | wc -l` -ne 2; then \
+ @if test `fgrep '$${' $(srcdir)/[a-z]*.am | wc -l` -ne 2; then \
echo "found too many uses of '\$${'" 1>&2; \
exit 1; \
fi
# This is always the default target. This gives us freedom to do
# things in whatever order is convenient.
$output_rules .= "default: all\n\n";
+ push (@phony, 'default');
&read_am_file ($makefile . '.am');
&handle_merge_targets;
&handle_installdirs;
&handle_clean;
+ &handle_phony;
if (! -d ($output_directory . '/' . $relative_dir))
{
. $VERSION
. " from Makefile.am\n");
- $output_vars = $output_vars . &file_contents ('header-vars');
+ $output_vars .= &file_contents ('header-vars');
}
# Return object extension. Just once, put some code into the output.
# Boilerplate.
$output_vars .= &file_contents ('compile-vars');
$output_rules .= &file_contents ('compile');
+ &push_phony_cleaners ('compile');
# Check for automatic de-ANSI-fication.
$dir_holds_sources = '.o';
$output_rules .= &file_contents ('clean-kr');
push (@clean, 'kr');
+ &push_phony_cleaners ('kr');
}
}
return $dir_holds_sources;
local ($tfile);
($tfile = &file_contents ('texi-version')) =~ s/\@TEXI\@/$texis[0]/g;
$output_rules = $output_rules . $tfile;
+ &push_phony_cleaners ('vti');
&require_file ($NORMAL, 'mdate-sh');
}
if ($#texis >= 0)
{
- $output_rules = ($output_rules . $infobase . ".info: "
- . join (' ', @texis) . "\n\n");
+ $output_rules .= ($infobase . ".info: "
+ . join (' ', @texis) . "\n\n");
}
# Some boilerplate.
$output_vars .= &file_contents ('texinfos-vars');
$output_rules .= &file_contents ('texinfos');
+ push (@phony, 'install-info', 'uninstall-info');
# How to clean.
local ($crules) = &file_contents ('texi-clean');
$crules =~ s/\@TEXI\@/$infobase/g;
$output_rules .= $crules;
+ &push_phony_cleaners ('info');
push (@suffixes, '.texi', '.info', '.dvi');
push (@uninstall, 'uninstall-info');
$output_rules .= ("\t" . '$(top_srcdir)/mkinstalldirs $(mandir)/man'
. $_ . "\n");
}
+ push (@phony, 'install-man');
# Generate install target.
local ($key);
$output_rules .= $_;
}
$output_rules .= "\n";
+ push (@phony, 'uninstall-man');
$output_vars .= &file_contents ('mans-vars');
{
local ($tagging) = 0;
+ push (@phony, 'tags');
if (defined ($contents{'SUBDIRS'}))
{
$output_rules .= &file_contents ('tags');
elsif ($dir_holds_sources || defined ($contents{'ETAGS_ARGS'}))
{
$output_rules .= &file_contents ('tags-subd');
+ push (@phony, 'id');
$tagging = 1;
}
{
$output_rules .= &file_contents ('tags-clean');
push (@clean, 'tags');
+ &push_phony_cleaners ('tags');
}
else
{
? 'dist-subd-top'
: 'dist');
}
+ push (@phony, 'dist');
}
# Handle auto-dependency code.
$output_rules .= &file_contents ('subdirs');
+ # Push a bunch of phony targets.
+ local ($phonies);
+ foreach $phonies ('-data', '-exec', 'dirs')
+ {
+ push (@phony, 'install' . $phonies . '-recursive');
+ push (@phony, 'uninstall' . $phonies . '-recursive');
+ }
+ foreach $phonies ('all', 'check', 'installcheck', 'info', 'dvi')
+ {
+ push (@phony, $phonies . '-recursive');
+ }
+ &push_phony_cleaners ('recursive');
+
push (@all, "all-recursive");
push (@check, "check-recursive");
push (@installcheck, "installcheck-recursive");
# Deal with installdirs target.
sub handle_installdirs
{
- # GNU Makefile standards recommend this. FIXME prettyprint rule
- # here.
+ # GNU Makefile standards recommend this.
$output_rules .= ("installdirs:"
. ($recursive_install
? " installdirs-recursive\n"
: "\n"));
+ push (@phony, 'installdirs');
if ($#installdirs >= 0)
{
- $output_rules .= ("\t\$(top_srcdir)/mkinstalldirs "
- . join (' ', @installdirs)
- . "\n");
+ &pretty_print_rule ("\t\$(top_srcdir)/mkinstalldirs ", "\t\t",
+ @installdirs);
}
$output_rules .= "\n";
}
. "\n\n");
@install_exec = ('install-exec-recursive', 'install-exec-am');
push (@install, 'install-exec-am');
+ push (@phony, 'install-exec-am');
}
if ($#install_data >= 0)
{
. "\n\n");
@install_data = ('install-data-recursive', 'install-data-am');
push (@install, 'install-data-am');
+ push (@phony, 'install-data-am');
}
if ($#uninstall >= 0)
{
. join (' ', @uninstall)
. "\n\n");
@uninstall = ('uninstall-recursive', 'uninstall-am');
+ push (@phony, 'uninstall-am');
}
}
. join (' ', @install_exec)
. "\n\n");
push (@install, 'install-exec') if (!$recursive_install);
+ push (@phony, 'install-exec');
}
if ($#install_data >= 0)
{
. join (' ', @install_data)
. "\n\n");
push (@install, 'install-data') if (!$recursive_install);
+ push (@phony, 'install-data');
}
$output_rules .= ('install: '
. 'uninstall: '
. join (' ', @uninstall)
. "\n\n");
+ push (@phony, 'install', 'uninstall');
}
# Helper for handle_merge_targets.
{
# User defined local form of target. So include it.
push (@values, $name . '-local');
+ push (@phony, $name . '-local');
}
$output_rules .= $name . ":";
if ($#values >= 0)
{
$output_rules .= ' ' . join (' ', @values);
- }
+ }
$output_rules .= "\n\n";
+ push (@phony, $name);
}
# Handle all 'clean' targets.
{
push (@clean, 'generic');
$output_rules .= &file_contents ('clean');
+ &push_phony_cleaners ('generic');
local ($target) = $recursive_install ? 'clean-am' : 'clean';
&do_one_clean_target ($target, 'mostly', '', @clean);
&do_one_clean_target ($target, 'dist', '', @clean);
&do_one_clean_target ($target, 'maintainer-', 'dist', @clean);
+ push (@phony, 'clean', 'mostlyclean', 'distclean', 'maintainer-clean');
+
local (@deps);
if ($recursive_install)
{
$target = 'clean';
}
- $output_rules .= $name . $target . ": ";
+ grep (($_ = $name . 'clean-' . $_) && 0, @deps);
if ($flag)
{
if ($last_name || $name ne 'mostly')
{
- $output_rules .= $last_name . $target . " ";
+ push (@deps, $last_name . $target . " ");
}
}
-
- $output_rules .= ($name . 'clean-' . join (' ' . $name . 'clean-', @deps)
- . "\n");
+ &pretty_print_rule ($name . $target . ": ", '', @deps);
+ $output_rules .= "\n";
# FIXME shouldn't we really print these messages before running
# the dependencies?
$output_rules .= "\n";
}
+# Handle .PHONY target.
+sub handle_phony
+{
+ &pretty_print_rule ('.PHONY:', '', @phony);
+ $output_rules .= "\n";
+}
+
################################################################
# Do any extra checking for GNU standards.
# Pretty-print something. HEAD is what should be printed at the
# beginning of the first line, FILL is what should be printed at the
# beginning of every subsequent line.
-sub pretty_print
+sub pretty_print_internal
{
local ($head, $fill, @values) = @_;
local ($column) = length ($head);
- $output_vars .= $head;
+ local ($result) .= $head;
local ($bol) = 0;
foreach (@values)
# "71" because we also print a space.
if ($column + length ($_) > 71)
{
- $output_vars .= " \\\n" . $fill;
+ $result .= " \\\n" . $fill;
$column = length ($fill);
$bol = 1;
}
- $output_vars .= ' ' unless ($bol);
- $output_vars .= $_;
+ $result .= ' ' unless ($bol);
+ $result .= $_;
$column += length ($_) + 1;
$bol = 0;
}
- $output_vars .= "\n";
+ $result .= "\n";
+ return $result;
+}
+
+# Pretty-print something and append to output_vars.
+sub pretty_print
+{
+ $output_vars .= &pretty_print_internal (@_);
+}
+
+# Pretty-print something and append to output_rules.
+sub pretty_print_rule
+{
+ $output_rules .= &pretty_print_internal (@_);
}
' \@sect=@SECTION@; \\
inst=`echo "@MANBASE@" | sed \'$(transform)\'`.@FULLSECT@; \\
echo installing @MAN@ as $(mandir)/man$$sect/$$inst; \\
- $(INSTALL_DATA) $(srcdir)/@MAN@ $(mandir)/man$$sect/$$inst; \\
- if test -d $(mandir)/cat$$sect; then \\
- echo formatting @MAN@ as $(mandir)/cat$$sect/$$inst; \\
- $(NROFF) -man $(srcdir)/@MAN@ > $(mandir)/cat$$sect/$$inst; \\
- else \\
- true; \\
- fi
+ $(INSTALL_DATA) $(srcdir)/@MAN@ $(mandir)/man$$sect/$$inst
';
$uninstall_man_format =
' inst=`echo "@MANBASE@" | sed \'$(transform)\'`.@FULLSECT@; \\
- rm -f $(mandir)/man@SECTION@/$$inst $(mandir)/cat@SECTION@/$$inst
+ rm -f $(mandir)/man@SECTION@/$$inst
';
# Commonly found files we look for and automatically include in
@installcheck = ();
@clean = ();
+ @phony = ();
+
# These are pretty obvious, too. They are used to define the
# SOURCES and OBJECTS variables.
@sources = ();
# install code,and possibly generates code to define the primary
# variable. The first argument is the name of the .am file to munge,
# the second argument is the primary variable (eg HEADERS), and all
-# subsequent arguments are possible installation locations. FIXME
-# should scan all defined variables and do some error checking to
-# avoid typos (eg 'bni_PROGRAMS' should give error). Returns list of
-# all values of all _HOW targets.
+# subsequent arguments are possible installation locations. Returns
+# list of all values of all _HOW targets.
#
# FIXME this should be rewritten to be cleaner. It should be broken
# up into multiple functions.
($munge = $clean_templ) =~ s/\@DIR\@/$_/g;
$output_rules .= $munge;
push (@clean, $_ . $primary);
+ push (@phony, $_ . $primary);
}
push (@used, '$(' . $one_name . ')');
$output_rules .= $munge;
push (@uninstall, 'uninstall-' . $_ . $primary);
+ push (@phony, 'uninstall-' . $_ . $primary);
push (@installdirs, '$(' . $_ . 'dir)');
if ($exec_dir_p{$_})
{
}
}
+# Push a list of clean targets onto phony.
+sub push_phony_cleaners
+{
+ local ($base) = @_;
+ local ($target);
+ foreach $target ('mostly', 'dist', '', 'maintainer-')
+ {
+ push (@phony, $target . 'clean-' . $base);
+ }
+}
+
# Set strictness.
sub set_strictness
{