-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
80 lines (63 loc) · 2.51 KB
/
Makefile
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
# This file is part of TTDViewer.
# TTDViewer 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, version 2.
# TTDViewer 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 TTDViewer. If not, see <http://www.gnu.org/licenses/>.
# Tool chain
JAVA = java
JAVAC = javac
JAVAC_OPTS = -deprecation
JAVADOC = javadoc
JAVADOC_OPTS = -private
JAR = jar
ZIP = zip
XMLLINT = xmllint
XMLLINT_OPTS = --noout
# Folders
SRC = src
OUTPUT = classes
RELEASE = release
MAIN = TTDViewer
DOC = doc
# Ok, always doing a 'clean' is not really the point of Makefile
all: validate clean
@mkdir -p $(OUTPUT)
$(JAVAC) $(JAVAC_OPTS) -sourcepath $(SRC) -classpath $(OUTPUT) -d $(OUTPUT) -s $(OUTPUT) $(SRC)/*.java
git show -s --date=short --pretty='format:%cd %h' HEAD > $(OUTPUT)/rev.txt
git update-index --refresh >/dev/null || true
if [ -n "`git diff-index HEAD`" ]; then (echo "M" >> $(OUTPUT)/rev.txt); fi
cp -u $(SRC)/*.xml $(SRC)/*.xsd $(OUTPUT)
validate:
$(XMLLINT) $(XMLLINT_OPTS) --schema $(SRC)/recolor.xsd $(SRC)/recolor.xml
run: all
cd $(OUTPUT); $(JAVA) $(MAIN); cd ..
maintainer-clean: clean
clean:
rm -f $(OUTPUT)/*.class
jar: all
@mkdir -p $(RELEASE)
@echo "$(JAVA) -jar $(MAIN).jar %1 %2 %3 %4 %5 %6 %7 %8 %9" > $(RELEASE)/$(MAIN).bat
@echo "#!/bin/sh" > $(RELEASE)/$(MAIN).sh
@echo '$(JAVA) -jar `readlink -m $$0 | xargs dirname`/$(MAIN).jar "$$@"' >> $(RELEASE)/$(MAIN).sh
@chmod 644 $(RELEASE)/$(MAIN).bat
@chmod 755 $(RELEASE)/$(MAIN).sh
@cp COPYING readme.txt $(RELEASE)
$(JAR) cfe $(RELEASE)/$(MAIN).jar $(MAIN) -C $(OUTPUT) .
jar_run: jar
cd $(RELEASE); ./$(MAIN).sh; cd ..
release: jar
rm -f $(MAIN).zip; $(ZIP) -j $(MAIN).zip $(RELEASE)/*
doc:
@mkdir -p $(DOC)
$(JAVADOC) $(JAVADOC_OPTS) -sourcepath $(SRC) -classpath $(OUTPUT) -d $(DOC) $(SRC)/*.java
help:
@echo 'Targets:'
@echo ' all Build'
@echo ' run Build & Run'
@echo ' jar Build & Bundle'
@echo ' jar_run Build & Bundle & Run'
@echo ' release Build & Bundle & Zip'
@echo ' validate Only validate XML'
@echo ' doc Build documentation'
@echo ' clean Remove temporary files'
@echo ' help Print this message'
.PHONY: all run clean validate help jar run_jar release doc