-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (40 loc) · 1.1 KB
/
Makefile
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
SOURCE_DIR := src/
OUTPUT_DIR := bin/
FIND := find
MKDIR := mkdir -p
RM := rm -rd
JAVAC := javac
JFLAGS := -sourcepath $(SOURCE_DIR) -d $(OUTPUT_DIR)
JGRAPHT_JAR := lib/jgrapht-jdk1.6.jar
JUNIT_JAR := lib/junit-4.10.jar
CLASSPATH := ./:$(JGRAPHT_JAR):./$(JUNIT_JAR):$(OUTPUT_DIR)
SIM_CONFIG := default.cfg
# all_javas - Temp file for holding source file list
all_javas := $(OUTPUT_DIR)/all.javas
# make-directories - Ensure output directory exists.
make-directories := $(shell $(MKDIR) $(OUTPUT_DIR))
# add stuff to the classpath
export CLASSPATH := $(CLASSPATH)
# all - Perform all tasks for a complete build
.PHONY: all
all: compile
.PHONY: count
count:
wc -l `find . -name *.java`
# all_javas - Gather source file list
.INTERMEDIATE: $(all_javas)
$(all_javas):
$(FIND) $(SOURCE_DIR) -name '*.java' > $@
# compile - Compile the source
.PHONY: compile
compile: $(all_javas)
$(JAVAC) $(JFLAGS) @$<
.PHONY: clean
clean:
$(RM) $(OUTPUT_DIR)
.PHONY: classpath
classpath:
export CLASSPATH='$(CLASSPATH)'
.PHONY: run
run: classpath
java sim.Main $(SIM_CONFIG)