4.3BSD/usr/contrib/jove/Ovmakefile

#########################################################################
# This program is copyright (C) 1985, 1986 by Jonathan Payne.  It is    #
# provided to you without charge for use only on a licensed Unix        #
# system.  You may copy JOVE provided that this notice is included with #
# the copy.  You may not sell copies of this program or versions        #
# modified for use on microcomputer systems, unless the copies are      #
# included with a Unix system distribution and the source is provided.  #
#########################################################################

# Figure out the directories for things.  TMPDIR is where the tmp files get
# stored, usually /tmp or /tmp/jove.  RECDIR is where the tmp files should be
# moved when the system comes back up (and a call to recover -syscrash should
# be put in /etc/rc before /tmp is cleared).  If your system does not remove
# subdirectories of /tmp on reboot (lots do remove them these days) then it
# makes sense to make RECDIR and TMPDIR both be /tmp/jove.  That way you
# don't need the call to jove_recover in /etc/rc.  LIBDIR is for online
# documentation, the PORTSRV process, JOVE_RECOVER, and the system-wide
# .joverc file.  BINDIR is where to put the executables JOVE, JOVE_RECOVER
# and TEACHJOVE.  MANDIR is where the manual pages go for JOVE, JOVE_RECOVER
# and TEACHJOVE.  MANEXT is the extension for the man pages, e.g., jove.1 or
# jove.l or jove.m.

DESTDIR =
TMPDIR = /tmp/jove
RECDIR = /tmp/jove
LIBDIR = /usr/lib/jove
BINDIR = /bin
MANDIR = /usr/man/man1
MANEXT = 1
SHELL = /bin/csh

# These should all just be right if the above ones are.
JOVE = $(DESTDIR)$(BINDIR)/jove
RECOVER = $(DESTDIR)$(BINDIR)/recover
TEACHJOVE = $(DESTDIR)$(BINDIR)/teachjove
JOVERC = $(DESTDIR)$(LIBDIR)/.joverc
CMDS.DOC = $(DESTDIR)$(LIBDIR)/cmds.doc
TEACH-JOVE = $(DESTDIR)$(LIBDIR)/teach-jove
PORTSRV = $(DESTDIR)$(LIBDIR)/portsrv
JOVEM = $(DESTDIR)$(MANDIR)/jove.$(MANEXT)
RECOVERM = $(DESTDIR)$(MANDIR)/recover.$(MANEXT)
TEACHJOVEM = $(DESTDIR)$(MANDIR)/teachjove.$(MANEXT)

# Select the right libraries for your system.
#	2.9BSD:	LIBS =	-ltermlib -ljobs
#	v7:	LIBS =	-ltermlib
#	4.1BSD:	LIBS =	-ltermlib -ljobs
#	4.2BSD:	LIBS =	-ltermlib
#	4.3BSD:	LIBS =	-ltermlib

OVLIBS = -lovtermcap -lovjobs
LIBS = -ltermcap -ljobs

# If you are not VMUNIX (vax running Berkeley Version 4), you must specify
# the -i flags (split I/D space) and maybe the -x option (for adb to work).
#	2.9BSD:	LDFLAGS = -x -i
#	v7:	LDFLAGS = -x -i
#	4.1BSD:	LDFLAGS =
#	4.2BSD:	LDFLAGS =
#	4.3BSD:	LDFLAGS =

LDFLAGS =  -x -i

CFLAGS = -O -V

COFLAGS = -rworking -q

BASESEG = funcdefs.o keymaps.o ask.o buf.o ctype.o delete.o disp.o fmt.o fp.o \
	  insert.o io.o jove.o malloc.o macros.o marks.o misc.o move.o re.o \
	  screen.o tune.o util.o vars.o version.o
OVLAY1 = abbrev.o rec.o paragraph.o
OVLAY2 = c.o wind.o
OVLAY3 = extend.o
OVLAY4 = iproc.o re1.o
OVLAY5 = proc.o scandir.o term.o case.o

OBJECTS = $(BASESEG) $(OVLAY1) $(OVLAY2) $(OVLAY3) $(OVLAY4) $(OVLAY5)

C-FILES = funcdefs.c abbrev.c ask.c buf.c c.c case.c ctype.c delete.c disp.c \
	extend.c fmt.c fp.c insert.c io.c iproc.c iproc-pipes.c iproc-ptys.c \
	jove.c macros.c malloc.c marks.c misc.c move.c paragraph.c proc.c \
	re.c re1.c rec.c scandir.c screen.c term.c util.c vars.c version.c \
	wind.c

H-FILES = ctype.h io.h jove.h re.h rec.h temp.h termcap.h tune.h

BACKUPS = $(C-FILES) $(H-FILES) teachjove.c recover.c setmaps.c portsrv.c \
	tune.template Makefile Ovmakefile keymaps.txt README tags \
	doc

all:	xjove recover teachjove portsrv

xjove:	$(OBJECTS)
	ld $(LDFLAGS) /lib/crt0.o \
		-Z $(OVLAY1) \
		-Z $(OVLAY2) \
		-Z $(OVLAY3) \
		-Z $(OVLAY4) \
		-Z $(OVLAY5) \
		-L $(BASESEG) \
		-o xjove $(OVLIBS) -lovc
	checkobj xjove
	@-size xjove
	@-date

portsrv:	portsrv.c
	cc -o portsrv -n -O portsrv.c $(LIBS)

recover:	recover.c tune.o rec.h temp.h
	cc -o recover -n -O recover.c tune.o -ljobs

teachjove:	teachjove.c
	cc -o teachjove -n -O -DTEACHJOVE=\"$(TEACH-JOVE)\" teachjove.c

setmaps:	setmaps.c funcdefs.c
	cc -o setmaps setmaps.c

keymaps.c:	setmaps keymaps.txt
	setmaps < keymaps.txt > keymaps.c

tune.c: Makefile tune.template
	@echo "/* Changes should be made in Makefile, not to this file! */" > tune.c
	@echo "" >> tune.c
	@sed -e 's;TMPDIR;$(TMPDIR);' \
	     -e 's;RECDIR;$(RECDIR);' \
	     -e 's;LIBDIR;$(LIBDIR);' \
	     -e 's;BINDIR;$(BINDIR);' \
	     -e 's;SHELL;$(SHELL);' tune.template >> tune.c

install: $(LIBDIR) $(TEACH-JOVE) $(CMDS.DOC) $(JOVERC) $(PORTSRV) $(RECOVER) \
	 $(JOVE) $(TEACHJOVE) $(JOVEM) $(RECOVERM) $(TEACHJOVEM)

$(DESTDIR)$(LIBDIR):
	-mkdir (DESTDIR)$(LIBDIR)

$(TEACH-JOVE): doc/teach-jove
	install -c -m 644 doc/teach-jove $(TEACH-JOVE)

$(CMDS.DOC): doc/cmds.doc
	install -c -m 644 doc/cmds.doc $(CMDS.DOC)

$(JOVERC): doc/system.rc
	install -c -m 644 doc/system.rc $(JOVERC)

$(PORTSRV): portsrv
	install -c -m 755 portsrv $(PORTSRV)

$(RECOVER): recover
	install -c -m 755 recover $(RECOVER)

$(JOVE): xjove
	install -c -m 755 xjove $(JOVE)

$(TEACHJOVE): teachjove
	install -c -m 755 teachjove $(TEACHJOVE)

$(JOVEM): doc/jove.nr
	@sed -e 's;TMPDIR;$(TMPDIR);' \
	     -e 's;RECDIR;$(RECDIR);' \
	     -e 's;LIBDIR;$(LIBDIR);' \
	     -e 's;SHELL;$(SHELL);' doc/jove.nr > /tmp/jove.nr
	install -m 644 /tmp/jove.nr $(JOVEM)

$(RECOVERM): doc/recover.nr
	@sed -e 's;TMPDIR;$(TMPDIR);' \
	     -e 's;RECDIR;$(RECDIR);' \
	     -e 's;LIBDIR;$(LIBDIR);' \
	     -e 's;SHELL;$(SHELL);' doc/recover.nr > /tmp/recover.nr
	install -m 644 /tmp/recover.nr $(RECOVERM)

$(TEACHJOVEM): doc/teachjove.nr
	@sed -e 's;TMPDIR;$(TMPDIR);' \
	     -e 's;RECDIR;$(RECDIR);' \
	     -e 's;LIBDIR;$(LIBDIR);' \
	     -e 's;SHELL;$(SHELL);' doc/teachjove.nr > /tmp/teachjove.nr
	install -m 644 /tmp/teachjove.nr $(TEACHJOVEM)

echo:
	@echo $(C-FILES) $(H-FILES)

lint:
	lint -x $(C-FILES)
	echo Done

tags:
	ctags -w $(C-FILES) $(H-FILES)


jove.shar:
	shar $(BACKUPS) doc/* > jove.shar

backup:
	tar cf backup $(BACKUPS)

tape-backup:
	tar cbf 20 /dev/rmt0 $(BACKUPS)

clean:
	rm -f a.out core $(OBJECTS) keymaps.c xjove \
		portsrv recover setmaps teachjove

# abbrev.o: jove.h tune.h
# ask.o: jove.h tune.h
# buf.o: jove.h tune.h
# c.o: jove.h tune.h
# delete.o: jove.h tune.h
# disp.o: jove.h tune.h termcap.h
# extend.o: jove.h tune.h
# fmt.o: jove.h tune.h termcap.h
# funcdefs.o: jove.h tune.h
# insert.o: jove.h tune.h
# io.o: jove.h tune.h termcap.h temp.h
# iproc.o: jove.h tune.h
# jove.o: jove.h tune.h termcap.h
# macros.o: jove.h tune.h
# marks.o: jove.h tune.h
# misc.o: jove.h tune.h
# move.o: jove.h tune.h
# portsrv.o: jove.h tune.h
# proc.o: jove.h tune.h
# re.o: jove.h tune.h
# rec.o: jove.h tune.h temp.h rec.h
# recover.o: jove.h tune.h temp.h rec.h
# screen.o: jove.h tune.h temp.h termcap.h
# setmaps.o: jove.h tune.h
# term.o: jove.h tune.h
# tune.o: tune.h
# util.o: jove.h tune.h
# wind.o: jove.h tune.h termcap.h