Debian Codegraph @

Makefile

raw
1 ##########################################################################
2 # This program is Copyright (C) 1986-2002 by Jonathan Payne. JOVE is #
3 # provided by Jonathan and Jovehacks without charge and without #
4 # warranty. You may copy, modify, and/or distribute JOVE, provided that #
5 # this notice is included in all the source files and documentation. #
6 ##########################################################################
7
8 # SHELL for this Makefile (csh won't work!)
9 SHELL = /bin/sh
10
11 # If the system has no cmp, not a big deal, minor optimization to prevent
12 # a few needless rebuilds
13 CMP = cmp
14
15 # JOVEHOME is the directory in which pieces of JOVE are kept. It is only used
16 # in the default definitions of JSHAREDIR, JLIBDIR, JBINDIR, and JMANDIR.
17 # JSHAREDIR is for online documentation, and the distributed standard system-wide
18 # jove.rc file with some common
19 # JLIBDIR is for the PORTSRV and RECOVER programs.
20 # JBINDIR is where to put the executables JOVE and TEACHJOVE.
21 # XEXT is the extension for executables (empty for UNIX; .exe for CYGWIN)
22 # JMANDIR is where the manual pages go for JOVE, RECOVER and TEACHJOVE.
23 # MANEXT is the extension for the man pages, e.g., jove.1 or jove.l or jove.m.
24 # Must not be "nr".
25 # JTEACHBASE is the basename of the installed teach-jove tutorial file,
26 # which will be teachjov.txt on MSFILESYSTEM (and the zip file),
27 # but teach-jove on Unix/Linux installs.
28 #
29 # If they don't exist, this makefile will try to create all *DIR directories
30 # (prefixed with $DESTDIR, as most packaging systems desire; DESTDIR must
31 # end with a slash) All others must already exist.
32 #
33 # Hack for relocatable installs: set JSHAREDIR and JLIBDIR and JBINDIR to relative
34 # paths, set JOVEHOME to an empty directory, and DESTDIR to the install
35 # destination with a trailing slash (or to just /, and copy the jove and recover
36 # binaries, and the doc subdirectory by hand)
37
38 JOVEHOME = /usr/local
39 JSHAREDIR = $(JOVEHOME)/share/jove
40 DSHAREDIR = $(DESTDIR)$(JSHAREDIR)
41 JLIBDIR = $(JOVEHOME)/lib/jove
42 DLIBDIR = $(DESTDIR)$(JLIBDIR)
43 JBINDIR = $(JOVEHOME)/bin
44 DBINDIR = $(DESTDIR)$(JBINDIR)
45 XEXT=
46 JMANDIR = $(JOVEHOME)/man/man$(MANEXT)
47 DMANDIR = $(DESTDIR)$(JMANDIR)
48 MANEXT = 1
49 JTEACHBASE = teach-jove
50 TEACHDOC = $(DSHAREDIR)/$(JTEACHBASE)
51 JDOCDIR = $(JOVEHOME)/share/doc/jove
52 DDOCDIR = $(DESTDIR)$(JDOCDIR)
53 REFDOC = $(DDOCDIR)/jove.qref
54 EGRC = $(DDOCDIR)/example.rc
55
56 # Install permission for SHAREDIR, LIBDIR, BINDIR
57 DPERM = 755
58
59 # JTMPDIR is where the tmp files get stored, usually /tmp, /var/tmp, or
60 # /usr/tmp. If you wish to be able to recover buffers after a system
61 # crash, this needs to be a directory that isn't cleaned out on reboot.
62 # You would probably want to clean out that directory periodically with
63 # /etc/cron.
64 # JRECDIR is the directory in which RECOVER looks for JOVE's tempfiles
65 # (in case the system startup salvages tempfiles by moving them,
66 # which is probably a good idea).
67
68 JETCDIR = /etc/jove
69 DETCDIR = $(DESTDIR)$(JETCDIR)
70 JTMPDIR = /var/tmp
71 JRECDIR = /var/lib/jove/preserve
72 DRECDIR = $(DESTDIR)$(JRECDIR)
73 # Install permission for DRECDIR
74 RECPERM = 1777
75
76 # place to copy source tarball for rpmbuild
77 RPMHOME = $(HOME)/rpmbuild/SOURCES
78
79 # DFLTSHELL is the default shell invoked by JOVE.
80 DFLTSHELL = /bin/sh
81
82 # The install commands of BSD and System V differ in unpleasant ways:
83 # -c: copy (BSD); -c dir: destination directory (SysV)
84 # -s: strip (BSD); -s: suppress messages (SysV)
85 # Also, the destination specification is very different.
86 # The result is that the System V install command must not be used.
87 # If you know that /bin/install is the BSD program, you can use it.
88 # "cp" will work reasonably well, but be aware that any links continue
89 # referencing the old file with new contents.
90
91 INSTALLFLAGS = # -g bin -o root
92
93 # XINSTALL to install executable files, prefer install since it is independent
94 # of user umask
95 # Linux/modern BSD/CYGWIN
96 XINSTALL=install $(INSTALLFLAGS) -m 755
97 TINSTALL=install $(INSTALLFLAGS) -m 444
98
99 # old mkdir (4BSD and older Unix) did not have -p option, so will
100 # need to set MKDIRP=mkdir and create top dirs by hand (or write a script
101 # to emulate mkdir -p; 4BSD has basename but not dirname)
102 MKDIRP=mkdir -p
103
104 # WHICH shoiuld be a command that succeeds if the argument is found in the path
105 # WHICH=which # for BSD
106 WHICH=type # for sufficiently POSIX shells, not sure if Research Unix has this
107
108 # These should all just be right if the above ones are.
109 # You will confuse JOVE if you move anything from LIBDIR or SHAREDIR.
110
111 JOVE = $(DBINDIR)/jove$(XEXT)
112 TEACHJOVE = $(DBINDIR)/teachjove
113 RECOVER = $(DLIBDIR)/recover$(XEXT)
114 PORTSRV = $(DLIBDIR)/portsrv$(XEXT)
115 JOVERC = $(DSHAREDIR)/jove.rc
116 TERMSDIR = $(DSHAREDIR)
117 CMDSDOC = $(DSHAREDIR)/cmds.txt
118 JOVEM = $(DMANDIR)/jove.$(MANEXT)
119 TEACHJOVEM = $(DMANDIR)/teachjove.$(MANEXT)
120 XJOVEM = $(DMANDIR)/xjove.$(MANEXT)
121 JOVETOOLM = $(DMANDIR)/jovetool.$(MANEXT)
122
123 # We set CFLAGS to SYSDEFS and OPTFLAGS, so we can set
124 # the definitions in SYSDEFS (needed for the local compiler
125 # of keys.c, and the target compiler for the rest, in order
126 # to make this work for cross-compilation)
127
128 # SYSDEFS: specify system characteristics to the C preprocessor using -D options
129 # The default is the system uname, which should work for many
130 # popular modern systems like Linux, *BSD, OpenIndiana.
131 # If sysdep.h does not define a block for your system, or uname produces
132 # an illegal symbol on your platform (Cygwin, GNU Hurd), use jmake
133 # or see README, sysdep.h, sysdep.txt.
134 # XXX Among modern systems, FreeBSD does not put CPPFLAGS in the default
135 # .c.o make build rules, so we put it in SYSDEFS, which we then add
136 # to CFLAGS. This means the contents of CPPFLAGS will likely
137 # appear twice in cc invocations on non-FreeBSD (i.e. OpenBSD, NetBSD, Linux)
138 # so best to avoid setting it (the default value is empty anyway)
139 SYSDEFS = -D`uname` -DJTC $(CPPFLAGS)
140
141 # OPTFLAGS: compiler flags that are passed to both the compiling & linking steps
142 # e.g. -g for debugging, -O for optimization.
143 OPTFLAGS = -O
144
145 # CFLAGS (i.e compile flags for the target compiler) are OPTFLAGS and SYSDEFS,
146 # DO NOT OVERRIDE
147 CFLAGS = $(OPTFLAGS) $(SYSDEFS)
148
149 # For making dependencies under BSD systems
150 DEPENDFLAG = -M
151 # or, using the official Sun ANSI C compiler
152 # DEPENDFLAG = -xM
153
154 # Flags for Libraries to provide termcap and pty functions.
155 # Some modern open-source systems have dropped termcap, or ship it
156 # as part of the ncurses or tinfo packages.
157 # For systems without dynamic libraries, termcap or terminfo are smaller,
158 # and preferable to the bulkier curses library.
159 # Jove comes with a simplified termcap substitute that only supports
160 # ANSI X.3/VT[1-5]xx or compatible terminal emulators like xterm, rxvt, etc,
161 # which is almost certainly all that is necessary on modern machines.
162 # To use it, define -DJTC and leave TERMCAPLIB unset
163
164 TERMCAPLIB = # for compatibility with old packagers, deprecated, use LDLIBS
165 EXTRALIBS = -lutil # for compatibility with old packagers, deprecated, use LDLIBS
166 LDLIBS = $(TERMCAPLIB) $(EXTRALIBS)
167
168 # linker flags (LDFLAGS) not needed for most systems
169 LDFLAGS =
170
171 # LDCC can be used for link-time alternatives to CC. Also useful
172 # for purify or similar link-time processing.
173 LDCC = $(CC)
174
175 # For cross compiling Jove, set CC to the cross compiler, and LOCALCC
176 # to the local C compiler. LOCALCC will be used for compiling setmaps,
177 # which is run as part of the compilation to generate the keymaps.
178 # Set LOCALCFLAGS and LOCALLDFLAGS to anything extra (other than SYSDEFS,
179 # which must be the same for local and cross, so that setmaps generates
180 # the correct key bindings), though no optimization or debug or special
181 # flags are usually needed (other than Xenix?!), since setmaps is
182 # run just once, so use whatever compiles fastest.
183
184 LOCALCC = $(CC)
185 LOCALCFLAGS = # nothing really needed for setmaps
186 LOCALLDFLAGS = $(LDFLAGS)
187 LOCALEXTRALIBS = # nothing really needed for setmaps
188 LOCALEXT = # default is a Un*x-style machine, not Windows
189
190 # Objects are grouped into overlays for the benefit of (at least) 2.xBSD.
191
192 BASESEG = commands.o keys.o argcount.o ask.o buf.o jctype.o delete.o \
193 disp.o insert.o io.o jove.o marks.o misc.o re.o \
194 screen.o termcap.o unix.o util.o vars.o list.o keymaps.o \
195 mouse.o jtc.o
196 OVLAY1 = abbrev.o rec.o para.o fmt.o
197 OVLAY2 = c.o wind.o fp.o move.o
198 OVLAY3 = extend.o macros.o
199 OVLAY4 = iproc.o reapp.o
200 OVLAY5 = proc.o scandir.o term.o case.o
201
202 OBJECTS = $(BASESEG) $(OVLAY1) $(OVLAY2) $(OVLAY3) $(OVLAY4) $(OVLAY5)
203
204 # win32.o when cross-compiling with mingw for Win32
205 EXTRAOBJS =
206 # jjove.coff for cross-compiling with mingw for Win32
207 ICON =
208 WINDRES = windres # probably needs i686-w64-mingw32- prefix or similar
209
210 ZIP=zip
211 ZIPEXT=zip
212 ZIPOPTS=-q -k # common options for both binary and code files
213 ZIPTXTOPT=-l -r # options for recursively adding code files
214 TAR=tar
215
216 # These NROFF, TROFF and TROFFPOST settings work with groff.
217 # Classic Unix and derivatives used to have ditroff, for which use:
218 # NROFF = nroff
219 # TROFF = troff
220 # TDEV = ps or TDEV = psc
221 # TROFFPOST = |/usr/lib/lp/postscript/dpost -
222 # or TROFFPOST = |psc
223 NROFF = nroff
224 TROFF = troff
225 TDEV = pdf
226 TROFFPOST = |gro$(TDEV)
227
228 # installed man pages
229 MANUALS = $(JOVEM) $(TEACHJOVEM)
230
231 C_SRC = commands.c commands.tab abbrev.c argcount.c ask.c buf.c c.c case.c jctype.c \
232 delete.c disp.c extend.c fp.c fmt.c insert.c io.c iproc.c \
233 jove.c jtc.c list.c macros.c marks.c misc.c move.c para.c \
234 proc.c re.c reapp.c rec.c scandir.c screen.c term.c termcap.c unix.c \
235 util.c vars.c vars.tab wind.c msgetch.c mac.c keymaps.c ibmpcdos.c \
236 mouse.c win32.c
237
238 SOURCES = $(C_SRC) portsrv.c recover.c setmaps.c
239
240 HEADERS = abbrev.h argcount.h ask.h buf.h c.h case.h chars.h commands.h \
241 jctype.h dataobj.h delete.h disp.h extend.h externs.h \
242 fmt.h fp.h insert.h io.h iproc.h jove.h \
243 keymaps.h list.h mac.h macros.h marks.h \
244 misc.h mouse.h move.h para.h proc.h \
245 re.h reapp.h rec.h recover.h scandir.h screen.h \
246 select.h sysdep.h temp.h term.h ttystate.h \
247 tune.h util.h vars.h version.h wind.h
248
249 DOCTERMS = doc/jove.rc.sun doc/keychart.sun \
250 doc/jove.rc.sun-cmd doc/keychart.sun-cmd \
251 doc/jove.rc.vt100 doc/keychart.vt100 \
252 doc/jove.rc.wyse doc/keychart.wyse \
253 doc/jove.rc.xterm doc/keychart.xterm \
254 doc/jove.rc.xterm-256color doc/keychart.xterm-256color \
255 doc/jove.rc.z29 doc/keychart.z29 \
256 doc/jove.rc.3022 doc/keychart.3022 \
257 doc/XTermresource
258
259 # formatted docs, we ship these in the distrib to avoid groff dependency
260 # and for non-Unix/Linux platforms. NOTE: These will be removed by clobber.
261 # Also note that jove.man.* require the ms macros
262 # (tmac.s or s.tmac) which many systems do not install with base groff.
263 # By default, generate & install doc/jove.man.$(TDEV)
264 FREFDOCS = doc/jove.man.txt doc/jove.man.$(TDEV)
265 FDOCS = doc/cmds.txt $(FREFDOCS)
266
267 # files we generate that we also ship in distrib for platforms sans sed
268 # NOTE: these will be removed by clobber.
269 GEN = doc/jove.rc doc/jove.$(MANEXT) \
270 doc/teachjove.$(MANEXT) doc/jovetool.$(MANEXT)
271
272 DOSDOCS = doc/README doc/teach-jove doc/jove.qref doc/example.rc doc/jem.txt \
273 doc/jove.txt
274
275 DOCS = doc/intro.nr doc/cmds.macros.nr doc/cmds.nr doc/contents.nr \
276 doc/jove.nr doc/teachjove.nr doc/xjove.nr doc/jovetool.nr \
277 doc/jove.rc.in $(DOSDOCS) $(DOCTERMS) $(FDOCS) $(GEN)
278
279 MISC = Makefile Makefile.msc Makefile.wat \
280 README README.dos README.win ChangeLog LICENSE \
281 sysdep.txt tune.txt style.txt jmake.sh \
282 testbuild.sh testmailer.sh
283
284 SUPPORT = recover.c setmaps.c portsrv.c keys.txt \
285 menumaps.txt mjovers.Hqx jjove.ico jjove.rc teachjove
286
287 BACKUPS = $(HEADERS) $(C_SRC) $(SUPPORT) $(MISC)
288
289 # all: default target.
290 # Builds everything that "install" needs.
291 all: jjove$(XEXT) recover$(XEXT) portsrv$(XEXT) $(FDOCS) $(GEN)
292
293 jjove$(XEXT): $(OBJECTS) $(EXTRAOBJS) $(ICON)
294 $(LDCC) $(LDFLAGS) $(CFLAGS) -o jjove$(XEXT) $(OBJECTS) $(EXTRAOBJS) $(ICON) $(LDLIBS)
295 @-size jjove$(XEXT)
296
297 # For mingw icon
298 jjove.coff: jjove.rc version.h
299 $(WINDRES) -r jjove.rc -fo jjove.coff
300
301 # For 2.xBSD: link jove as a set of overlays. Not tested recently.
302
303 ovjove: $(OBJECTS)
304 ld $(LDFLAGS) $(OPTFLAGS) -X /lib/crt0.o \
305 -Z $(OVLAY1) \
306 -Z $(OVLAY2) \
307 -Z $(OVLAY3) \
308 -Z $(OVLAY4) \
309 -Z $(OVLAY5) \
310 -Y $(BASESEG) \
311 -o jjove$(XEXT) $(EXTRALIBS) $(TERMCAPLIB) -lc
312 @-size jjove$(XEXT)
313
314 # portsrv is only needed if IPROCS are implemented using PIPEPROCS
315 # (modern systems use PTYPROCS). To install portsrv, set
316 # PORTSRVINST=1
317 PORTSRVINST=
318
319 portsrv$(XEXT): portsrv.o
320 $(LDCC) $(LDFLAGS) $(CFLAGS) -o portsrv$(XEXT) portsrv.o $(LDLIBS)
321
322 recover$(XEXT): recover.o
323 $(LDCC) $(LDFLAGS) $(CFLAGS) -o recover$(XEXT) recover.o $(LDLIBS)
324
325 # no need to optimize setmaps since it is run once during build, so faster
326 # compile is better than faster executable (also urban legend that
327 # optimization produced bad code for setmaps!)
328 setmaps$(LOCALEXT): setmaps.o
329 $(LOCALCC) $(LOCALLDFLAGS) $(LOCALCFLAGS) -o setmaps$(LOCALEXT) setmaps.o $(LOCALEXTRALIBS)
330
331 # Critical that setmaps be compiled with same SYSDEFS
332 setmaps.o: setmaps.c
333 $(LOCALCC) $(LOCALCFLAGS) $(SYSDEFS) -c setmaps.c
334
335 # create a temporary directory to hold some temporary intermediate files that the
336 # Makefile generates, as a precaution against security hole via races (mktemp would be
337 # better, but we try to keep this Makefile working on old Unix, pre-POSIX, sigh)
338 TDIR=$(JTMPDIR)/jbuild$$$$
339 TFILE=$(TDIR)/temp
340
341 keys.c: setmaps$(LOCALEXT) keys.txt Makefile .ALWAYS
342 @mkdir $(TDIR) && \
343 ./setmaps$(LOCALEXT) < keys.txt > $(TFILE) && \
344 echo 'char JoveCompiled[sizeof(JoveCompiled)] = "'$(CC) $(CFLAGS)'";' >> $(TFILE) && \
345 echo 'char JoveLinked[sizeof(JoveLinked)] = "'$(LDCC) $(LDFLAGS) $(CFLAGS) $(EXTRAOBJS) $(LDLIBS)'";' >> $(TFILE) && \
346 if $(CMP) -s $(TFILE) keys.c 2> /dev/null; then rm $(TFILE); else rm -f keys.c; mv $(TFILE) keys.c; fi; rmdir $(TDIR)
347
348 keys.o: keys.c tune.h sysdep.h jove.h keymaps.h dataobj.h commands.h
349
350 .ALWAYS:
351
352 # BSD sed cannot handle \t, and having tabs in the whitespace feels fragile.
353 .version: .ALWAYS
354 @mkdir $(TDIR) && \
355 sed -n 's/# *define *jversion *"\([0-9\\.]*\)".*/\1/p' version.h > $(TFILE); \
356 if $(CMP) -s $(TFILE) .version 2> /dev/null; then rm $(TFILE); else rm -f .version; mv $(TFILE) .version; fi; rmdir $(TDIR)
357
358 jove.spec: .version
359 @mkdir $(TDIR) && \
360 v=`sed 's/_.*//' .version`; sed "s,__VERSION__,$$v,g" pkg/rpm/jspec.in > $(TFILE); \
361 if $(CMP) -s $(TFILE) jove.spec 2> /dev/null; then rm $(TFILE); else rm -f jove.spec; mv $(TFILE) jove.spec; fi; rmdir $(TDIR)
362
363 paths.h: .ALWAYS
364 @mkdir $(TDIR) && \
365 (echo "/* Changes should be made in Makefile, not to this file! */" ; \
366 echo ""; \
367 echo \#define TMPDIR \"$(JTMPDIR)\"; \
368 echo \#define RECDIR \"$(JRECDIR)\"; \
369 echo \#define LIBDIR \"$(JLIBDIR)\"; \
370 echo \#define SHAREDIR \"$(JSHAREDIR)\"; \
371 echo \#define TEACHJOVE \"$(JTEACHBASE)\"; \
372 echo \#define DFLTSHELL \"$(DFLTSHELL)\";) > $(TFILE); \
373 if $(CMP) -s $(TFILE) paths.h 2> /dev/null; then rm $(TFILE); else rm -f paths.h; mv $(TFILE) paths.h; fi; rmdir $(TDIR)
374
375 makexjove:
376 ( cd xjove ; make CC="$(CC)" OPTFLAGS="$(OPTFLAGS)" SYSDEFS="$(SYSDEFS)" $(TOOLMAKEEXTRAS) xjove )
377
378 installxjove: $(XJOVEM)
379 ( cd xjove ; make CC="$(CC)" OPTFLAGS="$(OPTFLAGS)" SYSDEFS="$(SYSDEFS)" XINSTALL="$(XINSTALL)" BINDIR="$(DBINDIR)" INSTALLFLAGS="$(INSTALLFLAGS)" $(TOOLMAKEEXTRAS) installxjove )
380
381 makejovetool:
382 ( cd xjove ; make CC="$(CC)" OPTFLAGS="$(OPTFLAGS)" SYSDEFS="$(SYSDEFS)" DEFINES=-DSUNVIEW $(TOOLMAKEEXTRAS) jovetool )
383
384 installjovetool: $(JOVETOOLM)
385 ( cd xjove ; make CC="$(CC)" OPTFLAGS="$(OPTFLAGS)" SYSDEFS="$(SYSDEFS)" DEFINES=-DSUNVIEW XINSTALL="$(XINSTALL)" BINDIR="$(DBINDIR)" INSTALLFLAGS="$(INSTALLFLAGS)" $(TOOLMAKEEXTRAS) installjovetool )
386
387 # Note: everything needed by "install" should be built by "all".
388 # Thus, if "all" is done first, "install" can be invoked with
389 # JOVEHOME pointing at a playpen where files are to be marshalled.
390 # This property is fragile.
391 install: $(DRECDIR) $(DETCDIR) $(DDOCDIR) $(CMDSDOC) $(TEACHDOC) $(JOVERC) \
392 $(PORTSRV) $(RECOVER) $(JOVE) $(TEACHJOVE) $(REFDOC) $(MANUALS)
393 @echo See the README about changes to /etc/rc or /etc/rc.local
394 @echo so that the system recovers jove files on reboot after a crash
395
396 $(DBINDIR)::
397 if test ! -d $(DBINDIR); then $(MKDIRP) $(DBINDIR) && chmod $(DPERM) $(DBINDIR); else :; fi
398
399 $(DLIBDIR)::
400 if test ! -d $(DLIBDIR); then $(MKDIRP) $(DLIBDIR) && chmod $(DPERM) $(DLIBDIR); else :; fi
401
402 $(DSHAREDIR)::
403 if test ! -d $(DSHAREDIR); then $(MKDIRP) $(DSHAREDIR) && chmod $(DPERM) $(DSHAREDIR); else :; fi
404
405 $(DDOCDIR)::
406 if test ! -d $(DDOCDIR); then $(MKDIRP) $(DDOCDIR) && chmod $(DPERM) $(DDOCDIR); else :; fi
407
408 $(DETCDIR)::
409 -if test ! -d $(DETCDIR); then $(MKDIRP) $(DETCDIR) && chmod $(DPERM) $(DETCDIR); fi
410
411 $(DMANDIR)::
412 if test ! -d $(DMANDIR); then $(MKDIRP) $(DMANDIR) && chmod $(DPERM) $(DMANDIR); else :; fi
413
414 $(DRECDIR)::
415 -if test ! -d $(DRECDIR); then $(MKDIRP) $(DRECDIR) && chmod $(RECPERM) $(DRECDIR); fi
416
417 # first run of rpmbuild will mkdir other sibling directories in RPMHOME, but
418 # we need this before we run rpmbuild, so RPMHOME might not even exist.
419 $(RPMHOME)::
420 if test ! -d $(RPMHOME); then mkdir -p $(RPMHOME) && chmod $(DPERM) $(RPMHOME); fi
421
422 doc/cmds.txt: doc/cmds.macros.nr doc/cmds.nr
423 @mkdir $(TDIR) && \
424 LANG=C $(NROFF) doc/cmds.macros.nr doc/cmds.nr > $(TFILE); \
425 if $(CMP) -s $(TFILE) doc/cmds.txt 2> /dev/null; then rm $(TFILE); else rm -f doc/cmds.txt; mv $(TFILE) doc/cmds.txt; fi; rmdir $(TDIR)
426
427 doc/jove.man.txt: doc/intro.nr doc/cmds.nr
428 @-if $(WHICH) $(NROFF) > /dev/null; then mkdir $(TDIR) && \
429 LANG=C; export LANG; cd doc && tbl intro.nr | $(NROFF) -ms - cmds.nr > $(TFILE); \
430 if $(CMP) -s $(TFILE) jove.man.txt 2> /dev/null; then rm $(TFILE); else rm -f jove.man.txt; mv $(TFILE) jove.man.txt; fi; rmdir $(TDIR); fi
431
432 doc/jove.man.$(TDEV): doc/intro.nr doc/cmds.nr doc/contents.nr
433 @-if $(WHICH) $(TROFF) > /dev/null; then mkdir $(TDIR) && \
434 LANG=C; export LANG; cd doc && tbl intro.nr | $(TROFF) -T$(TDEV) -ms - cmds.nr contents.nr $(TROFFPOST) > $(TFILE); \
435 if $(CMP) -s $(TFILE) jove.man.$(TDEV) 2> /dev/null; then rm $(TFILE); else rm -f jove.man.$(TDEV); mv $(TFILE) jove.man.$(TDEV); fi; rmdir $(TDIR); fi
436
437 # might not have been formatted if there is no nroff or troff
438 $(CMDSDOC): $(DSHAREDIR) doc/cmds.txt doc/teach-jove
439 -$(TINSTALL) doc/cmds.txt $(CMDSDOC)
440
441 $(TEACHDOC): $(DSHAREDIR) doc/teach-jove
442 $(TINSTALL) doc/teach-jove $(TEACHDOC)
443
444 $(REFDOC): $(DDOCDIR) doc/jove.qref doc/example.rc $(FREFDOCS)
445 $(TINSTALL) README doc/jove.qref doc/example.rc $(FREFDOCS) $(DDOCDIR)
446
447 doc/jove.rc: doc/jove.rc.in
448 @mkdir $(TDIR) && \
449 sed "s,__ETCDIR__,$(JETCDIR)," doc/jove.rc.in > $(TFILE); \
450 if $(CMP) -s $(TFILE) doc/jove.rc 2> /dev/null; then rm $(TFILE); else rm -f doc/jove.rc; mv $(TFILE) doc/jove.rc; fi; rmdir $(TDIR)
451
452 $(JOVERC): $(DSHAREDIR) doc/jove.rc $(TERMSDIR) $(DOCTERMS)
453 $(TINSTALL) doc/jove.rc doc/jem* $(DOCTERMS) $(DSHAREDIR)
454
455 $(PORTSRV): $(DLIBDIR) portsrv$(XEXT)
456 case "$(PORTSRVINST)" in 1|y) $(XINSTALL) portsrv$(XEXT) $(PORTSRV);; esac
457
458 $(RECOVER): $(DLIBDIR) recover$(XEXT)
459 $(XINSTALL) recover$(XEXT) $(RECOVER)
460
461 $(JOVE): $(DBINDIR) jjove$(XEXT)
462 $(XINSTALL) jjove$(XEXT) $(JOVE)
463
464 $(TEACHJOVE): $(DBINDIR)
465 $(XINSTALL) teachjove $(TEACHJOVE)
466
467 doc/jove.$(MANEXT): doc/jove.nr
468 @mkdir $(TDIR) && \
469 sed -e 's;<TMPDIR>;$(JTMPDIR);' \
470 -e 's;<LIBDIR>;$(JLIBDIR);' \
471 -e 's;<SHAREDIR>;$(JSHAREDIR);' \
472 -e 's;<SHELL>;$(DFLTSHELL);' doc/jove.nr > $(TFILE); \
473 if $(CMP) -s $(TFILE) doc/jove.$(MANEXT) 2> /dev/null; then rm $(TFILE); else rm -f doc.jove.$(MANEXT); mv $(TFILE) doc/jove.$(MANEXT); fi; rmdir $(TDIR)
474
475 $(JOVEM): $(DMANDIR) doc/jove.$(MANEXT)
476 $(TINSTALL) doc/jove.$(MANEXT) $(JOVEM)
477
478 # doc/jove.txt is the formatted manpage (for Windows and DOS src zip)
479 # Building it should be like building $(JOVEM) except that we
480 # don't know what to substitute for <TMPDIR> etc. because they
481 # will be presumably set later by the person who downloads and
482 # installs the src zip, but we must do the formatting to prepare the zip
483 # since Windows/DOS will not have NROFF.
484
485 doc/jove.txt: doc/jove.nr
486 @mkdir $(TDIR) && \
487 LANG=C $(NROFF) -man doc/jove.nr > $(TFILE) && \
488 if $(CMP) -s $(TFILE) doc/jove.txt 2> /dev/null; then rm $(TFILE); else rm -f doc/jove.txt; mv $(TFILE) doc/jove.txt; fi; rmdir $(TDIR)
489
490 doc/teachjove.$(MANEXT): doc/teachjove.nr
491 @mkdir $(TDIR) && \
492 sed -e 's;<TMPDIR>;$(JTMPDIR);' \
493 -e 's;<LIBDIR>;$(JLIBDIR);' \
494 -e 's;<SHAREDIR>;$(JSHAREDIR);' \
495 -e 's;<SHELL>;$(DFLTSHELL);' doc/teachjove.nr > $(TFILE); \
496 if $(CMP) -s $(TFILE) doc/teachjove.$(MANTXT) 2> /dev/null; then rm $(TFILE); else rm -f doc/teachjove.$(MANEXT); mv $(TFILE) doc/teachjove.$(MANEXT); fi; rmdir $(TDIR)
497
498 $(TEACHJOVEM): $(DMANDIR) doc/teachjove.$(MANEXT)
499 $(TINSTALL) doc/teachjove.$(MANEXT) $(TEACHJOVEM)
500
501 $(XJOVEM): $(DMANDIR) doc/xjove.nr
502 $(TINSTALL) doc/xjove.nr $(XJOVEM)
503
504 doc/jovetool.$(MANEXT): doc/jovetool.nr
505 @mkdir $(TDIR) && \
506 sed -e 's;<MANDIR>;$(MANDIR);' \
507 -e 's;<MANEXT>;$(MANEXT);' doc/jovetool.nr > $(TFILE); \
508 if $(CMP) -s $(TFILE) doc/jovetool.$(MANTXT) 2> /dev/null; then rm $(TFILE); else rm -f doc/jovetool.$(MANEXT); mv $(TFILE) doc/jovetool.$(MANEXT); fi; rmdir $(TDIR)
509
510 $(JOVETOOLM): $(DMANDIR) doc/jovetool.$(MANEXT)
511 $(TINSTALL) doc/jovetool.$(MANEXT) $(JOVETOOLM)
512
513 fdocs: $(FDOCS)
514
515 echo:
516 @echo $(SOURCES) $(HEADERS)
517
518 # note: $(C_SRC) contains commands.tab and vars.tab
519 # These should not be linted, but they will probably be ignored.
520
521 lint: keys.c
522 lint $(SYSDEFS) $(C_SRC) keys.c
523 lint $(SYSDEFS) portsrv.c
524 lint $(SYSDEFS) recover.c
525 lint $(SYSDEFS) setmaps.c
526 @echo Done
527
528 # CTAGSFLAGS = -N --format=1 # fishy options required for Exuberant Ctags
529 # since this is inconvenient to specify, you can use target extags instead.
530 CTAGSFLAGS = -w
531
532 tags: $(C_SRC) $(HEADERS)
533 -rm -f tags && ctags $(CTAGSFLAGS) $(C_SRC) $(HEADERS)
534
535 extags: $(C_SRC) $(HEADERS)
536 -rm -f tags && ctags -N --format=1 $(C_SRC) $(HEADERS)
537
538
539 # .filelist is a trick to get around a make limit:
540 # the list of files is too long to fit in a command generated by make
541 # The actual contents of the file depend only on Makefile, but by
542 # adding extra dependencies, dependants of .filelist can have shorter
543 # dependency lists. Note: since we have no list of xjove files,
544 # we alway force a make of xjove/.filelist. This forces .filelist
545 # to be rebuilt every time it is needed.
546
547 .filelist: $(BACKUPS) $(DOCS) tags
548 @mkdir $(TDIR) && \
549 if test -f tags; then ls tags; fi > $(TFILE) && \
550 ls $(BACKUPS) >> $(TFILE) && \
551 ls $(DOCS) >> $(TFILE) && \
552 find pkg old -print >> $(TFILE) && \
553 (cd xjove ; make FLIST=$(TFILE).xj $(TFILE).xj) && \
554 sed -e 's=^=xjove/=' $(TFILE).xj >> $(TFILE); \
555 if $(CMP) -s $(TFILE) .filelist 2> /dev/null; then rm $(TFILE); else rm -f .filelist; mv $(TFILE) .filelist; fi; rm -f $(TFILE).xj; rmdir $(TDIR)
556
557 # Build a distribution: a gzipped tar file with a name "jove-<version>.tgz"
558 # The tar will unpack into a directory with the name jove-<version>
559 # Beware: old files with these names will be blown away.
560 tgz: .version .filelist Makefile jove.spec
561 set -u ; set -e ; \
562 BN=jove-`cat .version` ; \
563 : $${JOVETAR=$$BN.tgz} ; \
564 rm -rf $$BN $$JOVETAR ; \
565 mkdir $$BN ; \
566 $(TAR) cf - jove.spec `cat .filelist` | ( cd $$BN ; $(TAR) xf - ) ; \
567 $(TAR) czf $$JOVETAR $$BN ; \
568 rm -rf $$BN ; \
569 ls -l $$JOVETAR
570
571 distrib: tgz zip
572
573 rpm: jove.spec .version tgz $(RPMHOME)
574 # rpmbuild really wants the source tarball to have
575 # the basename of Source0 in the rpm spec, and be
576 # in the rpmbuild SOURCES directory.
577 rpmsrc=`sed -n '/Source0/s,.*/,,p' jove.spec`; \
578 BN=jove-`cat .version` ; \
579 cp $$BN.tgz $(RPMHOME)/$$rpmsrc; \
580 rpmbuild -ta $(RPMHOME)/$$rpmsrc
581
582 # uses sudo to run apt-get and dpkg
583 deb: .version
584 ./pkg/deb/testdeb.sh
585
586 # create a distribution and a separate GPG signature for it
587 signed: .version tgz
588 BN=jove-`cat .version` ; \
589 gpg -sba $$BN.tgz; \
590 chmod a+r $$BN.tgz.asc
591
592 # MSDOS isn't a full-fledged development environment.
593 # Preparing a distribution for MSDOS involves discarding some things
594 # and pre-building others. All should have \n converted to CR LF.
595 # From SUPPORT: setmaps.c, keys.txt, recover.c
596 # From MISC: all but Makefile and README.mac
597 # Preformatted documentation. [would like a joverc]
598 # tags
599
600 DOSSRC = $(HEADERS) $(C_SRC) setmaps.c recover.c keys.txt \
601 Makefile.msc Makefile.wat ChangeLog \
602 README README.dos README.win sysdep.txt tune.txt style.txt \
603 jjove.rc $(FDOCS) tags doc/jove.rc $(DOSDOCS)
604
605 zip: .version $(DOSSRC) jjove.ico Makefile
606 set -u ; set -e ; \
607 V=`sed 's/\.//g;s/^\(...\).*/\1/' .version` && \
608 BN=jove$${V}s && \
609 rm -rf $$BN && \
610 mkdir $$BN && \
611 $(TAR) cf - jjove.ico $(DOSSRC) | ( cd $$BN ; $(TAR) xf - ) && \
612 $(ZIP) $(ZIPOPTS) jovetmp$$$$.$(ZIPEXT) $$BN/jjove.ico && \
613 rm -f $$BN/jjove.ico && \
614 mv $$BN/doc/jove.man.txt $$BN/doc/joveman.txt && \
615 mv $$BN/doc/jove.man.pdf $$BN/doc/joveman.pdf && \
616 mv $$BN/doc/teach-jove $$BN/doc/teachjov.txt && \
617 mv $$BN/ChangeLog $$BN/changelg.txt && \
618 $(ZIP) $(ZIPOPTS) jovetmp$$$$.$(ZIPEXT) $(ZIPTXTOPT) $$BN/* && \
619 rm -f jove$${V}s.$(ZIPEXT) && \
620 mv jovetmp$$$$.$(ZIPEXT) jove$${V}s.$(ZIPEXT) && \
621 rm -rf $$BN ; \
622 ls -l jove$${V}s.$(ZIPEXT)
623
624 touch:
625 touch $(OBJECTS)
626
627 clean:
628 rm -f a.out core *.o keys.c jjove$(XEXT) portsrv$(XEXT) recover$(XEXT) \
629 setmaps$(XEXT) make.log *.map \#* *~ *.tmp \
630 jjove.pure_* ID *.exe jjove.coff */*.tmp \
631 .filelist xjove/.filelist .version
632 ( cd xjove ; make clean )
633
634 # NOTE: deletes distrib (tgz, zip), formatted docs
635 clobber: clean
636 rm -f paths.h jove.spec $(FDOCS) $(GEN) tags *.tgz *.$(ZIPEXT) *.orig *.rej
637
638 distclean: clobber
639
640 # This version only works under 4.3BSD
641 dependbsd:
642 @echo '"make depend" only works under 4.3BSD'
643 @-rm -f Makefile.new
644 sed -e '/^# DO NOT DELETE THIS LINE/q' Makefile >Makefile.new
645 for i in ${SOURCES} ; do \
646 $(CC) ${CFLAGS} ${DEPENDFLAG} $$i | \
647 awk ' /[/]usr[/]include/ { next } \
648 { if ($$1 != prev) \
649 { if (rec != "") print rec; rec = $$0; prev = $$1; } \
650 else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
651 else rec = rec " " $$2 } } \
652 END { print rec } ' >>Makefile.new; \
653 done
654 echo '# DEPENDENCIES MUST END AT END OF FILE' >>Makefile.new
655 echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >>Makefile.new
656 echo '# see "make depend" above' >>Makefile.new
657 @echo 'New makefile is in "Makefile.new". Move it to "Makefile".'
658
659 # This version should work with any UNIX
660 # It records all dependencies, including ones that are #ifdef'ed out.
661 # It assumes that only jove.h and tune.h include other headers
662
663 depend:
664 @sed -e '/^# DO NOT DELETE THIS LINE/q' Makefile >Makefile.new
665 for i in tune.h jove.h ${SOURCES} ; do \
666 ( ( echo "$$i:"; sed -n -e 's/^#[ ]*include[ ]*"\([^"]*\)".*/\1/p' $$i ) | \
667 sed -e 's/^jove\.h$$/$$(JOVE_H)/' -e 's/^tune\.h$$/$$(TUNE_H)/' \
668 -e 's/^jove\.h:$$/JOVE_H = jove.h/' -e 's/^tune\.h:$$/TUNE_H = tune.h/' \
669 -e 's/\.c:$$/.o:/' | \
670 tr "\012" "\040" ; echo ) | sed -e 's/ $$//' -e '/:$$/d' >>Makefile.new ; \
671 done
672 @echo '# DEPENDENCIES MUST END AT END OF FILE' >>Makefile.new
673 @echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >>Makefile.new
674 @echo '# see "make depend" above' >>Makefile.new
675 @if $(CMP) -s Makefile Makefile.new 2> /dev/null; \
676 then echo '*** Makefile is already up to date' ; rm -f Makefile.new; \
677 else echo '*** New makefile is in "Makefile.new". Move it to "Makefile".' ; \
678 fi
679
680 # DO NOT DELETE THIS LINE -- "make depend" uses it
681 TUNE_H = tune.h sysdep.h
682 JOVE_H = jove.h $(TUNE_H) buf.h io.h dataobj.h keymaps.h argcount.h util.h externs.h
683 commands.o: $(JOVE_H) jctype.h extend.h macros.h mouse.h abbrev.h c.h case.h commands.h delete.h disp.h insert.h iproc.h marks.h misc.h move.h para.h proc.h reapp.h wind.h commands.tab
684 abbrev.o: $(JOVE_H) fp.h jctype.h abbrev.h ask.h commands.h delete.h insert.h disp.h fmt.h move.h wind.h
685 argcount.o: $(JOVE_H) jctype.h
686 ask.o: $(JOVE_H) jctype.h chars.h disp.h fp.h scandir.h screen.h ask.h delete.h insert.h extend.h fmt.h marks.h move.h wind.h mac.h
687 buf.o: $(JOVE_H) jctype.h disp.h ask.h extend.h fmt.h insert.h macros.h marks.h move.h proc.h wind.h fp.h iproc.h mac.h
688 c.o: $(JOVE_H) re.h c.h jctype.h disp.h delete.h insert.h fmt.h marks.h misc.h move.h para.h
689 case.o: $(JOVE_H) disp.h case.h jctype.h marks.h move.h
690 jctype.o: $(JOVE_H) jctype.h
691 delete.o: $(JOVE_H) jctype.h disp.h delete.h insert.h marks.h move.h
692 disp.o: $(JOVE_H) jctype.h chars.h fp.h disp.h ask.h extend.h fmt.h insert.h iproc.h move.h macros.h screen.h term.h wind.h mac.h
693 extend.o: $(JOVE_H) fp.h jctype.h chars.h commands.h disp.h re.h ask.h extend.h fmt.h insert.h move.h proc.h vars.h mac.h
694 fp.o: $(JOVE_H) fp.h jctype.h disp.h fmt.h mac.h
695 fmt.o: $(JOVE_H) chars.h fp.h jctype.h disp.h extend.h fmt.h mac.h
696 insert.o: $(JOVE_H) jctype.h list.h chars.h disp.h abbrev.h ask.h c.h delete.h insert.h fmt.h macros.h marks.h misc.h move.h para.h screen.h proc.h wind.h re.h
697 io.o: $(JOVE_H) list.h fp.h jctype.h disp.h ask.h fmt.h insert.h marks.h proc.h wind.h rec.h mac.h re.h temp.h
698 iproc.o: $(JOVE_H) re.h jctype.h disp.h fp.h iproc.h ask.h extend.h fmt.h insert.h marks.h move.h proc.h wind.h ttystate.h select.h
699 jove.o: $(JOVE_H) fp.h jctype.h chars.h disp.h re.h reapp.h rec.h ask.h extend.h fmt.h macros.h marks.h mouse.h paths.h proc.h screen.h term.h version.h wind.h iproc.h select.h mac.h
700 jtc.o: $(JOVE_H) jctype.h fmt.h fp.h select.h
701 list.o: $(JOVE_H) list.h
702 macros.o: $(JOVE_H) jctype.h fp.h chars.h disp.h ask.h commands.h macros.h extend.h fmt.h
703 marks.o: $(JOVE_H) fmt.h marks.h disp.h
704 misc.o: $(JOVE_H) jctype.h disp.h ask.h c.h delete.h insert.h extend.h fmt.h marks.h misc.h move.h para.h
705 move.o: $(JOVE_H) re.h chars.h jctype.h disp.h move.h screen.h
706 para.o: $(JOVE_H) jctype.h disp.h delete.h insert.h fmt.h marks.h misc.h move.h para.h re.h
707 proc.o: $(JOVE_H) jctype.h fp.h re.h disp.h ask.h delete.h extend.h fmt.h insert.h iproc.h marks.h misc.h move.h proc.h wind.h
708 re.o: $(JOVE_H) re.h jctype.h ask.h disp.h fmt.h marks.h
709 reapp.o: $(JOVE_H) fp.h re.h jctype.h chars.h disp.h ask.h extend.h fmt.h marks.h reapp.h wind.h mac.h
710 rec.o: $(JOVE_H) fp.h rec.h fmt.h recover.h
711 scandir.o: $(JOVE_H) scandir.h
712 screen.o: $(JOVE_H) fp.h chars.h jctype.h disp.h extend.h fmt.h term.h mac.h screen.h wind.h
713 term.o: $(JOVE_H) term.h fp.h
714 termcap.o: $(JOVE_H) term.h disp.h fmt.h fp.h jctype.h screen.h
715 unix.o: $(JOVE_H) fp.h chars.h term.h ttystate.h
716 util.o: $(JOVE_H) jctype.h disp.h fp.h ask.h chars.h fmt.h insert.h macros.h marks.h move.h rec.h mac.h
717 vars.o: $(JOVE_H) extend.h vars.h abbrev.h ask.h c.h jctype.h disp.h insert.h iproc.h mac.h mouse.h para.h proc.h re.h reapp.h rec.h screen.h term.h ttystate.h wind.h vars.tab
718 wind.o: $(JOVE_H) chars.h disp.h ask.h extend.h commands.h mac.h reapp.h wind.h screen.h
719 msgetch.o: $(JOVE_H) chars.h disp.h
720 mac.o: $(TUNE_H) $(JOVE_H) mac.h ask.h chars.h disp.h extend.h fp.h commands.h fmt.h marks.h misc.h move.h screen.h scandir.h term.h vars.h version.h wind.h
721 keymaps.o: $(JOVE_H) list.h fp.h jctype.h chars.h disp.h re.h ask.h commands.h macros.h extend.h fmt.h screen.h vars.h iproc.h
722 ibmpcdos.o: $(JOVE_H) fp.h chars.h screen.h term.h
723 mouse.o: $(JOVE_H) commands.h disp.h misc.h ask.h chars.h delete.h fmt.h insert.h marks.h move.h wind.h term.h fp.h jctype.h mouse.h xjove/mousemsg.h
724 win32.o: $(JOVE_H) fp.h chars.h screen.h disp.h
725 portsrv.o: $(JOVE_H) iproc.h
726 recover.o: $(JOVE_H) rec.h paths.h recover.h scandir.c jctype.h
727 setmaps.o: $(JOVE_H) chars.h commands.h vars.h commands.tab vars.tab
728 # DEPENDENCIES MUST END AT END OF FILE
729 # IF YOU PUT STUFF HERE IT WILL GO AWAY
730 # see "make depend" above