JavaTXCompilerInJavaTX/makefile

40 lines
1.1 KiB
Makefile

JFLAGS = -g:none
JC = javac
JTX = JavaTXcompiler-0.4-jar-with-dependencies.jar
SRCDIR = javatx-src/main/java
DESTDIR = out
# Use find to locate all .java 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))
# Create a list of directories that need to be created in the destination directory
DIRS := $(sort $(dir $(JAVACLASSES))) $(sort $(dir $(JAVCLASSES)))
default: classes
# Rule for creating directories
#$(DIRS):
# @mkdir -p $@
# Rule for compiling .jav files
$(DESTDIR)/%.class: $(SRCDIR)/%.jav #| $(DIRS)
java -jar $(JTX) -d "$(dir $@)" -cp "src/main/java:out:target/dependencies/" $<
# Rule for compiling .java files
$(DESTDIR)/%.class: $(SRCDIR)/%.java #| $(DIRS)
$(JC) -nowarn -d "$(dir $@)" -cp "src/main/java:out:target/dependencies/*" $(JFLAGS) $<
classes: $(JAVCLASSES) $(JAVACLASSES)
clean:
$(RM) -r $(DESTDIR)/*