1# Example for use of GNU gettext.
2# Copyright (C) 2003 Free Software Foundation, Inc.
3# This file is in the public domain.
4#
5# Makefile configuration - processed by automake.
6
7# General automake options.
8AUTOMAKE_OPTIONS = foreign
9ACLOCAL_AMFLAGS = -I m4
10
11# The list of subdirectories containing Makefiles.
12SUBDIRS = m4 po
13
14# The list of programs that are built.
15bin_JAVAPROGRAMS = hello
16
17# The source files of the 'hello' program.
18hello_SOURCES = Hello.java
19hello_CLASSES = Hello.class
20
21# The entry point of the 'hello' program.
22hello_MAINCLASS = Hello
23
24# The link dependencies of the 'hello' program.
25hello_JAVALIBS = @LIBINTL_JAR@
26
27# The resources of the 'hello' program, excluding message catalogs, but
28# including the fallback message catalog.
29hello_RESOURCES = hello-java-awt.properties
30
31# Resources that are generated from PO files.
32MAINTAINERCLEANFILES = hello-java-awt*.properties
33
34# Additional files to be distributed.
35EXTRA_DIST = autogen.sh autoclean.sh
36
37
38# ----------------- General rules for compiling Java programs -----------------
39
40jardir = $(datadir)/$(PACKAGE)
41pkgdatadir = $(datadir)/$(PACKAGE)
42pkglibdir = $(libdir)/$(PACKAGE)
43
44GCJ = @GCJ@
45GCJFLAGS = @GCJFLAGS@
46JAR = @JAR@
47JAVACOMP = $(SHELL) javacomp.sh
48AR = ar
49RANLIB = @RANLIB@
50
51EXTRA_DIST += $(hello_SOURCES)
52CLEANFILES =
53DISTCLEANFILES = javacomp.sh javaexec.sh
54
55
56if USEJEXE
57
58
59# Rules for compiling Java programs as native code.
60
61all-local: $(hello_MAINCLASS)$(EXEEXT) hello-resources.jar hello.sh
62
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 $@
66
67$(hello_MAINCLASS)$(EXEEXT): Hello.$(OBJEXT) libintl.a
68	$(GCJ) $(GCJFLAGS) Hello.$(OBJEXT) libintl.a --main=$(hello_MAINCLASS) -o $@
69
70Hello.$(OBJEXT): $(srcdir)/Hello.java
71	CLASSPATH=.@CLASSPATH_SEPARATOR@$(hello_JAVALIBS) $(GCJ) $(GCJFLAGS) -c $(srcdir)/Hello.java -o $@
72
73libintl.a:
74	rm -rf tmpdir
75	mkdir tmpdir
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; \
79	done && \
80	rm -f ../libintl.a && \
81	ar cru ../libintl.a `find . -name '*.$(OBJEXT)' -print`
82	rm -rf tmpdir
83	$(RANLIB) $@
84
85hello-resources.jar:
86	catalogs=`MAKEFLAGS= $(MAKE) -s -C po echo-catalogs`; \
87	$(JAR) cf $@ $(hello_RESOURCES) $$catalogs
88
89hello.sh:
90	{ echo '#!/bin/sh'; \
91	  echo "CLASSPATH='$(jardir)/hello-resources.jar'\$${CLASSPATH+\"@CLASSPATH_SEPARATOR@\$$CLASSPATH\"}"; \
92	  echo "export CLASSPATH"; \
93	  echo "exec '$(pkglibdir)/$(hello_MAINCLASS)$(EXEEXT)' \"\$$@\""; \
94	} > $@
95
96install-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)
101
102install-data-local: all-local
103	$(mkinstalldirs) $(DESTDIR)$(jardir)
104	$(INSTALL_DATA) hello-resources.jar $(DESTDIR)$(jardir)/hello-resources.jar
105
106installdirs-local:
107	$(mkinstalldirs) $(DESTDIR)$(bindir)
108	$(mkinstalldirs) $(DESTDIR)$(pkglibdir)
109	$(mkinstalldirs) $(DESTDIR)$(jardir)
110
111uninstall-local:
112	rm -f $(DESTDIR)$(bindir)/hello
113	rm -f $(DESTDIR)$(pkglibdir)/$(hello_MAINCLASS)$(EXEEXT)
114	rm -f $(DESTDIR)$(jardir)/hello-resources.jar
115
116CLEANFILES += $(hello_MAINCLASS)$(EXEEXT) *.$(OBJEXT) *.a tmpdir hello-resources.jar hello.sh
117
118
119else
120
121
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".
125
126all-local: hello.jar hello.sh
127
128hello.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
132	rm -f Manifest.mf
133
134Hello.class: $(srcdir)/Hello.java
135	CLASSPATH=.@CLASSPATH_SEPARATOR@$(hello_JAVALIBS) $(JAVACOMP) -d . $(srcdir)/Hello.java
136
137hello.sh:
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) \"\$$@\""; \
142	} > $@
143
144install-exec-local: all-local
145	$(mkinstalldirs) $(DESTDIR)$(bindir)
146	$(INSTALL_SCRIPT) hello.sh $(DESTDIR)$(bindir)/hello
147
148install-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
153
154installdirs-local:
155	$(mkinstalldirs) $(DESTDIR)$(jardir)
156	$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
157
158uninstall-local:
159	rm -f $(DESTDIR)$(bindir)/hello
160	rm -f $(DESTDIR)$(jardir)/hello.jar
161	rm -f $(DESTDIR)$(pkgdatadir)/javaexec.sh
162
163CLEANFILES += hello.jar Hello*.class Manifest.mf hello.sh
164
165
166endif
167