Subject: bug#8540: Java "make uninstall" doesn't work after "make clean"

From: Stefano Lattarini <[email-masked]>
Date: Sat, 23 Apr 2011 13:53:23 +0200

Hello automakers.

Currently, Java support in Automake provides uninstall rules that doesn't
work after "make clean":
  
  $ cat > configure.ac <<'END'
  AC_INIT(x,0)
  AM_INIT_AUTOMAKE(foreign)
  AC_CONFIG_FILES(Makefile)
  AC_OUTPUT
  $ cat > Makefile.am <<'END'
  javadir = $(prefix)/java
  java_JAVA = foo.java
  END
  $ echo 'class Foo {}' > foo.java
  $ autoreconf -vi
  configure.ac:2: installing `./install-sh'
  configure.ac:2: installing `./missing'
  $ ./configure --prefix=/tmp
  checking for a BSD-compatible install... /usr/bin/install -c
  checking whether build environment is sane... yes
  checking for a thread-safe mkdir -p... /bin/mkdir -p
  checking for gawk... gawk
  checking whether make sets $(MAKE)... yes
  configure: creating ./config.status
  config.status: creating Makefile
  $ make
  CLASSPATH=.:./.:$CLASSPATH javac -d .    foo.java
  echo timestamp > classjava.stamp
  $ ls *.class
  Foo.class
  $ make install
  /usr/bin/install -c -m 644 Foo.class '/tmp/java/'
  $ make clean
  rm -f *.class classjava.stamp
  $ make uninstall
  $ ls /tmp/java
  Foo.class

While IMHO it's acceptable to provide uninstall rules that stop working
after "make distclean", having them broken by a simple "make clean" is
unacceptable.

Probably, the better fix is to write at "make all" time a file (to
be removed by "make distclean" only, not by "make clean") that lists
all the generated class files; then, at "make uninstall" time, that
that file can be used to recover the names of the files to uninstall.

Regards,
  Stefano