For the convenience of Linux package maintainers, add to Makefile.gtk

and Makefile.doc a command-line parameter 'BINPREFIX' which will be
prepended to all the game binary names. E.g. 'make BINPREFIX=sgt-' and
'make BINPREFIX=sgt- install', and correspondingly 'make -f
Makefile.doc BINPREFIX=sgt-'.

Also included in this commit by mistake, changes to singles.c to add
\n to the end of all its debug() statements. I meant to commit that
separately. Oops.

[originally from svn r9606]
This commit is contained in:
Simon Tatham
2012-08-17 19:58:53 +00:00
parent 200d6533bb
commit 15a4fbd1cd
5 changed files with 33 additions and 29 deletions

View File

@ -1,7 +1,10 @@
all: puzzles.hlp puzzles.txt HACKING
puzzles.hlp puzzles.txt: puzzles.but
halibut --winhelp=puzzles.hlp --text=puzzles.txt puzzles.but
preprocessed.but: puzzles.but
sed 's/PREFIX-/$(BINPREFIX)/g' puzzles.but > preprocessed.but
puzzles.hlp puzzles.txt: preprocessed.but
halibut --winhelp=puzzles.hlp --text=puzzles.txt preprocessed.but
HACKING: devel.but
halibut --text=HACKING devel.but
@ -11,4 +14,4 @@ puzzles.hhp: puzzles.but chm.but
halibut --html puzzles.but chm.but
clean:
rm -f puzzles.hlp puzzles.txt HACKING *.html *.hh[pck]
rm -f puzzles.hlp puzzles.txt preprocessed.but HACKING *.html *.hh[pck]

2
Recipe
View File

@ -177,7 +177,7 @@ version2.def: FORCE
!begin gtk
install:
for i in $(GAMES); do \
$(INSTALL_PROGRAM) -m 755 $$i $(DESTDIR)$(gamesdir)/$$i \
$(INSTALL_PROGRAM) -m 755 $(BINPREFIX)$$i $(DESTDIR)$(gamesdir)/$(BINPREFIX)$$i \
|| exit 1; \
done
!end

View File

@ -1130,12 +1130,13 @@ if (defined $makefiles{'gtk'}) {
"mandir=\$(prefix)/man\n",
"man1dir=\$(mandir)/man1\n",
"\n";
print &splitline("all:" . join "", map { " $_" } &progrealnames("X:U"));
print &splitline("all:" . join "", map { " \$(BINPREFIX)$_" }
&progrealnames("X:U"));
print "\n\n";
foreach $p (&prognames("X:U")) {
($prog, $type) = split ",", $p;
$objstr = &objects($p, "X.o", undef, undef);
print &splitline($prog . ": " . $objstr), "\n";
print &splitline("\$(BINPREFIX)" . $prog . ": " . $objstr), "\n";
$libstr = &objects($p, undef, undef, "-lX");
print &splitline("\t\$(CC) -o \$@ $objstr $libstr \$(XLFLAGS) \$(${type}LIBS)", 69),
"\n\n";
@ -1150,7 +1151,7 @@ if (defined $makefiles{'gtk'}) {
print "\n";
print $makefile_extra{'gtk'} || "";
print "\nclean:\n".
"\trm -f *.o". (join "", map { " $_" } &progrealnames("X:U")) . "\n";
"\trm -f *.o". (join "", map { " \$(BINPREFIX)$_" } &progrealnames("X:U")) . "\n";
select STDOUT; close OUT;
}

View File

@ -298,7 +298,7 @@ For example: if you run Cube (see \k{cube}), select \q{Octahedron}
from the \q{Type} menu, and then go to the game ID selection, you
will see a string of the form \cq{o2x2#338686542711620}. Take only
the part before the hash (\cq{o2x2}), and start Cube with that text
on the command line: \cq{cube o2x2}.
on the command line: \cq{PREFIX-cube o2x2}.
If you copy the \e{entire} game ID on to the command line, the game
will start up in the specific game that was described. This is
@ -364,7 +364,7 @@ seeds; see \k{common-id}), in the same format produced by
For example:
\c net --generate 12 --print 2x3 7x7w | lpr
\c PREFIX-net --generate 12 --print 2x3 7x7w | lpr
will generate two pages of printed Net puzzles (each of which will
have a 7\by\.7 wrapping grid), and pipe the output to the \c{lpr}
@ -390,7 +390,7 @@ seeds; see \k{common-id}), in the same format produced by
For example:
\c net --generate 12 --save game --save-suffix .sav
\c PREFIX-net --generate 12 --save game --save-suffix .sav
will generate twelve Net saved-game files with the names
\cw{game0.sav} to \cw{game11.sav}.

View File

@ -630,7 +630,7 @@ static void solver_op_add(struct solver_state *ss, int x, int y, int op, const c
}
sop = &(ss->ops[ss->n_ops++]);
sop->x = x; sop->y = y; sop->op = op; sop->desc = desc;
debug(("added solver op %s ('%s') at (%d,%d)",
debug(("added solver op %s ('%s') at (%d,%d)\n",
op == BLACK ? "BLACK" : "CIRCLE", desc, x, y));
}
@ -641,7 +641,7 @@ static void solver_op_circle(game_state *state, struct solver_state *ss,
if (!INGRID(state, x, y)) return;
if (state->flags[i] & F_BLACK) {
debug(("... solver wants to add auto-circle on black (%d,%d)", x, y));
debug(("... solver wants to add auto-circle on black (%d,%d)\n", x, y));
state->impossible = 1;
return;
}
@ -659,7 +659,7 @@ static void solver_op_blacken(game_state *state, struct solver_state *ss,
if (!INGRID(state, x, y)) return;
if (state->nums[i] != num) return;
if (state->flags[i] & F_CIRCLE) {
debug(("... solver wants to add auto-black on circled(%d,%d)", x, y));
debug(("... solver wants to add auto-black on circled(%d,%d)\n", x, y));
state->impossible = 1;
return;
}
@ -683,12 +683,12 @@ static int solver_ops_do(game_state *state, struct solver_state *ss)
if (op.op == BLACK) {
if (state->flags[i] & F_CIRCLE) {
debug(("Solver wants to blacken circled square (%d,%d)!", op.x, op.y));
debug(("Solver wants to blacken circled square (%d,%d)!\n", op.x, op.y));
state->impossible = 1;
return n_ops;
}
if (!(state->flags[i] & F_BLACK)) {
debug(("... solver adding black at (%d,%d): %s", op.x, op.y, op.desc));
debug(("... solver adding black at (%d,%d): %s\n", op.x, op.y, op.desc));
#ifdef STANDALONE_SOLVER
if (verbose)
printf("Adding black at (%d,%d): %s\n", op.x, op.y, op.desc);
@ -703,12 +703,12 @@ static int solver_ops_do(game_state *state, struct solver_state *ss)
}
} else {
if (state->flags[i] & F_BLACK) {
debug(("Solver wants to circle blackened square (%d,%d)!", op.x, op.y));
debug(("Solver wants to circle blackened square (%d,%d)!\n", op.x, op.y));
state->impossible = 1;
return n_ops;
}
if (!(state->flags[i] & F_CIRCLE)) {
debug(("... solver adding circle at (%d,%d): %s", op.x, op.y, op.desc));
debug(("... solver adding circle at (%d,%d): %s\n", op.x, op.y, op.desc));
#ifdef STANDALONE_SOLVER
if (verbose)
printf("Adding circle at (%d,%d): %s\n", op.x, op.y, op.desc);
@ -835,7 +835,7 @@ static int solve_allblackbutone(game_state *state, struct solver_state *ss)
solver_op_add(ss, ifree%state->w, ifree/state->w, CIRCLE,
"CC/CE/QM: white cell with single non-black around it");
else {
debug(("White cell with no escape at (%d,%d)", x, y));
debug(("White cell with no escape at (%d,%d)\n", x, y));
state->impossible = 1;
return 0;
}
@ -941,9 +941,9 @@ static void solve_offsetpair_pair(game_state *state, struct solver_state *ss,
if (an == dn) {
/* We have a match; so (WLOG) the 'A' marked above are at
* (x1,y1) and (x2,y2), and the 'B' are at (ax,ay) and (dx,dy). */
debug(("Found offset-pair: %d at (%d,%d) and (%d,%d)",
debug(("Found offset-pair: %d at (%d,%d) and (%d,%d)\n",
state->nums[y1*w + x1], x1, y1, x2, y2));
debug((" and: %d at (%d,%d) and (%d,%d)",
debug((" and: %d at (%d,%d) and (%d,%d)\n",
an, ax, ay, dx[d], dy[d]));
xd = dx[d] - x2; yd = dy[d] - y2;
@ -997,7 +997,7 @@ static int solve_hassinglewhiteregion(game_state *state, struct solver_state *ss
state->flags[i] &= ~F_SCRATCH;
}
if (lwhite == -1) {
debug(("solve_hassinglewhite: no white squares found!"));
debug(("solve_hassinglewhite: no white squares found!\n"));
state->impossible = 1;
return 0;
}
@ -1056,7 +1056,7 @@ static int solve_removesplits(game_state *state, struct solver_state *ss)
int i, x, y, n_ops = ss->n_ops;
if (!solve_hassinglewhiteregion(state, ss)) {
debug(("solve_removesplits: white region is not contiguous at start!"));
debug(("solve_removesplits: white region is not contiguous at start!\n"));
state->impossible = 1;
return 0;
}
@ -1242,7 +1242,7 @@ static int new_game_is_good(game_params *params,
}
if (sret <= 0 || sret_easy > 0) {
debug(("Generated puzzle %s at chosen difficulty %s",
debug(("Generated puzzle %s at chosen difficulty %s\n",
sret <= 0 ? "insoluble" : "too easy",
singles_diffnames[params->diff]));
return 0;
@ -1306,7 +1306,7 @@ static char *new_game_desc(game_params *params, random_state *rs,
generate:
ss->n_ops = 0;
debug(("Starting game generation, size %dx%d", w, h));
debug(("Starting game generation, size %dx%d\n", w, h));
memset(state->flags, 0, state->n*sizeof(unsigned int));
@ -1326,7 +1326,7 @@ generate:
for (j = 0; j < state->n; j++) {
i = scratch[j];
if ((state->flags[i] & F_CIRCLE) || (state->flags[i] & F_BLACK)) {
debug(("generator skipping (%d,%d): %s", i%w, i/w,
debug(("generator skipping (%d,%d): %s\n", i%w, i/w,
(state->flags[i] & F_CIRCLE) ? "CIRCLE" : "BLACK"));
continue; /* solver knows this must be one or the other already. */
}
@ -1343,7 +1343,7 @@ generate:
solver_ops_do(state, ss);
if (state->impossible) {
debug(("generator made impossible, restarting..."));
debug(("generator made impossible, restarting...\n"));
goto generate;
}
}
@ -1382,10 +1382,10 @@ randomise:
!new_game_is_good(params, state, tosolve)) {
ntries++;
if (ntries > MAXTRIES) {
debug(("Ran out of randomisation attempts, re-generating."));
debug(("Ran out of randomisation attempts, re-generating.\n"));
goto generate;
}
debug(("Re-randomising numbers under black squares."));
debug(("Re-randomising numbers under black squares.\n"));
goto randomise;
}
@ -1527,7 +1527,7 @@ static game_state *execute_move(game_state *state, char *move)
game_state *ret = dup_game(state);
int x, y, i, n;
debug(("move: %s", move));
debug(("move: %s\n", move));
while (*move) {
char c = *move;