1 # Example for use of GNU gettext.
2 # Copyright (C) 2003 Free Software Foundation, Inc.
3 # This file is in the public domain.
5 # Makefile configuration - processed by automake.
7 # General automake options.
8 AUTOMAKE_OPTIONS = foreign
9 ACLOCAL_AMFLAGS = -I m4
11 # The list of subdirectories containing Makefiles.
14 # The list of programs that are built.
15 bin_JAVAPROGRAMS = hello
17 # The source files of the 'hello' program.
18 hello_SOURCES = Hello.java
19 hello_CLASSES = Hello.class
21 # The entry point of the 'hello' program.
22 hello_MAINCLASS = Hello
24 # The link dependencies of the 'hello' program.
25 hello_JAVALIBS = @LIBINTL_JAR@
27 # The resources of the 'hello' program, excluding message catalogs, but
28 # including the fallback message catalog.
29 hello_RESOURCES = hello-java-awt.properties
31 # Resources that are generated from PO files.
32 MAINTAINERCLEANFILES = hello-java-awt*.properties
34 # Additional files to be distributed.
35 EXTRA_DIST = autogen.sh autoclean.sh
38 # ----------------- General rules for compiling Java programs -----------------
40 jardir = $(datadir)/$(PACKAGE)
41 pkgdatadir = $(datadir)/$(PACKAGE)
42 pkglibdir = $(libdir)/$(PACKAGE)
47 JAVACOMP = $(SHELL) javacomp.sh
51 EXTRA_DIST += $(hello_SOURCES)
53 DISTCLEANFILES = javacomp.sh javaexec.sh
59 # Rules for compiling Java programs as native code.
61 all-local: $(hello_MAINCLASS)$(EXEEXT) hello-resources.jar hello.sh
63 # Does not work yet with GCC 3.3.
64 #$(hello_MAINCLASS)$(EXEEXT): $(srcdir)/Hello.java
65 # CLASSPATH=.@CLASSPATH_SEPARATOR@$(hello_JAVALIBS) $(GCJ) $(GCJFLAGS) $(srcdir)/Hello.java $(hello_JAVALIBS) --main=$(hello_MAINCLASS) -o $@
67 $(hello_MAINCLASS)$(EXEEXT): Hello.$(OBJEXT) libintl.a
68 $(GCJ) $(GCJFLAGS) Hello.$(OBJEXT) libintl.a --main=$(hello_MAINCLASS) -o $@
70 Hello.$(OBJEXT): $(srcdir)/Hello.java
71 CLASSPATH=.@CLASSPATH_SEPARATOR@$(hello_JAVALIBS) $(GCJ) $(GCJFLAGS) -c $(srcdir)/Hello.java -o $@
76 cd tmpdir && $(JAR) xf @LIBINTL_JAR@ && \
77 for f in `find . -name '*.class' -print`; do \
78 $(GCJ) $(GCJFLAGS) -c $$f -o `echo $$f | sed -e 's,^\./,,' -e 's,\.class$$,,' -e 's,/,.,g'`.$(OBJEXT) || exit 1; \
80 rm -f ../libintl.a && \
81 ar cru ../libintl.a `find . -name '*.$(OBJEXT)' -print`
86 catalogs=`MAKEFLAGS= $(MAKE) -s -C po echo-catalogs`; \
87 $(JAR) cf $@ $(hello_RESOURCES) $$catalogs
91 echo "CLASSPATH='$(jardir)/hello-resources.jar'\$${CLASSPATH+\"@CLASSPATH_SEPARATOR@\$$CLASSPATH\"}"; \
92 echo "export CLASSPATH"; \
93 echo "exec '$(pkglibdir)/$(hello_MAINCLASS)$(EXEEXT)' \"\$$@\""; \
96 install-exec-local: all-local
97 $(mkinstalldirs) $(DESTDIR)$(bindir)
98 $(INSTALL_SCRIPT) hello.sh $(DESTDIR)$(bindir)/hello
99 $(mkinstalldirs) $(DESTDIR)$(pkglibdir)
100 $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $(hello_MAINCLASS)$(EXEEXT) $(DESTDIR)$(pkglibdir)/$(hello_MAINCLASS)$(EXEEXT)
102 install-data-local: all-local
103 $(mkinstalldirs) $(DESTDIR)$(jardir)
104 $(INSTALL_DATA) hello-resources.jar $(DESTDIR)$(jardir)/hello-resources.jar
107 $(mkinstalldirs) $(DESTDIR)$(bindir)
108 $(mkinstalldirs) $(DESTDIR)$(pkglibdir)
109 $(mkinstalldirs) $(DESTDIR)$(jardir)
112 rm -f $(DESTDIR)$(bindir)/hello
113 rm -f $(DESTDIR)$(pkglibdir)/$(hello_MAINCLASS)$(EXEEXT)
114 rm -f $(DESTDIR)$(jardir)/hello-resources.jar
116 CLEANFILES += $(hello_MAINCLASS)$(EXEEXT) *.$(OBJEXT) *.a tmpdir hello-resources.jar hello.sh
122 # Rules for compiling Java programs as jar libraries.
123 # This is the preferred mode during development, because you can easily test
124 # the program without installing it, simply by doing "java -jar hello.jar".
126 all-local: hello.jar hello.sh
128 hello.jar: $(hello_CLASSES)
129 { echo "Manifest-Version: 1.0"; echo "Main-Class: $(hello_MAINCLASS)"; echo 'Class-Path: @LIBINTL_JAR@'; } > Manifest.mf
130 catalogs=`MAKEFLAGS= $(MAKE) -s -C po echo-catalogs`; \
131 $(JAR) cfm $@ Manifest.mf Hello*.class $(hello_RESOURCES) $$catalogs
134 Hello.class: $(srcdir)/Hello.java
135 CLASSPATH=.@CLASSPATH_SEPARATOR@$(hello_JAVALIBS) $(JAVACOMP) -d . $(srcdir)/Hello.java
138 { echo '#!/bin/sh'; \
139 echo "CLASSPATH='$(jardir)/hello.jar@CLASSPATH_SEPARATOR@$(hello_JAVALIBS)'\$${CLASSPATH+\"@CLASSPATH_SEPARATOR@\$$CLASSPATH\"}"; \
140 echo "export CLASSPATH"; \
141 echo "exec /bin/sh '$(pkgdatadir)/javaexec.sh' $(hello_MAINCLASS) \"\$$@\""; \
144 install-exec-local: all-local
145 $(mkinstalldirs) $(DESTDIR)$(bindir)
146 $(INSTALL_SCRIPT) hello.sh $(DESTDIR)$(bindir)/hello
148 install-data-local: all-local
149 $(mkinstalldirs) $(DESTDIR)$(jardir)
150 $(INSTALL_DATA) hello.jar $(DESTDIR)$(jardir)/hello.jar
151 $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
152 $(INSTALL_DATA) javaexec.sh $(DESTDIR)$(pkgdatadir)/javaexec.sh
155 $(mkinstalldirs) $(DESTDIR)$(jardir)
156 $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
159 rm -f $(DESTDIR)$(bindir)/hello
160 rm -f $(DESTDIR)$(jardir)/hello.jar
161 rm -f $(DESTDIR)$(pkgdatadir)/javaexec.sh
163 CLEANFILES += hello.jar Hello*.class Manifest.mf hello.sh