DOBJS=	display.o TrmAmb.o TrmBitG.o TrmTEK4025.o TrmTERM.o TrmVT100.o init.o\
	TrmH19.o TrmHP.o cm.o
DSRCS=	display.c TrmAmb.c TrmBitG.c TrmTEK4025.c TrmTERM.c TrmVT100.c init.c\
	TrmH19.c TrmHP.c cm.c
# for 4.2BSD, set BCOPY and BCOPYC to nothing; for 4.1, set to bcopy.o and
# bcopy.c, respectively
#BCOPY=bcopy.o
BCOPY=
#BCOPYC=bcopy.c
BCOPYC=
WOBJS=	acursor.o aprint.o aread.o auxcursor.o\
	back.o bclear.o bclearline.o $(BCOPY)\
	bcursor.o bdelchars.o bdelcols.o bdellines.o binschars.o binscols.o\
	binslines.o border.o box.o boxfind.o bprint.o bread.o bscroll.o\
	btowcursor.o cleanup.o clear.o clearline.o close.o closeall.o\
	cover.o delchars.o delcols.o dellines.o disp.o filedump.o find.o\
	frame.o front.o getframe.o globals.o hide.o inschars.o inscols.o\
	inslines.o label.o link.o move.o oncursor.o open.o print.o read.o\
	retro.o scroll.o setbuf.o setframe.o setmargins.o size.o suspend.o\
	wcursor.o wexit.o
WSRCS=	acursor.c aprint.c aread.c auxcursor.c\
	back.c bclear.c bclearline.c $(BCOPYC)\
	bcursor.c bdelchars.c bdelcols.c bdellines.c binschars.c binscols.c\
	binslines.c border.c box.c boxfind.c bprint.c bread.c bscroll.c\
	btowcursor.c cleanup.c clear.c clearline.c close.c closeall.c\
	cover.c delchars.c delcols.c dellines.c disp.c filedump.c find.c\
	frame.c front.c getframe.c globals.c hide.c inschars.c inscols.c\
	inslines.c label.c link.c move.c oncursor.c open.c print.c read.c\
	retro.c scroll.c setbuf.c setframe.c setmargins.c size.c suspend.c\
	wcursor.c wexit.c
JOBSOBJS=
LIBDIR=/usr/lib
INCLUDEDIR=/usr/include/local
ScFile=window.sc

# To make winlib.a, type ``make winlib.a''.  If you're on a Vax,
# everything should compile.  If you're on some other machine, you
# may have to edit win.h to reverse the two character elements of
# union chr.  Note that I already check for ``pyr'', ``mc68000'',
# and ``sun''.  If everything compiles, but nothing works, check
# win.h.
#
# To install winlib.a, after it has been made, type ``make install''.
# You probably need special privileges for this, depending on what
# your system administrators have set up.
#
# Note 1: if your system does not have ``ranlib'', you can change the
# ``ar cr winlib.a ...'' line to read:
#	ar cr winlib.a `cat TSORT`
# and comment out the ranlib line.
#
# Note 2: if your system does not have the jobs library, you can add
# the file "jobs.o" to the JOBSOBJS= line so that it reads
#	JOBSOBJS=jobs.o
# and add 'jobs.o' to the end of the TSORT file.  A better(?) alternative
# is to use jobs.c to make a ``jobs library''.
# HOWEVER!:  4.2BSD doesn't need (or use) the jobs library.

# The -R flag puts initialized data (eg., strings) in read-only (shared)
# storage.  Just delete it if your compiler doesn't support it (eg., Sun).
CFLAGS= -O -R

winlib.a: $(DOBJS) $(WOBJS) $(JOBSOBJS)
	ar cr winlib.a $(DOBJS) $(WOBJS) $(JOBSOBJS)
	ranlib winlib.a

# Once winlib has been made, it can be updated incrementally by
# deleting the "incremental-" from the front of this next name,
# commenting out the first entry, and removing the # from the
# second line of the .c.o entry.  This will only work for people
# who have ranlib.

incremental-winlib.a: $(DOBJS) $(WOBJS) $(JOBSOBJS)
	ranlib winlib.a

depend:
	mkdep -n $(DSRCS) $(WSRCS)

.c.o:
	cc $(CFLAGS) -c $<
#	ar r winlib.a $@

TrmAmb.o: TrmAmb.c Trm.h
TrmBitG.o: TrmBitG.c Trm.h
TrmTEK4025.o: TrmTEK4025.c Trm.h
TrmTERM.o: TrmTERM.c Trm.h win.h
TrmVT100.o: TrmVT100.c Trm.h
TrmH19.o: TrmH19.c Trm.h win.h cm.h
TrmHP.o: TrmHP.c Trm.h win.h cm.h
cm.o: cm.c cm.h
display.o: display.c Trm.h win.h
init.o: init.c display.h win.h Trm.h

acursor.o: acursor.c win.h
aread.o: aread.c win.h
auxcursor.o: auxcursor.c win.h
back.o: back.c win.h
bclear.o: bclear.c win.h
bclearline.o: bclearline.c win.h
bcursor.o: bcursor.c win.h
bdelchars.o: bdelchars.c win.h
bdelcols.o: bdelcols.c win.h
bdellines.o: bdellines.c win.h
binschars.o: binschars.c win.h
binscols.o: binscols.c win.h
binslines.o: binslines.c win.h
border.o: border.c win.h
box.o: box.c win.h display.h Trm.h
boxfind.o: boxfind.c win.h
bread.o: bread.c win.h
bscroll.o: bscroll.c win.h
btowcursor.o: btowcursor.c win.h
cleanup.o: cleanup.c win.h display.h Trm.h
clear.o: clear.c win.h
clearline.o: clearline.c win.h
close.o: close.c win.h
closeall.o: closeall.c win.h
cover.o: cover.c win.h
cursor.o: cursor.c win.h
delchars.o: delchars.c win.h
delcols.o: delcols.c win.h
dellines.o: dellines.c win.h
disp.o: disp.c win.h display.h Trm.h
filedump.o: filedump.c win.h display.h Trm.h
find.o: find.c win.h
frame.o: frame.c win.h Trm.h
front.o: front.c win.h
getframe.o: getframe.c Trm.h win.h
globals.o: globals.c win.h
hide.o: hide.c win.h
inschars.o: inschars.c win.h
inscols.o: inscols.c win.h
inslines.o: inslines.c win.h
label.o: label.c win.h
link.o: link.c win.h display.h Trm.h
move.o: move.c win.h display.h Trm.h
oncursor.o: oncursor.c win.h
open.o: open.c win.h display.h Trm.h
print.o: print.c win.h
read.o: read.c win.h
retro.o: retro.c win.h
scroll.o: scroll.c win.h
setbuf.o: setbuf.c win.h
setframe.o: setframe.c Trm.h win.h
setmargins.o: setmargins.c win.h
size.o: size.c win.h display.h Trm.h
suspend.o: suspend.c win.h
wcursor.o: wcursor.c win.h

install:
	cp winlib.a $(LIBDIR)/libwinlib.a
	cp win.h window.h $(INCLUDEDIR)
	ranlib $(LIBDIR)/libwinlib.a

lint:
	lint $(DSRCS) $(WSRCS)

print:
	llist -t Windows $(DSRCS) $(WSRCS)

print8:
	llist -8 -t Windows $(DSRCS) $(WSRCS)

# The "script" entry is purely for producing distribution tapes.
script:
	makescript -o ${ScFile} /g/dist/win/*
