trying to also compile .jav files, not running yet

This commit is contained in:
julian 2023-11-23 17:08:47 +01:00
parent 8ea459fcd7
commit f093edb74f
3 changed files with 17 additions and 9 deletions

Binary file not shown.

View File

@ -1,21 +1,24 @@
JFLAGS = -g
JC = javac
JTX = JavaTXcompiler-0.1-jar-with-dependencies.jar
SRCDIR = src/main/java
DESTDIR = out
# Use find to locate all .java files recursively
SOURCES := $(shell find $(SRCDIR) -name '*.java')
RELATIVE_SOURCES := $(patsubst $(SRCDIR)/%,%,$(SOURCES))
JAVASOURCES := $(shell find $(SRCDIR) -name '*.java')
JAVSOURCES := $(shell find $(SRCDIR) -name '*.jav')
# Convert .java files to .class files with the same directory structure
CLASSES := $(patsubst $(SRCDIR)/%.java,$(DESTDIR)/%.class,$(SOURCES))
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 $(CLASSES)))
DIRS := $(sort $(dir $(JAVACLASSES))) $(sort $(dir $(JAVCLASSES)))
all:
@echo "$(RELATIVE_SOURCES)"
@echo "$(JAVCLASSES)"
default: classes
@ -23,11 +26,16 @@ default: classes
$(DIRS):
@mkdir -p $@
# Rule for compiling Java files
$(DESTDIR)/%.class: $(SRCDIR)/%.java | $(DIRS)
$(JC) -nowarn -d $(DESTDIR) -cp "src/main/java:target/dependencies/*" $(JFLAGS) $<
classes: $(CLASSES)
# Rule for compiling jav files
$(DESTDIR)/%.class: $(SRCDIR)/%.jav | $(DIRS)
java -jar $(JTX) -d $(DESTDIR) -cp "src/main/java:target/dependencies/" $<
#rule for compiling java files
$(DESTDIR)/%.class: $(SRCDIR)/%.java | $(DIRS)
$(JC) -nowarn -d $(DESTDIR) -cp "src/main/java:out:target/dependencies/*" $(JFLAGS) $<
classes: $(JAVCLASSES) $(JAVACLASSES)
clean:
$(RM) -r $(DESTDIR)