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