+ "\trm -f *.o". (join "", map { " \$(BINPREFIX)$_" } &progrealnames("X:U")) . "\n";
+ select STDOUT; close OUT;
+}
+
+if (defined $makefiles{'am'}) {
+ $mftyp = 'am';
+ die "Makefile.am in a subdirectory is not supported\n"
+ if &dirpfx($makefiles{'am'}, "/") ne "";
+
+ ##-- Unix/autoconf Makefile.am
+ open OUT, ">$makefiles{'am'}"; select OUT;
+ print
+ "# Makefile.am for $project_name under Unix with Autoconf/Automake.\n".
+ "#\n# This file was created by `mkfiles.pl' from the `Recipe' file.\n".
+ "# DO NOT EDIT THIS FILE DIRECTLY; edit Recipe or mkfiles.pl instead.\n\n";
+
+ print $makefile_extra{'am_begin'} || "";
+
+ # All programs go in noinstprogs by default. If you want them
+ # installed anywhere else, you have to also add them to
+ # bin_PROGRAMS using '!begin am'. (Automake doesn't seem to mind
+ # having a program name in _both_ of bin_PROGRAMS and
+ # noinst_PROGRAMS.)
+ @noinstprogs = ();
+ foreach $p (&prognames("X:U")) {
+ ($prog, $type) = split ",", $p;
+ push @noinstprogs, $prog;
+ }
+ print &splitline(join " ", "noinst_PROGRAMS", "=", @noinstprogs), "\n";
+
+ %objtosrc = ();
+ %amspeciallibs = ();
+ %amlibobjname = ();
+ %allsources = ();
+ foreach $d (&deps("X", undef, "", "/", "am")) {
+ my $obj = $d->{obj};
+ my $use_archive = 0;
+
+ if (defined $d->{defs}) {
+ # This file needs to go in an archive, so that we can
+ # change the preprocess flags to include some -Ds
+ $use_archive = 1;
+ $archivecppflags{$obj} = [map { " -D$_" } @{$d->{defs}}];
+ }
+ if (defined $cflags{'am'} && $cflags{'am'}->{$obj}) {
+ # This file needs to go in an archive, so that we can
+ # change the compile flags as specified in Recipe
+ $use_archive = 1;
+ $archivecflags{$obj} = [$cflags{'am'}->{$obj}];
+ }
+ if ($use_archive) {
+ $amspeciallibs{$obj} = "lib${obj}.a";
+ $amlibobjname{$obj} = "lib${obj}_a-" .
+ basename($d->{deps}->[0], ".c", ".m") .
+ ".\$(OBJEXT)";
+ }
+ $objtosrc{$obj} = $d->{deps};
+ map { $allsources{$_} = 1 } @{$d->{deps}};
+ }
+
+ # 2014-02-22: as of automake-1.14 we begin to get complained at if
+ # we don't use this option
+ print "AUTOMAKE_OPTIONS = subdir-objects\n\n";
+
+ # Complete list of source and header files. Not used by the
+ # auto-generated parts of this makefile, but Recipe might like to
+ # have it available as a variable so that mandatory-rebuild things
+ # (version.o) can conveniently be made to depend on it.
+ print &splitline(join " ", "allsources", "=",
+ sort {$a cmp $b} keys %allsources), "\n\n";
+
+ @amcppflags = map {"-I\$(srcdir)/$_"} @srcdirs;
+ print &splitline(join " ", "AM_CPPFLAGS", "=", @amcppflags, "\n");
+
+ @amcflags = ("\$(GTK_CFLAGS)", "\$(WARNINGOPTS)");
+ print &splitline(join " ", "AM_CFLAGS", "=", @amcflags), "\n";
+
+ %amlibsused = ();
+ foreach $p (&prognames("X:U")) {
+ ($prog, $type) = split ",", $p;
+ @progsources = ("${prog}_SOURCES", "=");
+ %sourcefiles = ();
+ @ldadd = ();
+ $objstr = &objects($p, "X", undef, undef);
+ foreach $obj (split / /,$objstr) {
+ if ($amspeciallibs{$obj}) {
+ $amlibsused{$obj} = 1;
+ push @ldadd, $amlibobjname{$obj};
+ } else {
+ map { $sourcefiles{$_} = 1 } @{$objtosrc{$obj}};
+ }
+ }
+ push @progsources, sort { $a cmp $b } keys %sourcefiles;
+ print &splitline(join " ", @progsources), "\n";
+ if ($type eq "X") {
+ push @ldadd, "\$(GTK_LIBS)";
+ }
+ push @ldadd, "-lm";
+ print &splitline(join " ", "${prog}_LDADD", "=", @ldadd), "\n";
+ print "\n";
+ }
+
+ foreach $obj (sort { $a cmp $b } keys %amlibsused) {
+ print &splitline(join " ", "lib${obj}_a_SOURCES", "=",
+ @{$objtosrc{$obj}}), "\n";
+ print &splitline(join " ", "lib${obj}_a_CPPFLAGS", "=",
+ @amcflags, @{$archivecppflags{$obj}}), "\n"
+ if $archivecppflags{$obj};
+ print &splitline(join " ", "lib${obj}_a_CFLAGS", "=",
+ @amcflags, @{$archivecflags{$obj}}), "\n"
+ if $archivecflags{$obj};
+ }
+ print &splitline(join " ", "noinst_LIBRARIES", "=",
+ sort { $a cmp $b }
+ map { $amspeciallibs{$_} }
+ keys %amlibsused),
+ "\n\n";
+
+ print $makefile_extra{'am'} || "";