-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
64 lines (46 loc) · 1.89 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
52
53
54
55
56
57
58
59
60
61
62
63
# Time-stamp: <08 Sep 2008 at 11:32:17 by charpov on copland.cs.unh.edu>
# if PACKAGE = guess:
# 'make guess' compiles the package
# 'make html' generates the documentation
# 'make guess.jar' produces a jar file with bytecode only
# 'make guess-full.jar' produces a jar file that includes sources and doc
PACKAGES = maze
MAIN_PACKAGE = maze
RESOURCE =
CLASSPATH = .
JAVAC = javac -Xlint
SOURCE = $(foreach PACKAGE,$(PACKAGES),$(filter-out $(PACKAGE)/package-info.java,$(wildcard $(PACKAGE)/*.java)))
BYTECODE = $(patsubst %.java,%.class,$(SOURCE))
JVMARGS = -ea
CLASSPATH_TEST = ${CLASSPATH}:test:junit4.jar:charpov.jar
TEST_SOURCE = $(wildcard test/*.java)
TEST_BYTECODE = $(patsubst %.java,%.class,$(TEST_SOURCE))
TEST_CLASSES = $(patsubst test/%.java,%,$(TEST_SOURCE))
TEST_JVMARGS = $(JVMARGS)
all: $(MAIN_PACKAGE).jar $(MAIN_PACKAGE)-full.jar
$(MAIN_PACKAGE): $(BYTECODE)
test/%.class: test/%.java
$(JAVAC) -cp '${CLASSPATH_TEST}' $<
%.class: %.java
$(JAVAC) $<
html/index.html: $(SOURCE) $(foreach PACKAGE,$(PACKAGES),$(PACKAGE)/package-info.java)
test -d html/ || mkdir html
javadoc -private -d html $(subst /,.,$(PACKAGES))
$(MAIN_PACKAGE).jar: $(BYTECODE) manifest
jar cmf manifest $(MAIN_PACKAGE).jar\
$(foreach PACKAGE,$(PACKAGES),$(PACKAGE)/*.class) $(RESOURCE)
$(MAIN_PACKAGE)-full.jar: $(BYTECODE) manifest html/index.html
jar cmf manifest $(MAIN_PACKAGE)-full.jar\
$(foreach PACKAGE,$(PACKAGES),$(PACKAGE)/*.class)\
$(foreach PACKAGE,$(PACKAGES),$(PACKAGE)/*.java)\
html $(RESOURCE)
html: html/index.html
test: $(PACKAGES) $(TEST_BYTECODE) test/outErr
java $(JVMARGS) -cp '$(CLASSPATH_TEST)' org.junit.runner.JUnitCore $(TEST_CLASSES)
test/outErr: test/outErr.o
test/outErr.o: test/outErr.c
clean:
/bin/rm -rf $(foreach PACKAGE,$(PACKAGES),$(PACKAGE)/*.class) test/*.class html
distclean: clean
/bin/rm -f $(MAIN_PACKAGE).jar $(MAIN_PACKAGE)-full.jar
.PHONY : clean distclean test