blob: 9dddc88eb3e333979abb8835644c1268d93edd6e (
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
## Parameters ##################################################################
#### Where to find the model
ifndef MODEL_DIR
MODEL_DIR =
endif
#### Where to store the Instance model
ifndef MODEL_INSTANCES_DIR
MODEL_INSTANCES_DIR =
endif
#### Binaries
###### JRE binary
ifndef JAVA
JAVA = java
endif
###### JDK binary
ifndef JAVAC
JAVAC = javac
endif
## Parameters Sanity Check #####################################################
ifeq ($(strip $(MODEL_DIR)),)
$(error No MODEL_DIR defined as parameter.)
endif
ifeq ($(strip $(MODEL_INSTANCES_DIR)),)
$(error No MODEL_INSTANCES_DIR defined as parameter.)
endif
ifeq ($(strip $(JAVA)),)
$(error No Java executable defined as parameter.)
endif
ifeq ($(strip $(JAVAC)),)
$(error No Java compiler defined as parameter.)
endif
################################################################################
CLASSPATH = "./src/"
## Makefile Magic ##############################################################
SOURCES = $(wildcard src/*.java)
CLASSES = $(SOURCES:.java=.class)
MODEL_FILE = $(MODEL_DIR)/structural.mod
OUTPUT_FILE = $(MODEL_INSTANCES_DIR)/witness
## Makefile Rules ##############################################################
compile: $(CLASSES)
model: $(CLASSES) $(MODEL_INSTANCES_DIR) $(OUTPUT_FILE)
solutions:
clean:
rm -f $(CLASSES)
rm -f $(MODEL_INSTANCES_DIR)/*
clean_model:
rm -f $(MODEL_INSTANCES_DIR)/*
clean_solutions:
########
%.class: %.java
$(JAVAC) -cp $(CLASSPATH) $<
$(OUTPUT_FILE): $(MODEL_FILE) $(CLASSES)
$(JAVA) -cp $(CLASSPATH) Main $(MODEL_FILE) "inst_" $(MODEL_INSTANCES_DIR)
touch $(OUTPUT_FILE)
$(MODEL_INSTANCES_DIR):
mkdir -p $(MODEL_INSTANCES_DIR)
|