@srcdirs = ("./");
-$divert = undef; # ref to scalar in which text is currently being put
+$divert = undef; # ref to array of refs of scalars in which text is
+ # currently being put
$help = ""; # list of newline-free lines of help text
$project_name = "project"; # this is a good enough default
%makefiles = (); # maps makefile types to output makefile pathnames
if ((defined $_[0]) && $_[0] eq "!end") {
$divert = undef;
} else {
- ${$divert} .= "$_\n";
+ for my $ref (@$divert) {
+ ${$ref} .= "$_\n";
+ }
}
next;
}
# Skip comments and blank lines.
next if /^\s*#/ or scalar @_ == 0;
- if ($_[0] eq "!begin" and $_[1] eq "help") { $divert = \$help; next; }
+ if ($_[0] eq "!begin" and $_[1] eq "help") { $divert = [\$help]; next; }
if ($_[0] eq "!name") { $project_name = $_[1]; next; }
if ($_[0] eq "!srcdir") { push @srcdirs, $_[1]; next; }
if ($_[0] eq "!makefile" and &mfval($_[1])) { $makefiles{$_[1]}=$_[2]; next;}
next;
}
if ($_[0] eq "!begin") {
- if ($_[1] =~ /^>(.*)/) {
- $divert = \$auxfiles{$1};
- } elsif (&mfval($_[1])) {
- $divert = \$makefile_extra{$_[1]};
+ my @args = @_;
+ shift @args;
+ $divert = [];
+ for my $component (@args) {
+ if ($component =~ /^>(.*)/) {
+ push @$divert, \$auxfiles{$1};
+ } elsif ($component =~ /^([^_]*)(_.*)?$/ and &mfval($1)) {
+ push @$divert, \$makefile_extra{$component};
+ }
}
next;
}
if (defined $makefiles{'am'}) {
$mftyp = 'am';
- $dirpfx = "\$(srcdir)/" . &dirpfx($makefiles{'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;
"#\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";
- @binprogs = ();
+ 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;
- if ("FIXME") { # decide which programs go where
- push @binprogs, # FIXME "\$(BINPREFIX)" .
- $prog;
- } else {
- push @noinstprogs, # FIXME "\$(BINPREFIX)" .
- $prog;
- }
+ push @noinstprogs, $prog;
}
- print &splitline(join " ", "bin_PROGRAMS", "=", @binprogs), "\n";
print &splitline(join " ", "noinst_PROGRAMS", "=", @noinstprogs), "\n";
%objtosrc = ();
%amspeciallibs = ();
%amlibobjname = ();
%allsources = ();
- foreach $d (&deps("X", undef, $dirpfx, "/", "am")) {
+ foreach $d (&deps("X", undef, "", "/", "am")) {
my $obj = $d->{obj};
my $use_archive = 0;
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) {
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
print &splitline(join " ", "allsources", "=",
sort {$a cmp $b} keys %allsources), "\n\n";
- @amcppflags = map {"-I$dirpfx$_"} @srcdirs;
+ @amcppflags = map {"-I\$(srcdir)/$_"} @srcdirs;
print &splitline(join " ", "AM_CPPFLAGS", "=", @amcppflags, "\n");
@amcflags = ("\$(GTK_CFLAGS)", "\$(WARNINGOPTS)");