-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjwm.Makefile
More file actions
373 lines (312 loc) · 14.2 KB
/
Copy pathjwm.Makefile
File metadata and controls
373 lines (312 loc) · 14.2 KB
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
# $Id$
#---------------------------------------------------------------------
# This is an example Makefile that you may choose to start with and
# customize to your preference. The Makefile is broken into several
# main sections:
#
# (1) System Settings: Names all the tools and system pathname needed
# by the makefile
#
# (2) Project Settings: Names all the properties and settings for this
# project.
#
# (3) General Targets: Defines targets to do all the standard stuff:
# compile the classes, generate the javadocs, create jars, etc...
#
# (4) Project-Specific Targets: Jobs that are unique to this project.
#
# You may need to adjust pathnames (or more) for your environment.
# Other tools that are non-standard to a unix environment but required
# include dircmp (included in the JWM distribution) and rsync.
#
#---------------------------------------------------------------------
#=====================================================================
# SYSTEM SETTINGS
#=====================================================================
JAVADIR = /usr/java/jdk1.3
JAVABINDIR = ${JAVADIR}/bin
CP = /bin/cp
CD = /bin/cd
MV = /bin/mv
RM = /bin/rm
MKDIR = /bin/mkdir
TAR = /bin/tar
GZIP = /bin/gzip
JAVA = ${JAVABINDIR}/java
JAVAC = ${JAVABINDIR}/javac
JAVADOC = ${JAVABINDIR}/javadoc
JAR = ${JAVABINDIR}/jar
RMIC = ${JAVABINDIR}/rmic
JIKES = /usr/bin/jikes
DIRCMP = /usr/bin/dircmp
ZIP = /usr/bin/zip
RSYNC = /usr/bin/rsync
BZIP2 = /usr/bin/bzip2
NETSCAPE = /usr/bin/netscape
FIND = /usr/bin/find
# Flags
SYS_JCFLAGS =
SYS_JIFLAGS =
SYS_JAVADOCFLAGS =
SYS_JARFLAGS =
# Java classpath
SYS_CLASSPATH = ${JAVADIR}/jre/lib/rt.jar
#=====================================================================
# PROJECT SETTINGS
#=====================================================================
#---------------------------------------------------------------------
# Basic Project Information
#---------------------------------------------------------------------
P_VENDOR = <<your organization or name here>>
P_NAME = <project name here>>
P_VERSION = 0_1_0
#---------------------------------------------------------------------
# Project Directory Structure
#---------------------------------------------------------------------
P_BINDIR = ${P_ROOTDIR}/bin
P_CLASSESDIR = ${P_ROOTDIR}/classes
P_LIBDIR = ${P_ROOTDIR}/lib
P_DOCSDIR = ${P_ROOTDIR}/docs
P_APIDIR = ${P_DOCSDIR}/api
P_SRCDIR = ${P_ROOTDIR}/src
P_TMPDIR = ${P_ROOTDIR}/tmp
P_BUILDDIR = /tmp/.build
P_DISTDIR = ${P_BUILDDIR}/${P_VENDOR}/${P_NAME}-${P_VERSION}
#---------------------------------------------------------------------
# Package List: Enter a space delimited list of package names.
#---------------------------------------------------------------------
P_PACKAGES = \
org.myorg.myproject\
org.myorg.myproject.util\
#---------------------------------------------------------------------
# Options, Flags, Misc
#---------------------------------------------------------------------
# Select a java compiler for use later in the makefile.
JC = ${JAVAC}
#JC = ${JIKES}
# Define the project classpath here. It needs to be a colon-separated
# list of directories or jar files.
P_CLASSPATH = ${P_CLASSESDIR}
# Define the options and flags for the compiler
P_JCFLAGS = \
-classpath ${SYS_CLASSPATH}:${P_CLASSPATH} \
-d ${P_CLASSESDIR}
# Define the options and flags for javadoc
P_JAVADOCFLAGS = \
-classpath ${P_CLASSPATH} \
-sourcepath ${P_SRCDIR} \
-d ${P_APIDIR} \
-public \
-use \
-link http://java.sun.com/products/jdk/1.3/docs/api \
-overview ${P_SRCDIR}/overview.html \
-windowtitle "API Documentation for ${P_VENDOR}:${P_NAME} version ${P_VERSION}" \
# Define the options and flags for jar, if necessary
P_JARFLAGS =
#=====================================================================
# MISC TARGETS
#=====================================================================
#---------------------------------------------------------------------
# default -- Alias for compile
#---------------------------------------------------------------------
default: check classes
#---------------------------------------------------------------------
# usage -- Print a list of standard targets
#---------------------------------------------------------------------
usage:
echo "> Standard Targets"
echo "> (default) - Make classes"
echo "> classes - Generate (compile) classfiles from source"
echo "> clean - Remove generated classfiles"
echo "> api - Generate the API Javadocs"
echo "> libjar - Archive the contents of the classes dir"
echo "> srcjar - Archive the contents of the src dir"
echo "> srcjar - Archive the contents of the src dir"
echo "> zipdist - Create a zip distribution archive"
echo "> gzipdist - Create a gzip distribution archive"
echo "> bzip2dist - Create a bzip2 distribution archive"
echo "> Please read the Makefile itself for more information"
#---------------------------------------------------------------------
# check -- Make sure the rootdir environment variable is set.
#---------------------------------------------------------------------
check:
if [ "$$P_ROOTDIR" = "" ]; \
then echo 'P_ROOTDIR is not set! (try "export P_ROOTDIR=`pwd`")'; \
exit 1; fi
#---------------------------------------------------------------------
# clean -- Alias for classesclean
#---------------------------------------------------------------------
clean: check classesclean
#---------------------------------------------------------------------
# realclean -- Removes all generateables
#---------------------------------------------------------------------
realclean: check apiclean classesclean tmpclean libjarclean srcjarclean buildclean usermanclean docsclean
#---------------------------------------------------------------------
# backupclean -- Removes all backup files
#---------------------------------------------------------------------
backupclean: check
${FIND} ${P_ROOTDIR} -name '*~' -exec ${RM} {} \;
#---------------------------------------------------------------------
# tmpdir -- Creates the temporary directory if necessary.
#---------------------------------------------------------------------
tmpdir: check
${MKDIR} -p ${P_TMPDIR}
#---------------------------------------------------------------------
# tmpclean -- Removes the temporary directory
#---------------------------------------------------------------------
tmpclean: check
${RM} -rf ${P_TMPDIR}
#---------------------------------------------------------------------
# libdir -- Creates the library directory if necessary.
#---------------------------------------------------------------------
libdir: check
${MKDIR} -p ${P_LIBDIR}
#=====================================================================
# DOCUMENTATION TARGETS
#=====================================================================
#---------------------------------------------------------------------
# apidir -- Creates the api directory if necessary
#---------------------------------------------------------------------
apidir: check
${MKDIR} -p ${P_APIDIR}
#---------------------------------------------------------------------
# api -- Generates the API Javadocs from source
#---------------------------------------------------------------------
api: check apidir
${JAVADOC} ${SYS_JAVADOCFLAGS} ${P_JAVADOCFLAGS} ${P_PACKAGES}
#---------------------------------------------------------------------
# apiclean -- Removes the API Javadocs
#---------------------------------------------------------------------
apiclean: check
${RM} -rf ${P_APIDIR}
#---------------------------------------------------------------------
# apibrowse -- Opens the overview-summary in a pre-existing netscape
# window.
#---------------------------------------------------------------------
apibrowse: check
${NETSCAPE} -remote "openURL(file:`cd ${P_APIDIR}; pwd`/overview-summary.html)"
#=====================================================================
# COMPILATION TARGETS
#=====================================================================
#---------------------------------------------------------------------
# classesdir -- Creates the classes directory if necessary
#---------------------------------------------------------------------
classesdir: check
${MKDIR} -p ${P_CLASSESDIR}
#---------------------------------------------------------------------
# classes -- Compiles the sourcecode using a java compiler. This
# target uses "dircmp", a utility that checks all the package
# directories and emits a list of sourcecode filenames that are newer
# than the corresponsing classfile.
#---------------------------------------------------------------------
classes: check classesdir
P_FILES=`echo ${P_PACKAGES}| tr '.' '/'`; \
P_FILES=`${DIRCMP} -s ${P_SRCDIR} -d ${P_CLASSESDIR} -p .java -q .class $$P_FILES`; \
if [ "$$P_FILES" = "" ]; then echo "Project is up to date"; \
else ${JC} ${SYS_JCFLAGS} ${P_JCFLAGS} $$P_FILES; fi
#---------------------------------------------------------------------
# classesclean -- Removes the generated classes
#---------------------------------------------------------------------
classesclean: check
${RM} -rf ${P_CLASSESDIR}
#=====================================================================
# JAR TARGETS
#=====================================================================
#---------------------------------------------------------------------
# libjar -- Packages everything in the classes directory into a jar
# and places it into the lib directory.
#---------------------------------------------------------------------
libjar: check libdir
cd ${P_CLASSESDIR} \
&& ${JAR} cfm ${P_NAME}.jar \
${P_SRCDIR}/MANIFEST.MF ${SYS_JARFLAGS} ${P_JARFLAGS} .
${MV} ${P_CLASSESDIR}/${P_NAME}.jar ${P_LIBDIR}
#---------------------------------------------------------------------
# libjarclean -- Removes the package jar.
#---------------------------------------------------------------------
libjarclean: check
${RM} -f ${P_LIBDIR}/${P_NAME}.jar
#---------------------------------------------------------------------
# srcjar -- Packages everything in the src directory into a jar and
# places it into the root directory.
#---------------------------------------------------------------------
srcjar: check
cd ${P_ROOTDIR} && ${JAR} cfm src.jar ${P_SRCDIR}/MANIFEST.MF src
#---------------------------------------------------------------------
# srcjarclean -- Removes the source jar.
#---------------------------------------------------------------------
srcjarclean: check
${RM} -f src.jar
#=====================================================================
# DISTRIBUTION TARGETS
#=====================================================================
#---------------------------------------------------------------------
# distdir -- Creates the dist build dir if necessary
#---------------------------------------------------------------------
distdir: check
${MKDIR} -p ${P_DISTDIR}
#---------------------------------------------------------------------
# distclean -- Removes the dist build directory
#---------------------------------------------------------------------
distclean: check
${RM} -rf ${P_DISTDIR}
#---------------------------------------------------------------------
# distclean -- Removes the entire build directory
#---------------------------------------------------------------------
buildclean: check
${RM} -rf ${P_BUILDDIR}
#---------------------------------------------------------------------
# dist -- Generates all the classes, api, jars, and copies it all to
# another directory using rsync.
#---------------------------------------------------------------------
dist: check classes libjar srcjar api distdir distsync
#---------------------------------------------------------------------
# distsync -- Synchronize the dist build directory with this one sans
# files we dont care to include in the final distribution.
#---------------------------------------------------------------------
distsync: check distdir
${RSYNC} -azu --delete \
--exclude '*CVS' \
--exclude '*~' \
--exclude 'classes' \
--exclude 'src' \
--exclude 'tmp' \
${P_ROOTDIR}/* ${P_DISTDIR}
#---------------------------------------------------------------------
# zipdist -- Construct a project zip distribution archive.
#---------------------------------------------------------------------
zipdist: check tmpdir dist mkzip
#---------------------------------------------------------------------
# mkzip -- Create the zip archive from the dist build dir
#---------------------------------------------------------------------
mkzip: check
cd ${P_BUILDDIR} && ${ZIP} -r ${P_NAME}-${P_VERSION}.zip .
${MV} ${P_BUILDDIR}/${P_NAME}-${P_VERSION}.zip ${P_TMPDIR}
#---------------------------------------------------------------------
# tardist -- Create a project tar distribution archive.
#---------------------------------------------------------------------
tardist: check tmpdir dist mktar
mktar: check
${TAR} cf ${P_TMPDIR}/${P_NAME}-${P_VERSION}.tar -C ${P_BUILDDIR} ${P_VENDOR}
#---------------------------------------------------------------------
# gzipdist -- Create a project gzip distribution archive.
#---------------------------------------------------------------------
gzipdist: check tardist mkgzip
#---------------------------------------------------------------------
# mkgzip -- Create the gzip archive from the tar archive
#---------------------------------------------------------------------
mkgzip: check
${GZIP} -f ${P_TMPDIR}/${P_NAME}-${P_VERSION}.tar
#---------------------------------------------------------------------
# bzip2dist -- Create a project bzip2 distribution archive.
#---------------------------------------------------------------------
bzip2dist: check tardist mkbzip2
#---------------------------------------------------------------------
# mkbzip2 -- Create the bzip2 archive from the tar archive
#---------------------------------------------------------------------
mkbzip2: check
${BZIP2} -f ${P_TMPDIR}/${P_NAME}-${P_VERSION}.tar
#=====================================================================
# PROJECT-SPECIFIC TARGETS
#=====================================================================
# Add more non-general targets here.