1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
|
# Copyright © Martin Ueding <dev@martin-ueding.de>
# This file is part of jscribble.
#
# jscribble 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 of the License, or (at your option) any later
# version.
#
# jscribble 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
# jscribble. If not, see <http://www.gnu.org/licenses/>.
###########################################################################
# Variables, File Lists #
###########################################################################
# Current version of the program.
name=jscribble
version:=1.7.7
# Find all the Java files in the source tree and generate a matching list of
# class files (targets) from that.
alljavafiles:=$(shell find . \( ! -regex '.*/\..*' \) -name "*.java")
allclassfiles:=$(alljavafiles:.java=.class)
javafiles:=$(shell find jscribble -name "*.java")
classfiles:=$(javafiles:.java=.class)
# Java compiler to use.
javac:=javac -encoding UTF-8
# Output file names.
foldername:=$(name)-$(version)
signedjar:=$(name)_$(version).jar
tarball:=$(name)_$(version).tar.gz
.DELETE_ON_ERROR:
###########################################################################
# Named Targets #
###########################################################################
# Builds the main program.
all: program install_files/completion/jscribble doc
# Removes all build files. The changelog and the manual page are not included
# since they are hard to come by.
clean:
$(RM) $(allclassfiles)
$(RM) *.jar
$(RM) *.mo
$(RM) -r javadoc
$(RM) .testrun
$(RM) doc/jscribble.1
$(RM) doc/keylist.rst
$(RM) install_files/completion/jscribble
$(RM) jscribble/VersionName.java
$(RM) jscribble/default_config.properties
$(RM) jscribble_*.*.tar.gz
$(RM) l10n/de.po~
$(RM) l10n/jscribble.pot
$(RM) l10n/jscribble_*.properties
doc: doc/jscribble.1
# Extracts all javadoc comments from the source codes and generates HTML pages
# with that information.
doc-dev: javadoc/index.html
# Creates the template for translators.
i18n: l10n/jscribble.pot
# Installs the jar file and the launcher script into DESTDIR.
install: jscribble.jar install_files/completion/jscribble
mkdir -p "$(DESTDIR)/usr/share/jscribble"
install -m 644 jscribble.jar "$(DESTDIR)/usr/share/jscribble/"
mkdir -p "$(DESTDIR)/usr/bin"
install -m 755 install_files/jscribble "$(DESTDIR)/usr/bin/"
mkdir -p "$(DESTDIR)/etc/bash_completion.d/"
install -m 644 install_files/completion/jscribble "$(DESTDIR)/etc/bash_completion.d/"
mkdir -p "$(DESTDIR)/usr/share/man/man1/"
install -m 644 doc/jscribble.1 "$(DESTDIR)/usr/share/man/man1/"
gzip "$(DESTDIR)/usr/share/man/man1/jscribble.1"
program: jscribble/default_config.properties jscribble.jar
# Creates a jar file which contains the version name, ready for Java Web Start
# deployment.
signed-jar: $(signedjar)
# Creates a tarball which contains all the source code. The changelog and the
# manual page are included, although they are build files, since the tools
# needed for that are not ubiquitous.
tarball: $(tarball)
# Runs all available unit tests.
test: program $(allclassfiles)
junit -text tests.JscribbleTestSuite
###########################################################################
# Explicit Rules #
###########################################################################
# Signs the jar file with Martin's key.
$(signedjar): jscribble.jar
jarsigner $< mu
cp $< $@
# Put all the files that are tracked in git in a tarball and amend the hard to
# come by build files.
$(tarball): surrogates.tar .git/HEAD
$(RM) $@
git archive --prefix=$(foldername)/ HEAD > $(basename $@ .gz)
tar -Af $(basename $@ .gz) $<
gzip $(basename $@ .gz)
# Creates a changelog file with the information in the git tags.
CHANGELOG: .git/HEAD
git-changelog > CHANGELOG
# Creates the roff manual page.
doc/jscribble.1: doc/jscribble.1.rst doc/keylist.rst
rst2man $< $@
# Inserts the values and comments from the default config into the manual page.
doc/keylist.rst: doc/keylist.php jscribble/default_config.properties
php $< > $@
install_files/completion/jscribble: install_files/completion/generate_completion config/config.js
$< > $@
# Create standard javadoc.
javadoc/index.html: $(alljavafiles)
javadoc -d javadoc $^
jscribble/default_config.properties: config/generate_properties config/config.js
$< > $@
# Generate a Java file that tells the program its version number.
jscribble/VersionName.java: makefile
./generate_version_class $(version) > $@
# Put all the class files into the jar.
jscribble.jar: jscribble/VersionName.class $(classfiles) l10n/jscribble_de.properties jscribble/default_config.properties artwork/jscribble.png artwork/jscribble_gray.png
jar -cfm $@ manifest.txt $^
# Convert the object into a Java compatible file.
l10n/jscribble_de.properties: l10n/de.po
msgcat --properties-output -o $@ $<
# Extract the strings from all Java source files.
l10n/jscribble.pot: $(alljavafiles)
xgettext -o $@ -k -k"Localizer.get" $^ --from-code=utf-8
# Tar achive which contains files which cannot be generated with out the git
# repository.
surrogates.tar: CHANGELOG
tar -cf $@ --transform 's,^,/$(foldername)/,' $^
###########################################################################
# Implicit Rules #
###########################################################################
# How to compile regular Java files.
jscribble/%.class: jscribble/%.java
$(javac) $<
# How to compile unit tests.
tests/%.class: tests/%.java
$(javac) -classpath /usr/share/java/junit.jar -sourcepath .:jscribble $<
|