1 | #! /bin/sh
|
---|
2 | # Copyright (C) 2003, 2006 Free Software Foundation, Inc.
|
---|
3 | #
|
---|
4 | # This file is part of GNU Automake.
|
---|
5 | #
|
---|
6 | # GNU Automake is free software; you can redistribute it and/or modify
|
---|
7 | # it under the terms of the GNU General Public License as published by
|
---|
8 | # the Free Software Foundation; either version 2, or (at your option)
|
---|
9 | # any later version.
|
---|
10 | #
|
---|
11 | # GNU Automake is distributed in the hope that it will be useful,
|
---|
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | # GNU General Public License for more details.
|
---|
15 | #
|
---|
16 | # You should have received a copy of the GNU General Public License
|
---|
17 | # along with Automake; see the file COPYING. If not, write to
|
---|
18 | # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
---|
19 | # Boston, MA 02110-1301, USA.
|
---|
20 |
|
---|
21 | # Make sure $(EXEEXT) is appended to programs and to tests that are
|
---|
22 | # programs, but not to @substitutions@.
|
---|
23 |
|
---|
24 | . ./defs || exit 1
|
---|
25 |
|
---|
26 | set -e
|
---|
27 |
|
---|
28 | cat >> configure.in << 'END'
|
---|
29 | AM_CONDITIONAL([COND], [test -n "$cond"])
|
---|
30 | AC_SUBST([programs], ['prg1$(EXEEXT) prg2$(EXEEXT)'])
|
---|
31 | AC_PROG_CC
|
---|
32 | AC_OUTPUT
|
---|
33 | END
|
---|
34 |
|
---|
35 | cat > Makefile.am << 'END'
|
---|
36 | EXEEXT = .bin
|
---|
37 | if COND
|
---|
38 | BAR = bar
|
---|
39 | DEP = bar
|
---|
40 | BAZE = baz$(EXEEXT)
|
---|
41 | BAZ = baz $(DEP)
|
---|
42 | endif
|
---|
43 | bin_PROGRAMS = $(programs) @programs@ prg3 $(BAR) $(BAZE)
|
---|
44 | EXTRA_PROGRAMS = prg1 prg2 prg3
|
---|
45 | TESTS = prg1 prg3 prg4 $(BAZ)
|
---|
46 |
|
---|
47 | print-bin:
|
---|
48 | echo BEG: $(bin_PROGRAMS) :END
|
---|
49 | print-extra:
|
---|
50 | echo BEG: $(EXTRA_PROGRAMS) :END
|
---|
51 | print-tests:
|
---|
52 | echo BEG: $(TESTS) :END
|
---|
53 | print-barbaz:
|
---|
54 | echo BEG: $(BAR) $(BAZ) :END
|
---|
55 | END
|
---|
56 |
|
---|
57 | $ACLOCAL
|
---|
58 | $AUTOCONF
|
---|
59 | $AUTOMAKE
|
---|
60 | ./configure
|
---|
61 | $MAKE print-bin > output
|
---|
62 | cat output
|
---|
63 | grep 'prg1.bin prg2.bin prg1.bin prg2.bin prg3.bin' output
|
---|
64 | $MAKE print-extra > output
|
---|
65 | cat output
|
---|
66 | grep 'prg1.bin prg2.bin prg3.bin' output
|
---|
67 | $MAKE print-tests > output
|
---|
68 | cat output
|
---|
69 | grep 'prg1.bin prg3.bin prg4' output
|
---|
70 |
|
---|
71 | ./configure cond=yes
|
---|
72 | $MAKE print-bin > output
|
---|
73 | cat output
|
---|
74 | grep 'prg1.bin prg2.bin prg1.bin prg2.bin prg3.bin bar.bin baz.bin' output
|
---|
75 | $MAKE print-tests > output
|
---|
76 | cat output
|
---|
77 | grep 'prg1.bin prg3.bin prg4 baz.bin bar.bin' output
|
---|
78 | $MAKE print-barbaz > output
|
---|
79 | cat output
|
---|
80 | grep 'bar baz bar' output
|
---|
81 |
|
---|
82 | # Only two am__EXEEXT_* variables are needed here: one for BAR, and one
|
---|
83 | # BAZ. The latter must use the former.
|
---|
84 | test 2 = `grep '__EXEEXT_. =' Makefile.in | wc -l`
|
---|
85 | grep 'am__EXEEXT_2 = .*am__EXEEXT_1' Makefile.in
|
---|