2024-02-17 11:19:53 +00:00
|
|
|
include env.mk
|
|
|
|
|
|
|
|
SRC = src
|
|
|
|
|
|
|
|
SRC_DIR := src
|
|
|
|
|
2024-02-17 11:27:19 +00:00
|
|
|
RES_DIR := res
|
|
|
|
|
2024-05-27 09:30:35 +00:00
|
|
|
PHEADERS = $(HEADERS):$(JAVA_HOME)/jre/lib/rt.jar
|
|
|
|
|
2024-05-26 03:11:15 +00:00
|
|
|
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
|
|
|
|
|
|
|
|
SRCS := $(call rwildcard,$(SRC_DIR),*.kt)
|
2024-02-17 11:19:53 +00:00
|
|
|
|
2024-02-17 15:01:40 +00:00
|
|
|
CLASSNAME := com.Hello
|
2024-02-17 11:19:53 +00:00
|
|
|
|
|
|
|
KOTLINC = kotlinc
|
2024-02-17 15:01:40 +00:00
|
|
|
KOTLINFLAGS = -cp $(HEADERS) -d jars/classes.jar -jvm-target 1.8 -include-runtime
|
2024-02-17 11:19:53 +00:00
|
|
|
|
|
|
|
.SUFFIXES: .kt
|
|
|
|
|
|
|
|
.PHONY: all clean
|
|
|
|
|
2024-05-25 23:16:04 +00:00
|
|
|
all: release
|
2024-02-17 11:19:53 +00:00
|
|
|
|
2024-02-17 15:01:40 +00:00
|
|
|
jars/classes.jar: $(SRCS)
|
|
|
|
@mkdir -p jars
|
|
|
|
$(KOTLINC) $(KOTLINFLAGS) $<
|
2024-02-17 11:19:53 +00:00
|
|
|
|
|
|
|
clean:
|
2024-02-17 15:01:40 +00:00
|
|
|
rm -rf jars/
|
2024-02-17 11:19:53 +00:00
|
|
|
|
2024-02-17 15:01:40 +00:00
|
|
|
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 .
|
2024-02-17 11:19:53 +00:00
|
|
|
|
2024-02-17 15:01:40 +00:00
|
|
|
release jars/release.jar: jars/result.jar
|
2024-05-27 09:30:35 +00:00
|
|
|
proguard -include proguard.conf -libraryjars $(PHEADERS) -keepclassmembers class $(CLASSNAME) { public \<methods\> ';' } -keep public class $(CLASSNAME)
|
2024-02-17 11:19:53 +00:00
|
|
|
|
|
|
|
run:
|
2024-02-17 15:01:40 +00:00
|
|
|
$(EMULATOR) jars/result.jar
|