Add "result" target in Makefile.
This commit is contained in:
parent
571a8aabcd
commit
ac7ce6f62b
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,3 @@
|
||||
env.mk
|
||||
build/
|
||||
result.jar
|
||||
a.jar
|
||||
jars/
|
||||
|
26
Makefile
26
Makefile
@ -4,16 +4,14 @@ SRC = src
|
||||
|
||||
SRC_DIR := src
|
||||
|
||||
OUT_DIR := build
|
||||
|
||||
RES_DIR := res
|
||||
|
||||
SRCS := $(wildcard $(SRC_DIR)/*/*.kt)
|
||||
|
||||
CLS := $(SRCS:$(SRC_DIR)/%.kt=$(OUT_DIR)/%.class)
|
||||
CLASSNAME := com.Hello
|
||||
|
||||
KOTLINC = kotlinc
|
||||
KOTLINFLAGS = -cp $(HEADERS) -d $(OUT_DIR) -jvm-target 1.8
|
||||
KOTLINFLAGS = -cp $(HEADERS) -d jars/classes.jar -jvm-target 1.8 -include-runtime
|
||||
|
||||
.SUFFIXES: .kt
|
||||
|
||||
@ -21,21 +19,19 @@ KOTLINFLAGS = -cp $(HEADERS) -d $(OUT_DIR) -jvm-target 1.8
|
||||
|
||||
all: translate
|
||||
|
||||
$(CLS): $(OUT_DIR)/%.class: $(SRC_DIR)/%.kt
|
||||
@mkdir -p build
|
||||
jars/classes.jar: $(SRCS)
|
||||
@mkdir -p jars
|
||||
$(KOTLINC) $(KOTLINFLAGS) $<
|
||||
rm -rf build/META-INF/
|
||||
|
||||
clean:
|
||||
rm -rf build/
|
||||
rm -f result.jar
|
||||
rm -f a.jar
|
||||
rm -rf jars/
|
||||
|
||||
pack a.jar: $(wildcard $(OUT_DIR)/*.class) $(wildcard $(RES_DIR)/*) $(CLS)
|
||||
jar -cmf META-INF/MANIFEST.MF a.jar -C build . -C res .
|
||||
jars/result.jar: jars/classes.jar
|
||||
-$(RETROTRANSLATOR) -srcjar jars/classes.jar -destjar jars/result.jar
|
||||
jar -umf META-INF/MANIFEST.MF jars/result.jar -C res .
|
||||
|
||||
translate result.jar: a.jar
|
||||
$(RETROTRANSLATOR) -srcjar a.jar -destjar result.jar
|
||||
release jars/release.jar: jars/result.jar
|
||||
proguard -include proguard.conf -keepclassmembers class $(CLASSNAME) { public \<methods\> ';' }
|
||||
|
||||
run:
|
||||
$(EMULATOR) result.jar
|
||||
$(EMULATOR) jars/result.jar
|
||||
|
@ -1,4 +1,5 @@
|
||||
HEADERS =
|
||||
EMULATOR = java -jar
|
||||
RETROTRANSLATOR = java -jar
|
||||
PROGUARD = java -jar
|
||||
|
||||
|
5
proguard.conf
Normal file
5
proguard.conf
Normal file
@ -0,0 +1,5 @@
|
||||
-injars jars/result.jar(!**.kotlin_builtins,!META-INF/main.kotlin_module,!META-INF/services/**)
|
||||
-outjars jars/release.jar
|
||||
-dontwarn
|
||||
-keep public class com.Hello
|
||||
-microedition
|
Loading…
Reference in New Issue
Block a user