-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·170 lines (136 loc) · 5.18 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Cheat sheet:
# ( http://www.rgagnon.com/javadetails/java-0544.html seems to be wrong...
# but I think that's maybe because they don't bump the class version number
# if the format is compatible.
# java version -> class version
# 1.2.2 -> 45.3 (web page says 46)
# 1.3.1_20 -> 45.3 (web page says 47)
# 1.6.0_17 -> ? (web page says 50)
# 1.7.0_21 -> 51.0
# Uncomment one of the following pairs.
#JAVAROOT=/usr/java/jdk1.5.0
#JAVAC=${JAVAROOT}/bin/javac
#JAVAROOT=/usr/java/j2sdk1.4.2
#JAVAC=${JAVAROOT}/bin/javac
#JAVAROOT=/usr/java/j2sdk1.4.2
#JAVAC=jikes +P -source 1.4 -classpath ${JAVAROOT}/jre/lib/rt.jar
# ARGH, doesn't work any more, conflicts with -classpath now used in individual rule
#JAVAROOT=/opt/blackdown-jdk-1.4.2.03
#JAVAC=${JAVAROOT}/bin/javac
# doesn't work for this project--- JFrame.EXIT_ON_CLOSE not defined
#JAVAC=javac1.2
#JAVAROOT=c:/jdk1.2.2
#JAVAC=javac1.3
#JAVAROOT=c:/jdk1.3.1_20
#JAVAC=javac1.6
#JAVAROOT="c:/Program Files (x86)/Java/jdk1.6.0_17"
# Have to use this one, if using javafx on windows
#JAVAC=javac1.7
#JAVAROOT="c:/Program Files/Java/jdk1.7.0_21"
# Currently works on ubuntu, after: apt install openjdk-8-jdk openjfx
JAVAC=javac -source 1.7 -target 1.7
#JAVAC=javac -source 1.8 -target 1.8
#JAVAC=javac -source 1.9 -target 1.9
#JAVAC=javac -source 1.10 -target 1.10
#JAVAC=javac -source 11 -target 11
#JAVAC=javac
JAVAROOT="/usr"
ifeq ($(wildcard /usr/lib/jvm/java-8-openjdk-amd64/lib/javafx-mx.jar),)
# javafx isn't installed
CPPFLAGS+=-DUSE_JAVAFX=0
else
# javafx is installed
CPPFLAGS+=-DUSE_JAVAFX=1
endif
# On linux and cygwin, use uname -o; on darwin, use uname
uname := $(shell uname -o > /dev/null 2>&1 && uname -o || uname)
#dummy := $(warning uname = $(uname))
ifeq ($(uname),Cygwin)
# on cygwin, apparently it's this
CLASSPATHSEP = ;
else
# on linux and darwin, it's this
# (some javas on linux allow both, but not all)
CLASSPATHSEP = :
endif
JARFILE = SpiralApplet.jar
CLASSES = \
MyGraphics.class \
MyGraphics3D.class \
TimingGraph.class \
Rational.class \
SpiralApplet.class \
${NULL}
HTMLFILES = \
FIGURES.html \
README.html \
${NULL}
JSFILES = \
initFigureInteraction.js \
myPreprocessingConfig.js \
vertexColoredPath.js \
ZeroClipboard.js \
ZeroClipboard.min.js \
${NULL}
SWFFILES = \
ZeroClipboard.swf \
${NULL}
JAR_DEPENDS_ON = ${CLASSES} macros.h Makefile javacpp javarenumber RUNME README.md ${HTMLFILES} ${JSFILES} ${SWFFILES}
JAR_CONTAINS = *.class *.prejava macros.h Makefile javacpp javarenumber RUNME README.md ${HTMLFILES} ${JSFILES} ${SWFFILES}
# If we want to be able to run it as java -jar SpiralApplet.jar (without additional classpath), then need to do this:
JAR_CONTAINS += com
.PHONY: all default jar
default: Makefile ${JAR_DEPENDS_ON}
jar: ${JARFILE}
all: jar
${JARFILE}: Makefile META-INF/MANIFEST.MF ${JAR_DEPENDS_ON}
# XXX argh, doesn't remove the jar file even if fails because missing something? wtf? so add explicit removal
${JAVAROOT}/bin/jar -cfm ${JARFILE} META-INF/MANIFEST.MF ${JAR_CONTAINS} || (rm ${JARFILE}; false)
CPPFLAGS += -Wall -Werror
# The following seems to work but clutters up output and may be less portable
#CPPFLAGS += -pedantic -std=c99
# The following is too strict for me (requires #'s to be non-indented)
#CPPFLAGS += -Wtraditional
.SUFFIXES: .prejava .java .class
.prejava.class:
./javacpp ${CPPFLAGS} ${JAVAC} -deprecation -classpath ".$(CLASSPATHSEP)$(JAVAROOT)/jre/lib/jfxrt.jar$(CLASSPATHSEP)./donhatchsw.jar" $*.prejava
ifneq ($(uname),Cygwin)
./javarenumber -v 0 $*.class
# too slow... only do this in the production version
# on second thought, try it, for now...
# on third hand, it bombs with Couldn't open GraphicsAntiAliasingSetter$*.class because that one has no subclasses... argh.
#@./javarenumber -v -1 $*'$$'*.class
endif
# Separate renumber target since renumbering all the subclass files
# on every recompile is slow :-(. Usually I run "make renumber"
# after an exception, and then run the program again so I will get
# a stack trace with line numbers from the .prejava files instead of
# the .java files.
${JARFILE}.is_renumbered: $(JAR_DEPENDS_ON)
./javarenumber -v -1 *.class
${JAVAROOT}/bin/jar -cfm $(JARFILE).is_renumbered META-INF/MANIFEST.MF ${JAR_CONTAINS}
touch $@
.PHONY: renumber
renumber: $(JARFILE).is_renumbered
MyGraphics.class: macros.h Makefile donhatchsw.jar
MyGraphics3D.class: macros.h Makefile donhatchsw.jar
TimingGraph.class: macros.h Makefile
Rational.class: macros.h Makefile
SpiralApplet.class: macros.h Makefile donhatchsw.jar
SENDFILES = index.php $(JARFILE)
.PHONY: send
send: renumber
sh -c "scp $(SENDFILES) [email protected]:public_html/SpiralApplet/."
.PHONY: clean
clean:
rm -f core ${JARFILE} *.class *.java.lines *.java
# can use this when bisection debugging-- careful though, it clobbers SpiralApplet.prejava
.PHONY: GOOD BAD
GOOD:;
cp SpiralApplet.prejava.good SpiralApplet.prejava
touch SpiralApplet.prejava
make
BAD:;
cp SpiralApplet.prejava.bad SpiralApplet.prejava
touch SpiralApplet.prejava
make