summaryrefslogtreecommitdiff
path: root/lib/am/java.am
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2011-09-12 10:54:49 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2011-09-12 10:55:25 +0200
commit2990ef353fa395d1b7ded2aa15f5cf574adbb78d (patch)
treec7b94ca729893deb398af5f2d9e17adb562eece5 /lib/am/java.am
parent5e4631085ef78ab2385429e123006e9daa1e7d7d (diff)
downloadautomake-2990ef353fa395d1b7ded2aa15f5cf574adbb78d.tar.gz
java: allow both dist_JAVA and nodist_JAVA in the same Makefile.am
Fixes automake bug#8434. * automake.in (handle_java): Strip `dist_' and `nodist_' from the given prefix. Define a new internal Makefile variable `am__java_sources'. Related adjustments. * lib/am/java.am (JAVAC, JAVAROOT, CLASSPATH_ENV): Define only the first time this am file is processed. (class%DIR%.stamp): Stamp file renamed ... (class%NDIR%.stamp): ... to this, so that the `dist_' and `nodist_' prefixes are stripped from the name of the stampfile. Adjust declaration of dependencies by using the new automake-generated internal variable `$(am__java_sources)'. In the rule, use `$@' as the name of the target, rather than hard-coding it. * tests/java.test: Update and extend. * tests/java-no-duplicate.test: New test. * tests/java-mix-dist-nodist.test: Likewise. * tests/java-compile-and-install.test: Likewise. * tests/java-clean.test: Likewise. * tests/java-sources.test: Likewise. * tests/Makefile.am (TESTS): Update. Cherry-picked from commit v1.11-337-gd76b503.
Diffstat (limited to 'lib/am/java.am')
-rw-r--r--lib/am/java.am14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/am/java.am b/lib/am/java.am
index 604df2229..464b70609 100644
--- a/lib/am/java.am
+++ b/lib/am/java.am
@@ -20,11 +20,13 @@
## Building. ##
## ---------- ##
+if %?FIRST%
JAVAC = javac
CLASSPATH_ENV = CLASSPATH=$(JAVAROOT):$(srcdir)/$(JAVAROOT)$${CLASSPATH:+":$$CLASSPATH"}
JAVAROOT = $(top_builddir)
+endif %?FIRST%
-class%DIR%.stamp: $(%DIR%_JAVA)
+class%NDIR%.stamp: $(am__java_sources)
@list1='$?'; list2=; if test -n "$$list1"; then \
for p in $$list1; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
@@ -33,7 +35,7 @@ class%DIR%.stamp: $(%DIR%_JAVA)
echo '$(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) $(AM_JAVACFLAGS) $(JAVACFLAGS) '"$$list2"; \
$(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) $(AM_JAVACFLAGS) $(JAVACFLAGS) $$list2; \
else :; fi
- echo timestamp > class%DIR%.stamp
+ echo timestamp > $@
## ------------ ##
@@ -44,7 +46,7 @@ if %?INSTALL%
am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
?EXEC?.PHONY install-exec-am: install-%DIR%JAVA
?!EXEC?.PHONY install-data-am: install-%DIR%JAVA
-install-%DIR%JAVA: class%DIR%.stamp
+install-%DIR%JAVA: class%NDIR%.stamp
@$(NORMAL_INSTALL)
test -z "$(%NDIR%dir)" || $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)"
## A single .java file can be compiled into multiple .class files. So
@@ -76,9 +78,9 @@ endif %?INSTALL%
## Cleaning. ##
## ---------- ##
-.PHONY clean-am: clean-%DIR%JAVA
-clean-%DIR%JAVA:
- -rm -f *.class class%DIR%.stamp
+.PHONY clean-am: clean-%NDIR%JAVA
+clean-%NDIR%JAVA:
+ -rm -f *.class class%NDIR%.stamp
## -------------- ##