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