
#
#  Makefile for the program `makeindex'
#
#  Copyright (C) 1987 Pehong Chen     (phc@renoir.berkeley.edu)
#  Computer Science Division
#  University of California, Berkeley
#

BINDIR        = /usr/local/bin

MANDIR              = /usr/local/man/manl

MANUAL              = makeindex.l

DOC         = makeindex.tex

EXTHDRS             = /usr/include/ctype.h \
	      /usr/include/stdio.h

HDRS        = genind.h \
	      mkind.h \
	      scanid.h \
	      scanst.h

CFLAGS              = -O -DOS_SYSV

LDFLAGS             = $(CFLAGS)

LIBS        =

LINKER              = $(CC)

MAKEFILE      = Makefile

OBJS        = genind.o \
	      mkind.o \
	      qsort.o \
	      scanid.o \
	      scanst.o \
	      sortid.o

PRINT       = psgrind

SRCS        = genind.c \
	      mkind.c \
	      qsort.c \
	      scanid.c \
	      scanst.c \
	      sortid.c

PROGRAM             = makeindex

TAR         = $(PROGRAM).tar

SHAR        = $(PROGRAM).shar

ALL         = $(MAKEFILE) $(DOC) $(MANUAL) $(HDRS) $(SRCS)

$(PROGRAM):	$(OBJS)
	@rm -f $(PROGRAM)
	$(LINKER) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM)
	@size $(PROGRAM)

install:	$(PROGRAM)
	install -c -s -m 0755 $(PROGRAM) $(BINDIR)
	install -c -m 0744 ../doc/makeindex.l $(MANDIR)/makeindex.1
	@ls -lgs $(BINDIR)/$(PROGRAM)

cp-install:
	$(CP) $(PROGRAM) $(BINDIR)
	strip $(BINDIR)/$(PROGRAM)
	chmod 755 $(BINDIR)/$(PROGRAM)
	$(CP) ../doc/makeindex.l $(MANDIR)/makeindex.1
	chmod 744 $(MANDIR)/makeindex.1

uninstall:
	$(RM) $(BINDIR)/$(PROGRAM)
	$(RM) $(MANDIR)/makeindex.1


tar:
	@rm -f $(TAR)
	tar -cf $(TAR) $(ALL)

shar:
	@rm -f $(SHAR)
	shar $(SHAR) $(ALL)

dist:
	cp $(PROGRAM) $(BINDIR)
	rcp $(PROGRAM) monet:$(BINDIR)
	rcp $(PROGRAM) arpa:$(BINDIR)
	rcp $(PROGRAM) harrison@vangogh:bin

clean:
	@rm -f $(OBJS) core $(PROGRAM) *.out

depend:
	@rm -f .#*.[chly]
	mkmf -f $(MAKEFILE) PROGRAM=$(PROGRAM) BINDIR=$(BINDIR)

index:
	@ctags -wx $(HDRS) $(SRCS)

print:
	@$(PRINT) $(HDRS) $(SRCS)

man:
	ptroff -man $(MANUAL)

program:	$(PROGRAM)

tags:		$(HDRS) $(SRCS)
	@ctags $(HDRS) $(SRCS)

update:	$(BINDIR)/$(PROGRAM)

$(BINDIR)/$(PROGRAM): $(SRCS) $(HDRS) $(EXTHDRS)
	@make -f $(MAKEFILE) BINDIR=$(BINDIR) install

.DEFAULT:
	co $@
###
genind.o: mkind.h /usr/include/stdio.h /usr/include/ctype.h \
	genind.h
mkind.o: mkind.h /usr/include/stdio.h /usr/include/ctype.h
qsort.o: mkind.h /usr/include/stdio.h
scanid.o: mkind.h /usr/include/stdio.h /usr/include/ctype.h \
	scanid.h
scanst.o: mkind.h /usr/include/stdio.h /usr/include/ctype.h \
	scanst.h
sortid.o: mkind.h /usr/include/stdio.h /usr/include/ctype.h

