blob: bb502195c176ce9b16010c9ab094af33b1614e10 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
## 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
###### JDK binary
ifndef JAVAC
JAVAC = javac
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/"
## Makefile Magic ##############################################################
SOURCES = $(wildcard src/*.java)
CLASSES = $(SOURCES:.java=.class)
## Makefile Rules ##############################################################
$(MODEL_DIR)/structural.mod: $(CLASSES) $(AST_FILE)
$(JAVA) -cp $(CLASSPATH) Main $(AST_FILE) $(MODEL_DIR)
clean:
rm -f $(CLASSES)
rm -f $(MODEL_DIR)/*.mod
rm -f $(MODEL_DIR)/*.map
%.class: %.java
$(JAVAC) -cp $(CLASSPATH) $<
$(MODEL_DIR):
mkdir -p $@
|