1 # Example for use of GNU gettext.
2 # This file is in the public domain.
4 # Makefile configuration - processed by automake.
6 # General automake options.
7 AUTOMAKE_OPTIONS = foreign
8 ACLOCAL_AMFLAGS = -I m4
10 # The list of subdirectories containing Makefiles.
13 # The list of programs that are built.
14 bin_JAVAPROGRAMS = hello
16 # The source files of the 'hello' program.
17 hello_SOURCES = Hello.java
18 hello_CLASSES = Hello.class
20 # The entry point of the 'hello' program.
21 hello_MAINCLASS = Hello
23 # The link dependencies of the 'hello' program.
24 hello_JAVALIBS = @LIBINTL_JAR@
26 # The resources of the 'hello' program, excluding message catalogs, but
27 # including the fallback message catalog.
28 hello_RESOURCES = hello-java.properties
30 # Resources that are generated from PO files.
31 MAINTAINERCLEANFILES = hello-java*.properties
33 # Additional files to be distributed.
34 EXTRA_DIST = autogen.sh autoclean.sh
37 # ----------------- General rules for compiling Java programs -----------------
39 jardir = $(datadir)/$(PACKAGE)
40 pkgdatadir = $(datadir)/$(PACKAGE)
41 pkglibdir = $(libdir)/$(PACKAGE)
46 JAVACOMP = $(SHELL) javacomp.sh
50 EXTRA_DIST += $(hello_SOURCES)
52 DISTCLEANFILES = javacomp.sh javaexec.sh
58 # Rules for compiling Java programs as native code.
60 all-local: $(hello_MAINCLASS)$(EXEEXT) hello-resources.jar hello.sh
62 # Does not work yet with GCC 3.3.
63 #$(hello_MAINCLASS)$(EXEEXT): $(srcdir)/Hello.java
64 # CLASSPATH=.@CLASSPATH_SEPARATOR@$(hello_JAVALIBS) $(GCJ) $(GCJFLAGS) $(srcdir)/Hello.java $(hello_JAVALIBS) --main=$(hello_MAINCLASS) -o $@
66 $(hello_MAINCLASS)$(EXEEXT): Hello.$(OBJEXT) libintl.a
67 $(GCJ) $(GCJFLAGS) Hello.$(OBJEXT) libintl.a --main=$(hello_MAINCLASS) -o $@
69 Hello.$(OBJEXT): $(srcdir)/Hello.java
70 CLASSPATH=.@CLASSPATH_SEPARATOR@$(hello_JAVALIBS) $(GCJ) $(GCJFLAGS) -c $(srcdir)/Hello.java -o $@
75 cd tmpdir && $(JAR) xf @LIBINTL_JAR@ && \
76 for f in `find . -name '*.class' -print`; do \
77 $(GCJ) $(GCJFLAGS) -c $$f -o `echo $$f | sed -e 's,^\./,,' -e 's,\.class$$,,' -e 's,/,.,g'`.$(OBJEXT) || exit 1; \
79 rm -f ../libintl.a && \
80 ar cru ../libintl.a `find . -name '*.$(OBJEXT)' -print`
85 catalogs=`MAKEFLAGS= $(MAKE) -s -C po echo-catalogs`; \
86 $(JAR) cf $@ $(hello_RESOURCES) $$catalogs
90 echo "CLASSPATH='$(jardir)/hello-resources.jar'\$${CLASSPATH+\"@CLASSPATH_SEPARATOR@\$$CLASSPATH\"}"; \
91 echo "export CLASSPATH"; \
92 echo "exec '$(pkglibdir)/$(hello_MAINCLASS)$(EXEEXT)' \"\$$@\""; \
95 install-exec-local: all-local
96 $(mkdir_p) $(DESTDIR)$(bindir)
97 $(INSTALL_SCRIPT) hello.sh $(DESTDIR)$(bindir)/hello
98 $(mkdir_p) $(DESTDIR)$(pkglibdir)
99 $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $(hello_MAINCLASS)$(EXEEXT) $(DESTDIR)$(pkglibdir)/$(hello_MAINCLASS)$(EXEEXT)
101 install-data-local: all-local
102 $(mkdir_p) $(DESTDIR)$(jardir)
103 $(INSTALL_DATA) hello-resources.jar $(DESTDIR)$(jardir)/hello-resources.jar
106 $(mkdir_p) $(DESTDIR)$(bindir)
107 $(mkdir_p) $(DESTDIR)$(pkglibdir)
108 $(mkdir_p) $(DESTDIR)$(jardir)
111 rm -f $(DESTDIR)$(bindir)/hello
112 rm -f $(DESTDIR)$(pkglibdir)/$(hello_MAINCLASS)$(EXEEXT)
113 rm -f $(DESTDIR)$(jardir)/hello-resources.jar
115 CLEANFILES += $(hello_MAINCLASS)$(EXEEXT) *.$(OBJEXT) *.a tmpdir hello-resources.jar hello.sh
121 # Rules for compiling Java programs as jar libraries.
122 # This is the preferred mode during development, because you can easily test
123 # the program without installing it, simply by doing "java -jar hello.jar".
125 all-local: hello.jar hello.sh
127 hello.jar: $(hello_CLASSES)
128 { echo "Manifest-Version: 1.0"; echo "Main-Class: $(hello_MAINCLASS)"; echo 'Class-Path: @LIBINTL_JAR@'; } > Manifest.mf
129 catalogs=`MAKEFLAGS= $(MAKE) -s -C po echo-catalogs`; \
130 $(JAR) cfm $@ Manifest.mf Hello*.class $(hello_RESOURCES) $$catalogs
133 Hello.class: $(srcdir)/Hello.java
134 CLASSPATH=.@CLASSPATH_SEPARATOR@$(hello_JAVALIBS) $(JAVACOMP) -d . $(srcdir)/Hello.java
137 { echo '#!/bin/sh'; \
138 echo "CLASSPATH='$(jardir)/hello.jar@CLASSPATH_SEPARATOR@$(hello_JAVALIBS)'\$${CLASSPATH+\"@CLASSPATH_SEPARATOR@\$$CLASSPATH\"}"; \
139 echo "export CLASSPATH"; \
140 echo "exec /bin/sh '$(pkgdatadir)/javaexec.sh' $(hello_MAINCLASS) \"\$$@\""; \
143 install-exec-local: all-local
144 $(mkdir_p) $(DESTDIR)$(bindir)
145 $(INSTALL_SCRIPT) hello.sh $(DESTDIR)$(bindir)/hello
147 install-data-local: all-local
148 $(mkdir_p) $(DESTDIR)$(jardir)
149 $(INSTALL_DATA) hello.jar $(DESTDIR)$(jardir)/hello.jar
150 $(mkdir_p) $(DESTDIR)$(pkgdatadir)
151 $(INSTALL_DATA) javaexec.sh $(DESTDIR)$(pkgdatadir)/javaexec.sh
154 $(mkdir_p) $(DESTDIR)$(jardir)
155 $(mkdir_p) $(DESTDIR)$(pkgdatadir)
158 rm -f $(DESTDIR)$(bindir)/hello
159 rm -f $(DESTDIR)$(jardir)/hello.jar
160 rm -f $(DESTDIR)$(pkgdatadir)/javaexec.sh
162 CLEANFILES += hello.jar Hello*.class Manifest.mf hello.sh