2 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Test rebuild rules for Java class files.
22 cat >> configure.
in <<'END'
26 cat > Makefile.am
<<'END'
27 AM_JAVACFLAGS = -verbose
28 foodir = $(datadir)/java
30 dist_foo_JAVA = d.java
31 nodist_foo_JAVA = n.java
32 nobase_foo_JAVA = Nobase.java
33 nobase_dist_foo_JAVA = NobaseDist.java
34 nobase_nodist_foo_JAVA = NobaseNoDist.java
37 echo 'class _x {}' > a.java
38 echo 'class x_ {}' > d.java
39 echo 'class a {} class d {}' > n.java
40 echo 'class Nobase_Foo {} class Nobase_Bar {}' > Nobase.java
41 echo 'class NobaseDist {}' > NobaseDist.java
42 echo 'class NobaseNoDist {}' > NobaseNoDist.java
48 all_classes
='_x x_ a d Nobase_Foo Nobase_Bar NobaseDist NobaseNoDist'
50 for vpath
in : false
; do
62 ls -l # For debugging.
65 test -f classfoo.stamp
66 for cls
in $all_classes; do
70 # When the stampfile is removed, all the *.class files should
71 # be considered out-of-date.
72 echo timestamp
> older
76 for cls
in $all_classes; do
77 is_newest
$cls.class older
80 # When only a java file is modified, only the *.class files derived from
81 # it should be updated.
82 # The strings we loop on here have the following format:
83 # ``JAVA-FILES-TO-BE-TOUCHED -- CLASSES-THAT-SHOULD-BE-UPDATED''
88 'a d Nobase -- _x x_ Nobase_Foo Nobase_Bar' \
89 'n NobaseDist -- a d NobaseDist' \
90 'd NobaseNoDist -- x_ NobaseNoDist' \
91 "a d n Nobase NobaseDist NobaseNoDist -- $all_classes" \
95 while test $# -gt 0; do
96 if test x
"$1" = x
"--"; then
100 touched_javas
="$touched_javas $1"
105 echo timestamp
> older
107 for j
in $touched_javas; do
108 touch $srcdir/$j.java
111 is_newest classfoo.stamp older
112 for cls
in $all_classes; do
113 case " $updated_classes " in
114 *" $cls "*) is_newest
$cls.class older
;;
115 *) is_newest older
$cls.class
;;