From: Tom Tromey Date: Thu, 19 Mar 1998 00:30:06 +0000 (+0000) Subject: initial java support X-Git-Tag: Release-1-2g~4 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=12c6643dad8c9ad409f4e6e6d1bbb22ed0310854;p=automake.git initial java support --- diff --git a/ChangeLog b/ChangeLog index a7bf1dfc..168313ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Wed Mar 18 14:48:44 1998 Tom Tromey + + * Makefile.am (pkgdata_DATA): Added java.am, java-clean.am. + * java-clean.am: New file. + * java.am: New file. + * automake.in (generate_makefile): Call handle_java. + (handle_java): New sub. + (am_install_var): Only push primary variable on @all if not doing + Java. + Sun Mar 8 15:43:09 1998 Tom Tromey * automake.in (handle_configure): When recognizing AC_OUTPUT ":" diff --git a/Makefile.am b/Makefile.am index b54f88f9..e9ac5bfe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,7 +15,7 @@ libtool.am ltlib.am ltlibrary.am mans-vars.am program.am progs.am \ remake-hdr.am remake.am scripts.am subdirs.am tags.am tags-clean.am \ texi-vers.am texinfos.am libs-clean.am ltlib-clean.am progs-clean.am \ data-clean.am COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \ -lisp.am lisp-clean.am mans.am +lisp.am lisp-clean.am mans.am java.am java-clean.am ## These must all be executable when installed. pkgdata_SCRIPTS = config.guess config.sub install-sh mdate-sh missing \ diff --git a/Makefile.in b/Makefile.in index 233c0172..f85dd9a5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -76,7 +76,7 @@ libtool.am ltlib.am ltlibrary.am mans-vars.am program.am progs.am \ remake-hdr.am remake.am scripts.am subdirs.am tags.am tags-clean.am \ texi-vers.am texinfos.am libs-clean.am ltlib-clean.am progs-clean.am \ data-clean.am COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \ -lisp.am lisp-clean.am mans.am +lisp.am lisp-clean.am mans.am java.am java-clean.am pkgdata_SCRIPTS = config.guess config.sub install-sh mdate-sh missing \ mkinstalldirs elisp-comp ylwrap acinstall diff --git a/NEWS b/NEWS index 57025865..c0514d4d 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ New in 1.2f: * Passed YFLAGS, not YACCFLAGS, to yacc * AM_PROG_CC_STDC does not have to come before AC_PROG_CPP * Dependencies computed as a side effect of compilation +* Preliminary support for Java New in 1.2: * Bug fixes diff --git a/TODO b/TODO index 13c04682..b3136cbf 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,11 @@ +* something like this fails: + + foo = ... \ + + lib_LTLIBRARIES = foo.la + + this should give an error. + * dependency tracking doesn't work well when a file is removed the new code to track header dependencies exacerbates this what is the fix? diff --git a/automake.in b/automake.in index 5acc4800..3041f552 100755 --- a/automake.in +++ b/automake.in @@ -576,6 +576,7 @@ sub generate_makefile &handle_texinfo; &handle_emacs_lisp; + &handle_java; &handle_man_pages; &handle_data; &handle_headers; @@ -3882,6 +3883,47 @@ sub handle_emacs_lisp } } +# Handle Java. +sub handle_java +{ + local (@sourcelist) = &am_install_var ('-clean', 'java', 'JAVA', + 'java', 'noinst', 'check'); + return if ! @sourcelist; + + &define_variable ('JAVAC', 'javac'); + &define_variable ('JAVACFLAGS', ''); + &define_variable ('CLASSPATH_ENV', + 'CLASSPATH=../..:$(srcdir)/../..:$$CLASSPATH'); + &define_variable ('JAVAROOT', '$(top_builddir)'); + + local (%valid) = &am_primary_prefixes ('JAVA', 'java', 'noinst', 'check'); + + local ($dir, $curs); + foreach $curs (keys %valid) + { + if (! &variable_defined ($curs . '_JAVA') || $curs eq 'noinst' + || $curs eq 'EXTRA') + { + next; + } + + if (defined $dir) + { + print STDERR "got $curs\n"; + &am_line_error ($curs . '_JAVA', + "multiple _JAVA primaries in use"); + } + $dir = $curs; + } + + $output_rules .= ('class' . $dir . '.stamp: $(' . $dir . '_JAVA)' . "\n" + . "\t" . '$(CLASSPATH_ENV) $(JAVAC) $(JAVACFLAGS) ' + . '-d $(JAVAROOT) $?' . "\n" + . "\t" . 'echo timestamp > class' . $dir . '.stamp' + . "\n"); + push (@all, 'class' . $dir . '.stamp'); +} + # Handle some of the minor options. sub handle_minor_options { @@ -5936,7 +5978,7 @@ sub am_install_var # Push here because PRIMARY might be configure time determined. push (@all, '$(' . $primary . ')') - if @used; + if @used && $primary ne 'JAVA'; return (@result); } diff --git a/automake.texi b/automake.texi index f5f0d12e..94d4de6a 100644 --- a/automake.texi +++ b/automake.texi @@ -172,6 +172,7 @@ Other GNU Tools * gettext:: Gettext * Guile:: Guile * Libtool:: Libtool +* Java:: Java Building documentation @@ -1878,6 +1879,7 @@ use in GNU programs, it tries hard to interoperate with other GNU tools. * gettext:: Gettext * Guile:: Guile * Libtool:: Libtool +* Java:: Java @end menu @node Emacs Lisp, gettext, Other GNU Tools, Other GNU Tools @@ -1941,13 +1943,29 @@ macro is understood to mean: As the Guile module code matures, no doubt the Automake support will grow as well. -@node Libtool, , Guile, Other GNU Tools +@node Libtool, Java, Guile, Other GNU Tools @section Libtool Automake provides support for GNU Libtool (@pxref{Top, , The Libtool Manual, libtool, The Libtool Manual}) with the @samp{LTLIBRARIES} primary. @xref{A Shared Library}. +@node Java, , Libtool, Other GNU Tools + +Automake provides some minimal support for Java compilation with the +@samp{JAVA} primary. + +Any @samp{.java} files listed in a @samp{_JAVA} variable will be +compiled with @code{JAVAC} at build time. By default, @samp{.class} +files are not included in the distribution. + +Currently Automake enforces the restriction that only one @samp{_JAVA} +primary can be used in a given @file{Makefile.am}. The reason for this +restriction is that, in general, it isn't possible to know which +@samp{.class} files were generated from which @samp{.java} files -- so +it would be impossible to know which files to install where. + + @node Documentation, Install, Other GNU Tools, Top @chapter Building documentation diff --git a/java-clean.am b/java-clean.am new file mode 100644 index 00000000..af20493e --- /dev/null +++ b/java-clean.am @@ -0,0 +1,25 @@ +## automake - create Makefile.in from Makefile.am +## Copyright (C) 1998 Free Software Foundation, Inc. + +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. + +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. +mostlyclean-@DIR@JAVA: + +clean-@DIR@JAVA: + -rm *.class class@DIR@.stamp + +distclean-@DIR@JAVA: + +maintainer-clean-@DIR@JAVA: diff --git a/java.am b/java.am new file mode 100644 index 00000000..80110722 --- /dev/null +++ b/java.am @@ -0,0 +1,33 @@ +## automake - create Makefile.in from Makefile.am +## Copyright (C) 1998 Free Software Foundation, Inc. + +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. + +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. +install-@DIR@JAVA: class@DIR@.stamp + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(@DIR@dir) +## A single .java file can be compiled into multiple .class files. So +## we just install all the .class files that got built into this +## directory. This is not optimal, but will have to do for now. + for p in *.class; do \ + echo " $(INSTALL_DATA) $$p $(@DIR@dir)/$$p"; \ + $(INSTALL_DATA) $$p $(@DIR@dir)/$$p; \ + done + +uninstall-@DIR@JAVA: + @$(NORMAL_UNINSTALL) + for p in *.class; do \ + rm -f $(@DIR@dir)/$$p; \ + done diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am index b54f88f9..e9ac5bfe 100644 --- a/lib/am/Makefile.am +++ b/lib/am/Makefile.am @@ -15,7 +15,7 @@ libtool.am ltlib.am ltlibrary.am mans-vars.am program.am progs.am \ remake-hdr.am remake.am scripts.am subdirs.am tags.am tags-clean.am \ texi-vers.am texinfos.am libs-clean.am ltlib-clean.am progs-clean.am \ data-clean.am COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \ -lisp.am lisp-clean.am mans.am +lisp.am lisp-clean.am mans.am java.am java-clean.am ## These must all be executable when installed. pkgdata_SCRIPTS = config.guess config.sub install-sh mdate-sh missing \ diff --git a/lib/am/java.am b/lib/am/java.am new file mode 100644 index 00000000..80110722 --- /dev/null +++ b/lib/am/java.am @@ -0,0 +1,33 @@ +## automake - create Makefile.in from Makefile.am +## Copyright (C) 1998 Free Software Foundation, Inc. + +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. + +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. +install-@DIR@JAVA: class@DIR@.stamp + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(@DIR@dir) +## A single .java file can be compiled into multiple .class files. So +## we just install all the .class files that got built into this +## directory. This is not optimal, but will have to do for now. + for p in *.class; do \ + echo " $(INSTALL_DATA) $$p $(@DIR@dir)/$$p"; \ + $(INSTALL_DATA) $$p $(@DIR@dir)/$$p; \ + done + +uninstall-@DIR@JAVA: + @$(NORMAL_UNINSTALL) + for p in *.class; do \ + rm -f $(@DIR@dir)/$$p; \ + done diff --git a/stamp-vti b/stamp-vti index 3d74caed..44fa9361 100644 --- a/stamp-vti +++ b/stamp-vti @@ -1,3 +1,3 @@ -@set UPDATED 12 February 1998 +@set UPDATED 18 March 1998 @set EDITION 1.2f @set VERSION 1.2f diff --git a/tests/ChangeLog b/tests/ChangeLog index 1acee445..17ec2b3b 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +Wed Mar 18 17:15:22 1998 Tom Tromey + + * java.test: New file. + Sun Mar 8 15:35:14 1998 Tom Tromey * colon4.test: New file. diff --git a/tests/Makefile.am b/tests/Makefile.am index 3f2dcf23..10c02cda 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -28,7 +28,8 @@ stamph.test ldadd.test version2.test conf2.test cond.test cond2.test \ xsource.test libobj6.test depend3.test output5.test ammissing.test \ install.test libobj7.test objc.test cond3.test cxxcpp.test \ aclocal.test alpha.test whoami.test unused.test condman.test \ -texinfo5.test aclocali.test texinfo6.test condman2.test colon4.test +texinfo5.test aclocali.test texinfo6.test condman2.test colon4.test \ +java.am EXTRA_DIST = defs $(TESTS) diff --git a/tests/Makefile.in b/tests/Makefile.in index 8831e98f..cb1f0496 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -89,7 +89,8 @@ stamph.test ldadd.test version2.test conf2.test cond.test cond2.test \ xsource.test libobj6.test depend3.test output5.test ammissing.test \ install.test libobj7.test objc.test cond3.test cxxcpp.test \ aclocal.test alpha.test whoami.test unused.test condman.test \ -texinfo5.test aclocali.test texinfo6.test condman2.test colon4.test +texinfo5.test aclocali.test texinfo6.test condman2.test colon4.test \ +java.am EXTRA_DIST = defs $(TESTS) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs diff --git a/tests/java.test b/tests/java.test new file mode 100755 index 00000000..ed3c2dfc --- /dev/null +++ b/tests/java.test @@ -0,0 +1,13 @@ +#! /bin/sh + +# Minimal test of Java functionality. + +. $srcdir/defs || exit 1 + +cat > Makefile.am << 'END' +javadir = $(datadir)/java +java_JAVA = a.java b.java c.java +END + +$AUTOMAKE || exit 1 +grep '^all:.*classjava\.stamp' Makefile.in diff --git a/version.texi b/version.texi index 3d74caed..44fa9361 100644 --- a/version.texi +++ b/version.texi @@ -1,3 +1,3 @@ -@set UPDATED 12 February 1998 +@set UPDATED 18 March 1998 @set EDITION 1.2f @set VERSION 1.2f