midlet-example/Makefile
Juhani Krekelä 705bb26b76 First commit
2026-10-12 15:05:49 +02:00

40 lines
1.3 KiB
Makefile

JAVA ?= java
PROGUARD ?= $(JAVA) -jar third-party/tools/proguard-7.10.0.jar
ECJ ?= $(JAVA) -jar third-party/tools/ecj-4.32.jar
BSDTAR ?= bsdtar
MIDP_20_API_JAR ?= third-party/api/midpapi20-2.0.4.jar
CLCD_11_API_JAR ?= third-party/api/cldcapi11-2.0.4.jar
TARGET_JAVA_VERSION ?= 1.2
SRC != find src -type f -name '*.java'
RES != find res -type f
MIDLET = MIDletExample.jar
MIDLET_CONTENTS = $(SRC:.java=.class) $(RES)
.SUFFIXES:
.SUFFIXES: .java .class .jar .zip
all: $(MIDLET)
.PHONY: all
# J2ME .jars must be "preverified" before they can be run on devices. We
# use .jar only for the final preverified artifact and .zip for the
# initial non-preverified archive.
.zip.jar:
# Proguard can do other things too, some of which might even be
# useful, but we only use it for preverification here.
$(PROGUARD) -injars $< -outjars $@ -libraryjars $(MIDP_20_API_JAR) -libraryjars $(CLCD_11_API_JAR) -dontshrink -dontoptimize -dontobfuscate -microedition
$(MIDLET:.jar=.zip): $(MIDLET_CONTENTS)
$(BSDTAR) -cf $(MIDLET:.jar=.zip) --format zip --strip-components 1 $(MIDLET_CONTENTS)
.java.class:
$(ECJ) -target $(TARGET_JAVA_VERSION) -bootclasspath $(MIDP_20_API_JAR):$(CLCD_11_API_JAR) $<
clean distclean:
find src -name '*.class' -delete
rm -f *.zip *.jar
.PHONY: clean distclean