maintcheck: prefer '$(am__cd)' over plain 'cd'
[automake.git] / lib / am / java.am
blob6c163b56f5b1fc784ee29c0d8a13a1658d6d88a9
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1998-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)
7 ## any later version.
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/>.
18 ## ---------- ##
19 ## Building.  ##
20 ## ---------- ##
22 if %?FIRST%
23 JAVAC = javac
24 CLASSPATH_ENV = CLASSPATH=$(JAVAROOT):$(srcdir)/$(JAVAROOT)$${CLASSPATH:+":$$CLASSPATH"}
25 JAVAROOT = $(top_builddir)
26 endif %?FIRST%
28 class%NDIR%.stamp: $(am__java_sources)
29         @list1='$?'; list2=; if test -n "$$list1"; then \
30           for p in $$list1; do \
31             if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
32             list2="$$list2 $$d$$p"; \
33           done; \
34           echo '$(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) $(AM_JAVACFLAGS) $(JAVACFLAGS) '"$$list2"; \
35           $(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) $(AM_JAVACFLAGS) $(JAVACFLAGS) $$list2; \
36         else :; fi
37         echo timestamp > $@
40 ## ------------ ##
41 ## Installing.  ##
42 ## ------------ ##
44 if %?INSTALL%
45 am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
46 ?EXEC?.PHONY install-exec-am: install-%DIR%JAVA
47 ?!EXEC?.PHONY install-data-am: install-%DIR%JAVA
48 install-%DIR%JAVA: class%NDIR%.stamp
49         @$(NORMAL_INSTALL)
50 ## A single .java file can be compiled into multiple .class files.  So
51 ## we just install all the .class files that got built into this
52 ## directory.  This is not optimal, but will have to do for now.
53         @test -n "$(%DIR%_JAVA)" && test -n "$(%NDIR%dir)" || exit 0; \
54         echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
55         $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)"; \
56         set x *.class; shift; test "$$1" != "*.class" || exit 0; \
57         echo " $(INSTALL_DATA)" "$$@" "'$(DESTDIR)$(%NDIR%dir)/$$p'"; \
58         $(INSTALL_DATA) "$$@" "$(DESTDIR)$(%NDIR%dir)"
59 endif %?INSTALL%
62 ## -------------- ##
63 ## Uninstalling.  ##
64 ## -------------- ##
66 if %?INSTALL%
67 .PHONY uninstall-am: uninstall-%DIR%JAVA
68 uninstall-%DIR%JAVA:
69         @$(NORMAL_UNINSTALL)
70         @test -n "$(%DIR%_JAVA)" && test -n "$(%NDIR%dir)" || exit 0; \
71         set x *.class; shift; test "$$1" != "*.class" || exit 0; \
72         echo " ( cd '$(DESTDIR)$(%NDIR%dir)' && rm -f" "$$@" ")"; \
73         cd "$(DESTDIR)$(%NDIR%dir)" && rm -f "$$@"
74 endif %?INSTALL%
77 ## ---------- ##
78 ## Cleaning.  ##
79 ## ---------- ##
81 .PHONY clean-am: clean-%NDIR%JAVA
82 clean-%NDIR%JAVA:
83         -rm -f *.class class%NDIR%.stamp
86 ## -------------- ##
87 ## Distributing.  ##
88 ## -------------- ##
90 if %?DIST%
91 DIST_COMMON += %DISTVAR%
92 endif %?DIST%