2023-12-12 16:39:04 +00:00
|
|
|
JFLAGS = -g:none
|
2023-11-23 15:20:44 +00:00
|
|
|
JC = javac
|
|
|
|
|
2023-11-23 16:08:47 +00:00
|
|
|
JTX = JavaTXcompiler-0.1-jar-with-dependencies.jar
|
|
|
|
|
2023-11-23 15:20:44 +00:00
|
|
|
SRCDIR = src/main/java
|
|
|
|
DESTDIR = out
|
|
|
|
|
|
|
|
# Use find to locate all .java files recursively
|
2023-11-23 16:08:47 +00:00
|
|
|
JAVASOURCES := $(shell find $(SRCDIR) -name '*.java')
|
|
|
|
JAVSOURCES := $(shell find $(SRCDIR) -name '*.jav')
|
2023-11-23 15:20:44 +00:00
|
|
|
|
|
|
|
# Convert .java files to .class files with the same directory structure
|
2023-11-23 16:08:47 +00:00
|
|
|
JAVACLASSES := $(patsubst $(SRCDIR)/%.java,$(DESTDIR)/%.class,$(JAVASOURCES))
|
|
|
|
JAVCLASSES := $(patsubst $(SRCDIR)/%.jav,$(DESTDIR)/%.class,$(JAVSOURCES))
|
2023-11-23 15:20:44 +00:00
|
|
|
|
|
|
|
# Create a list of directories that need to be created in the destination directory
|
2023-11-23 16:08:47 +00:00
|
|
|
DIRS := $(sort $(dir $(JAVACLASSES))) $(sort $(dir $(JAVCLASSES)))
|
2023-11-23 15:20:44 +00:00
|
|
|
|
|
|
|
all:
|
2023-11-23 16:08:47 +00:00
|
|
|
@echo "$(JAVCLASSES)"
|
2023-11-23 15:20:44 +00:00
|
|
|
|
|
|
|
default: classes
|
|
|
|
|
|
|
|
# Rule for creating directories
|
2023-12-12 16:39:04 +00:00
|
|
|
#$(DIRS):
|
|
|
|
# @mkdir -p $@
|
2023-11-23 15:20:44 +00:00
|
|
|
|
2023-11-23 16:08:47 +00:00
|
|
|
|
2023-12-12 16:39:04 +00:00
|
|
|
# Rule for compiling .jav files
|
|
|
|
$(DESTDIR)/%.class: $(SRCDIR)/%.jav #| $(DIRS)
|
|
|
|
@echo "$(dir $@)"
|
|
|
|
java -jar $(JTX) -d "$(dir $@)" -cp "src/main/java:target/dependencies/" $<
|
|
|
|
|
|
|
|
# Rule for compiling .java files
|
|
|
|
$(DESTDIR)/%.class: $(SRCDIR)/%.java #| $(DIRS)
|
|
|
|
$(JC) -nowarn -d "$(dir $@)" -cp "src/main/java:out:target/dependencies/*" $(JFLAGS) $<
|
2023-11-23 16:08:47 +00:00
|
|
|
|
2023-11-23 15:20:44 +00:00
|
|
|
|
2023-11-23 16:08:47 +00:00
|
|
|
classes: $(JAVCLASSES) $(JAVACLASSES)
|
2023-11-23 15:20:44 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
$(RM) -r $(DESTDIR)
|