MAIN=headings
HDRS=
SRCS=filter.c getopt.c
OBJS=filter.o getopt.o
DOCS=headings.1
LIBS=
DESTDIR=.
CFLAGS=-O
TEXT=$(HDRS) $(MAIN).c $(SRCS) headings.test

LINT  =/usr/bin/lint -hp
PR    =cpr
SPELL =sp
SHAR  =shar -a
RCS   =ci -l
CC    =/bin/cc

$(MAIN): $(MAIN).o $(OBJS)
	$(CC) $(CFLAGS) -o $(MAIN) $(MAIN).o $(OBJS)

install: $(MAIN)
	cp -i $(MAIN) $(DESTDIR)/$(MAIN)

print:
	@$(PR) $(MAIN).c

lint:
	$(LINT) $(MAIN).c

spell:
	seec -cqe $(MAIN).c | $(SPELL)

test:
	$(MAIN).test

archive:
	@$(SHAR) $(DOCS) [Mm]akefile $(TEXT) 

clean:
	rm -f *.o core a.out mon.out gmon.out scmon.out

gprof:
	make CFLAGS="$(CFLAGS) -pg"
scprof:
	make CFLAGS="$(CFLAGS) -p" CC=sc

xref: cscope.out
	ccall -dr > xref.r
	ccall -a > xref.a
	touch xref
cscope.out: $(TEXT)
	cscope $(TEXT)

style: style.out
style.out:
	cstyle $(TEXT) > style.out

rcs: RCS

RCS: $(TEXT)
	$(RCS) $(TEXT)

$(MAIN).1: $(MAIN).c
	@seec -t MANUAL $(MAIN).c

.PRECIOUS: $(TEXT) $(DOCS)
