forked from erimatnor/PhonePledge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (40 loc) · 1.31 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
JARFILE = phonepledge.jar
MANIFEST = Manifest.txt
SOURCEFILES = $(shell cd src; find . -name *.java -print)
RESOURCES = $(shell find src -name *.png -print) $(shell find src -name *.jpg -print)
JAR_LIBS = libs/dom4j-1.6.1.jar libs/json.jar libs/jsoup-1.5.2.jar libs/jaxen-1.1.3.jar libs/jtidy.jar
colon:= :
empty:=
space:= $(empty) $(empty)
CLASSPATH = $(subst $(space),$(colon),$(JAR_LIBS)):src
CLASSES = $(addprefix bin/,$(SOURCEFILES:%.java=%.class))
SOURCES := $(addprefix src/,$(SOURCEFILES))
$(JARFILE): $(CLASSES) classes.list sources.list resources.list $(MANIFEST) Makefile
@echo "Creating Jar file"
@(cd bin; jar cfm ../$@ ../$(MANIFEST) @../classes.list)
@(cd src; jar uf ../$@ @../resources.list)
@mkdir -p temp
@FS=':'
@for jar in $(JAR_LIBS); do \
cd temp; \
jar xf ../$$jar; \
rm -rf META-INF; \
cd ..; \
done
@(cd temp; jar uf ../$@ *)
@rm -rf temp
$(CLASSES): $(SOURCES)
@mkdir -p bin
javac -cp $(CLASSPATH) -d bin $(SOURCES)
classes.list: $(CLASSES)
@(cd bin; find . -name "*.class" -print > ../$@)
sources.list: $(SOURCES)
@(cd src; find . -name "*.java" -print > ../$@)
resources.list: $(RESOURCES)
@(cd src; find . -name "*.png" -print > ../$@)
@(cd src; find . -name "*.jpg" -print >> ../$@)
clean:
rm -f *~
rm -rf bin/*
rm -f $(JARFILE)
rm -f classes.list sources.list resources.list