summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'ast-to-instr/Makefile')
-rw-r--r--ast-to-instr/Makefile59
1 files changed, 42 insertions, 17 deletions
diff --git a/ast-to-instr/Makefile b/ast-to-instr/Makefile
index 4a19d4f..86a6d88 100644
--- a/ast-to-instr/Makefile
+++ b/ast-to-instr/Makefile
@@ -1,35 +1,60 @@
-INPUT_FILE = ../data/ast/best_chronometer_ever.xml
+## Parameters ##################################################################
+#### GHDL's xml AST output.
+ifndef AST_FILE
+AST_FILE =
+endif
+
+#### Where to output the models.
+ifndef MODEL_DIR
+MODEL_DIR =
+endif
+
+#### Binaries
+###### JRE binary
+ifndef JAVA
+JAVA = java
+endif
-## Executables #################################################################
+###### JDK binary
+ifndef JAVAC
JAVAC = javac
-JAVA = java
-DOWNLOADER = wget
+endif
+
+## Parameters Sanity Check #####################################################
+ifeq ($(strip $(AST_FILE)),)
+$(error No AST_FILE defined as parameter.)
+endif
+
+ifeq ($(strip $(MODEL_DIR)),)
+$(error No output directory defined for the models.)
+endif
+
+ifeq ($(strip $(JAVA)),)
+$(error No Java executable defined as parameter.)
+endif
+
+ifeq ($(strip $(JAVAC)),)
+$(error No Java compiler defined as parameter.)
+endif
## Java Config #################################################################
CLASSPATH = "./src/"
-## Dependencies ################################################################
-JAR_SOURCE = https://noot-noot.org/onera_2017/jar/
-REQUIRED_JARS =
-
## Makefile Magic ##############################################################
SOURCES = $(wildcard src/*.java)
CLASSES = $(SOURCES:.java=.class)
## Makefile Rules ##############################################################
-all: structural.mod
+$(MODEL_DIR)/structural.mod: $(CLASSES) $(AST_FILE)
+ $(JAVA) -cp $(CLASSPATH) Main $(AST_FILE) $(MODEL_DIR)
clean:
rm -f $(CLASSES)
- rm -f *.mod
-
-structural.mod: $(CLASSES) $(REQUIRED_JARS) $(INPUT_FILE)
- $(JAVA) -cp $(CLASSPATH) Main $(INPUT_FILE)
+ rm -f $(MODEL_DIR)/*.mod
-%.class: %.java $(REQUIRED_JARS)
+%.class: %.java
$(JAVAC) -cp $(CLASSPATH) $<
-%.jar:
- echo "Attempting to download missing jar '$@'"
- $(DOWNLOADER) "$(JAR_SOURCE)/$@"
+$(MODEL_DIR):
+ mkdir -p $@