-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
90 lines (74 loc) · 3.3 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Major Makefile variables.
# - DFSPACKAGES lists the names of the principal distributed filesystem
# packages. These are the packages that would be distributed to users. Test
# cases and build tools are not included.
# - JARFILE is the name of the monolithic jar file capable of running both
# storage and naming servers, and several client applications. A monolithic
# jar file is not the only way to distribute components of the filesystem, but
# it is used here for convenience.
# - ARCHIVE is the name of the zip archive created by the archive target for
# source code submission and distribution.
# - JAVAFILES is all of the Java files in the project, including test cases and
# build tools.
DFSPACKAGES = common rmi storage naming client apps
JARFILE = dfs.jar
ARCHIVE = project2.zip
JAVAFILES = */*.java */*/*.java
# Javadoc-related variables.
# - DOCDIR gives the relative path to the directory into which the documentation
# generated by the docs target will be placed.
# - ALLDOCDIR is the same for the docs-all target.
# - DOCLINK is the URL to Javadoc for the standard Java class library.
DOCDIR = javadoc
ALLDOCDIR = javadoc-all
DOCLINK = http://download.oracle.com/javase/6/docs/api
# Define the variable CPSEPARATOR, the classpath separator character. This is
# : on Unix-like systems and ; on Windows. The separator is returned by a
# Java program implemented in build/PathSeparator.java. The Makefile fragment
# included here is made to depend on build/PathSeparator.class to ensure that
# the program is compiled before make procedes past this line.
include build/Makefile.separator
# Source and class directory tree bases. These are given as the classpath
# argument when running unit test and as the sourcepath argument when generating
# Javadoc for all files (including unit tests). The value is quoted for Cygwin:
# the Windows Java implementation requires the path separator to be ; but
# Cygwin's bash interprets this as a separator between commands.
UNITCLASSPATH = ".$(CPSEPARATOR)unit"
# Create the single monolithic jar file.
.PHONY : jar
jar : all-classes
jar cfe $(JARFILE) apps.Launcher \
$(foreach package,$(DFSPACKAGES),$(package)/*.class)
# Compile all Java files.
.PHONY : all-classes
all-classes :
javac $(JAVAFILES)
# Run unit and conformance tests.
.PHONY : test
test : all-classes
java -cp $(UNITCLASSPATH) unit.UnitTests
@echo
java conformance.ConformanceTests
# Delete all intermediate and final output and leave only the source.
.PHONY : clean
clean :
rm -rf $(JAVAFILES:.java=.class) $(ARCHIVE) $(JARFILE) $(DOCDIR) \
$(ALLDOCDIR)
# Generate documentation for the public interfaces of the principal packages.
.PHONY : docs
docs :
javadoc -link $(DOCLINK) -d $(DOCDIR) $(DFSPACKAGES)
# Generate documentation for all classes and all members in all packages.
.PHONY : docs-all
docs-all :
javadoc -link $(DOCLINK) -private -sourcepath $(UNITCLASSPATH) \
-d $(ALLDOCDIR) $(DFSPACKAGES) test conformance conformance.rmi \
conformance.common conformance.storage conformance.naming unit build
# Create a source code archive.
.PHONY : archive
archive : clean
zip -9r $(ARCHIVE) *
# Dependencies for the Makefile fragment reporting the classpath separator.
build/Makefile.separator : build/PathSeparator.class
build/PathSeparator.class : build/PathSeparator.java
javac build/PathSeparator.java