-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
56 lines (42 loc) · 1.27 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
EXT = java
JCC = javac
JCFLAGS = -Werror -deprecation
JDOC = javadoc
JDOCFLAGS = -author -quiet
MAIN = Main
JAR = distri.jar
SRCDIR = src
CLSDIR = cls
DOCDIR = doc
JARDIR = jar
SRC = $(wildcard $(SRCDIR)/*.$(EXT))
CLASSES = $(SRC:$(SRCDIR)/%.$(EXT)=$(CLSDIR)/%.class)
CLSNODIR = $(CLASSES:$(CLSDIR)/%=%)
default: $(CLASSES)
jar: $(JAR)
all: $(JAR) doc
.PHONY: doc clean mrproper
help:
@ echo 'Makefile for IPRO project `distri`'
@ echo ''
@ echo 'Usage :'
@ echo 'make Build .class files'
@ echo 'make jar Build .jar file'
@ echo 'make doc Build documentation'
@ echo 'make all Build .class and .jar files, and documentation'
@ echo 'make clean Remove .class files'
@ echo 'make mrproper Remove all build directories'
$(JAR): $(CLASSES)
@ [ -d $(JARDIR) ] || mkdir $(JARDIR)
@ jar cfe $(JARDIR)/$@ $(MAIN) -C $(CLSDIR) .
@ [ -h $@ ] || ln -s $(JARDIR)/$@ $@
$(CLSDIR)/%.class: $(SRC)
@ [ -d $(CLSDIR) ] || mkdir $(CLSDIR)
@ $(JCC) $(JCFLAGS) -d $(CLSDIR) $(SRC)
doc:
@ [ -d $(DOCDIR) ] || mkdir $(DOCDIR)
@ $(JDOC) $(JDOCFLAGS) -d $(DOCDIR) $(SRC)
clean:
@ rm -f $(CLSDIR)/*.class
mrproper: clean
@ rm -rf $(JAR) $(CLSDIR) $(DOCDIR) $(JARDIR)