• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# GNU/Linux makefile for ProGuard.
2
3ANT_HOME = /usr/local/java/ant
4WTK_HOME = /usr/local/java/wtk
5
6PROGUARD_HOME := $(subst ./..,..,$(subst /build/..,/,$(dir $(MAKEFILE_LIST))..))
7SRC     = $(PROGUARD_HOME)/src
8CLASSES = $(PROGUARD_HOME)/classes
9LIB     = $(PROGUARD_HOME)/lib
10
11ANT_JAR = $(ANT_HOME)/lib/ant.jar
12WTK_JAR = $(WTK_HOME)/wtklib/kenv.zip
13
14CLASSPATH = $(ANT_JAR):$(WTK_JAR)
15
16PROGUARD     = proguard/ProGuard
17PROGUARD_GUI = proguard/gui/ProGuardGUI
18RETRACE      = proguard/retrace/ReTrace
19ANT_TASK     = proguard/ant/ProGuardTask
20WTK_PLUGIN   = proguard/wtk/ProGuardObfuscator
21
22TARGETS = $(PROGUARD) $(PROGUARD_GUI) $(RETRACE) $(ANT_TASK) $(WTK_PLUGIN)
23
24JAVAC_OPTIONS = -nowarn -Xlint:none -classpath $(CLASSPATH) -sourcepath $(SRC) -d $(CLASSES)
25
26# Command sequence definitions for creating jars.
27
28define createjar
29  jar -cfm $(LIB)/$@.jar $(SRC)/$(dir $<)MANIFEST.MF \
30    -C $(CLASSES) $(dir $<)
31endef
32
33define updatejar
34  jar -uf $(LIB)/proguard.jar \
35    -C $(CLASSES) $(dir $<)
36endef
37
38# The various targets.
39
40all:     basic options
41basic:   proguard proguardgui retrace
42options: anttask wtkplugin
43
44proguard: $(PROGUARD)
45	$(createjar)
46
47proguardgui: proguard
48proguardgui: $(PROGUARD_GUI)
49	$(createjar)
50
51retrace: $(RETRACE)
52	$(createjar)
53
54anttask: $(ANT_JAR)
55anttask: $(PROGUARD)
56anttask: $(ANT_TASK)
57	$(updatejar)
58
59wtkplugin: $(WTK_JAR)
60wtkplugin: $(PROGUARD)
61wtkplugin: $(WTK_PLUGIN)
62	$(updatejar)
63
64clean:
65	-rm -fr $(CLASSES) $(LIB)
66
67
68define RESOURCES
69  $(shell find $(SRC)/$(dir $(1)) -maxdepth 1 \( -name \*.properties -o -name \*.png -o -name \*.gif -o -name \*.pro \) -printf $(CLASSES)/$(dir $(1))%P\\n)
70endef
71
72define TARGETRULE
73  $(1): $(CLASSES) $(CLASSES)/$(1).class $(call RESOURCES,$(1)) $(LIB)
74endef
75
76$(foreach TARGET,$(TARGETS),$(eval $(call TARGETRULE,$(TARGET))))
77
78$(CLASSES) $(LIB):
79	-mkdir -p $@
80
81$(CLASSES)/%.class: $(SRC)/%.java
82	javac $(JAVAC_OPTIONS) $^
83
84$(CLASSES)/%.properties $(CLASSES)/%.png $(CLASSES)/%.gif $(CLASSES)/%.pro:
85	cp $(subst $(CLASSES),$(SRC),$@) $@
86
87%.jar %.zip:
88	echo "Please make sure the path to $@ is set"
89	echo "correctly in this $(strip $(MAKEFILE_LIST))."
90	echo "Alternatively, if you don't need the corresponding option,"
91	echo "you can run `make' with the option -k."
92	find $@
93
94.PHONY: all basic options proguard proguardgui retrace anttask wtkplugin clean $(TARGETS) $(OPTIONAL_TARGETS)
95