aboutsummaryrefslogtreecommitdiff
path: root/mkfiles.pl
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2013-06-30 10:16:57 +0000
committerSimon Tatham <anakin@pobox.com>2013-06-30 10:16:57 +0000
commitc06792c07609eacf6db0881f62a3391547c77248 (patch)
treef7f0410c28690eb14e63aba2a2ff02ab3343c819 /mkfiles.pl
parentb375232d7dc8357e820ec00808749d077c8b06b9 (diff)
downloadpuzzles-c06792c07609eacf6db0881f62a3391547c77248.zip
puzzles-c06792c07609eacf6db0881f62a3391547c77248.tar.gz
puzzles-c06792c07609eacf6db0881f62a3391547c77248.tar.bz2
puzzles-c06792c07609eacf6db0881f62a3391547c77248.tar.xz
Add a mechanism to the automake system to allow 'make install' to only
install the actual games, not the auxiliary binaries or nullgame. [originally from svn r9887]
Diffstat (limited to 'mkfiles.pl')
-rwxr-xr-xmkfiles.pl39
1 files changed, 23 insertions, 16 deletions
diff --git a/mkfiles.pl b/mkfiles.pl
index d532c95..5c91502 100755
--- a/mkfiles.pl
+++ b/mkfiles.pl
@@ -57,7 +57,8 @@ eval 'chdir "charset"; require "sbcsgen.pl"; chdir ".."';
@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
@@ -83,14 +84,16 @@ readinput: while (1) {
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;}
@@ -102,10 +105,15 @@ readinput: while (1) {
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;
}
@@ -1190,19 +1198,18 @@ if (defined $makefiles{'am'}) {
"#\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 = ();