JavaTXCompilerInJavaTX/makefile

37 lines
1.0 KiB
Makefile

JFLAGS = -g:none -implicit:none
JC = javac
JTX = JavaTXcompiler-1.0-jar-with-dependencies.jar
SRCDIR = javatx-src/main/java
DESTDIR = out
# Use find to locate all .java and .jav files recursively
JAVASOURCES := $(shell find $(SRCDIR) -name '*.java')
JAVSOURCES := $(shell find $(SRCDIR) -name '*.jav')
# Convert .java files to .class files with the same directory structure
JAVACLASSES := $(patsubst $(SRCDIR)/%.java,$(DESTDIR)/%.class,$(JAVASOURCES))
JAVCLASSES := $(patsubst $(SRCDIR)/%.jav,$(DESTDIR)/%.class,$(JAVSOURCES))
default: classes
$(DESTDIR):
mkdir -p $(DESTDIR)
# Rule for creating directories
# Rule for compiling .jav files
$(DESTDIR)/%.class: $(SRCDIR)/%.jav | $(DESTDIR)
java -jar $(JTX) -d "$(dir $@)" -cp "$(SRCDIR):$(DESTDIR):target/dependencies/" $<
# Rule for compiling .java files
$(DESTDIR)/%.class: $(SRCDIR)/%.java | $(DESTDIR)
$(JC) -nowarn -d $(DESTDIR) -cp "$(SRCDIR):$(DESTDIR):target/dependencies/*" $(JFLAGS) $<
classes: $(JAVCLASSES) $(JAVACLASSES)
clean:
$(RM) -r $(DESTDIR)/*