#sccs	"@(#)libcurses:Makefile	1.3"

#
# cursor package maker
#
#
include $(MAKEINC)/Makepre.h
HD_INST= .
INC_FILES= \
	$(HD_INST)/curses.h

HEADERS=curses.h unctrl.h cr_ex.h curses.ext
CFILES=	box.c clear.c initscr.c endwin.c mvprintw.c mvscanw.c mvwin.c \
	newwin.c overlay.c overwrite.c printw.c scanw.c refresh.c \
	touchwin.c erase.c clrtobot.c clrtoeol.c cr_put.c cr_tty.c \
	longname.c delwin.c insertln.c deleteln.c scroll.c getstr.c \
	getch.c addstr.c addch.c move.c curses.c unctrl.c standout.c \
	tstp.c insch.c delch.c

OBJS=	box.o clear.o initscr.o endwin.o mvprintw.o mvscanw.o mvwin.o \
	newwin.o overlay.o overwrite.o printw.o scanw.o refresh.o \
	touchwin.o erase.o clrtobot.o clrtoeol.o cr_put.o cr_tty.o \
	longname.o delwin.o insertln.o deleteln.o scroll.o getstr.o \
	getch.o addstr.o addch.o move.o curses.o unctrl.o standout.o \
	tstp.o insch.o delch.o

POBJS=	box.p clear.p initscr.p endwin.p mvprintw.p mvscanw.p mvwin.p \
	newwin.p overlay.p overwrite.p printw.p scanw.p refresh.p \
	touchwin.p erase.p clrtobot.p clrtoeol.p cr_put.p cr_tty.p \
	longname.p delwin.p insertln.p deleteln.p scroll.p getstr.p \
	getch.p addstr.p addch.p move.p curses.p unctrl.p standout.p \
	tstp.p insch.p delch.p

DEPENDLIST = $(CFILES)

CTAGS=	ctags
LPASS1=	/usr/lib/lint/lint1
RM=	rm
LN=	ln
.SUFFIXES: .p .o

.c.p:
	rm -f x.c
	ln $*.c x.c
	${CC} ${CFLAGS} -p -c x.c
	mv x.o $*.p

.c.o:
	${CC} ${CFLAGS} -c $*.c

all:	Makeincludes libcurses

hdr_install: announce $(INC_FILES)

announce:
	echo "Installing public header files"

$(INC_FILES)::	$$(@F)
	rm -f $(@)
	cp $(@F) $(@)

Makeincludes: $(DEPENDLIST)
	$(INCCMD) $(DEPENDLIST) | $(SORT) | $(FILTER) > Makeincludes;\
	$(MAKE)

includes: $(DEPENDLIST)
	$(INCCMD) $(DEPENDLIST) | $(SORT) | $(FILTER) > Makeincludes

libcurses: ${HEADERS} crlib
	rm -f libcurses.a
	-ln crlib libcurses.a

crlib: ${OBJS}
	${AR} rv crlib $?

pcrlib: ${POBJS}
	rm -f x.c
	${AR} rv pcrlib $?

test:	crlib test.o
	${CC} ${LDFLAGS} ${CFLAGS} -o test test.o crlib -ltermlib

clean:
	rm -f ${OBJS}

clobber: clean
	rm -f crlib libcurses.a

ctags:
	${CTAGS} ${CFILES} curses.h cr_ex.h

lint:
	${LINT} -hxb ${CFL} ${CFILES} -lcurses > lint.out


llib-lcurses.ln: llib-lcurses
	-($(CPP) -C -Dlint llib-lcurses | ${LPASS1} > llib-lcurses.ln ) 2>&1 | grep -v warning

populate:
	getunit

install: 
	$(INSTALL) -i$(EXITFLAG) libcurses.a $(INSDIR) $(PROTOFILE)
	chown bin libcurses.a
	chgrp bin libcurses.a
	chmod 644 libcurses.a
	echo libcurses.a | cpio -pumv $(USRLIB)

include Makeincludes
include $(MAKEINC)/Makepost.h

