SHELL = /bin/sh

.SUFFIXES: .c,v .h,v

.c,v.o:
	@co -q $*.c
	cc $(CFLAGS) -c $*.c
	@rm -f $*.c

.h,v.h:
	@co -q $*.h

UNIFY = /appl/u32
UINCL = $(UNIFY)/include
OBJ = curses.o datetp.o gdata.o gtube.o iamt.o idate.o iflt.o ihamt.o ilong.o \
	inbuf.o inl.o inscrf.o ishort.o istr.o itime.o loadscr.o prtmsg.o \
	xerror.o dbfopen.o dbfile.o setxrc.o input.o setraw.o setcook.o \
	cleancrt.o clearscr.o clr_crt.o eras_ln.o dsply.o erasprmp.o keybrd.o \
	mv_cur.o priamd.o ptct_crt.o ptct_wrt.o prmp.o prmpf.o prmprv.o \
	yorn.o sfldesc.o xsfldesc.o pamt.o pdate.o pflt.o phamt.o plong.o \
	pshort.o pstr.o ptime.o outscrf.o ptube.o pdata.o outbuf.o output.o \
	error.o uerror.o dbherr.o pageout.o eras_pg.o xsize.o uamt.o udate.o \
	uflt.o uhamt.o ulong.o ushort.o ustr.o utime.o updata.o uptube.o \
	upbuf.o upscrf.o upfield.o zoom.o gprint.o pflush.o inc.o datefns.o \
	shellout.o incs.o ringmenu.o
SRC = curses.c datetp.c gdata.c gtube.c iamt.c idate.c iflt.c ihamt.c ilong.c \
	inbuf.c inl.c inscrf.c ishort.c istr.c itime.c loadscr.c prtmsg.c \
	xerror.c dbfopen.c dbfile.c setxrc.c input.c setraw.c setcook.c \
	cleancrt.c clearscr.c clr_crt.c eras_ln.c dsply.c erasprmp.c keybrd.c \
	mv_cur.c priamd.c ptct_crt.c ptct_wrt.c prmp.c prmpf.c prmprv.c \
	yorn.c sfldesc.c xsfldesc.c pamt.c pdate.c pflt.c phamt.c plong.c \
	pshort.c pstr.c ptime.c outscrf.c ptube.c pdata.c outbuf.c output.c \
	error.c uerror.c dbherr.c pageout.c eras_pg.c xsize.c uamt.c udate.c \
	uflt.c uhamt.c ulong.c ushort.c ustr.c utime.c updata.c uptube.c \
	upbuf.c upscrf.c upfield.c zoom.c gprint.c pflush.c inc.c datefns.c \
	shellout.c incs.c ringmenu.c
TG = tgraph.a
CFLAGS = -O -I$(UINCL) -DUNIFY32 -DTG
#CFLAGS = -O -DTERMCAP -I$(UINCL)
LINT =

libusc.a: $(OBJ)
	@rm -f libusc.a
	ar rc libusc.a $(OBJ)

lint:
	@co -q $(SRC)
	lint $(CFLAGS) $(LINT) $(SRC) Lcurses.c Lunitrieve.c > lint.out
	@rm -f $(SRC)

lint31c:
	@co -q $(SRC)
	lint -UUNIFY32 -DTERMCAP -UTG $(SRC) Lcurses.c Lunitrieve.c > lint.out
	@rm -f $(SRC)

lint32c:
	@co -q $(SRC)
	lint -DUNIFY32 -DTERMCAP -UTG $(SRC) Lcurses.c Lunitrieve.c > lint.out
	@rm -f $(SRC)

lint31i:
	@co -q $(SRC)
	lint -UUNIFY32 -UTERMCAP -UTG $(SRC) Lcurses.c Lunitrieve.c > lint.out
	@rm -f $(SRC)

lint32i:
	@co -q $(SRC)
	lint -DUNIFY32 -UTERMCAP -UTG $(SRC) Lcurses.c Lunitrieve.c > lint.out
	@rm -f $(SRC)

lint31g:
	@co -q $(SRC)
	lint -UUNIFY32 -UTERMCAP -DTG $(SRC) Lcurses.c Lunitrieve.c > lint.out
	@rm -f $(SRC)

lint32g:
	@co -q $(SRC)
	lint -DUNIFY32 -UTERMCAP -DTG $(SRC) Lcurses.c Lunitrieve.c > lint.out
	@rm -f $(SRC)

$(OBJ): usc.h

tester: tester.o libusc.a
	ld -x -o tester /lib/crt0.o \
		tester.o \
		libusc.a \
		$(UNIFY)/lib/libd[12].a \
		libusc.a \
		$(UNIFY)/lib/libx.a $(TG) -lcurses -lm -lc
