# Makefile for GNU Texindex.
# Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#### Start of system configuration section. ####

srcdir = @srcdir@
VPATH  = $(srcdir)

CC = @CC@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@

LN	= ln
RM	= rm -f
TAR	= tar
MKDIR	= mkdir
RANLIB = @RANLIB@
DEFS = -DEUC @DEFS@
LIBS = -L./ -ltxi @LIBS@
LOADLIBES = $(LIBS)

# This is normally inherited from parent make, but if someone wants to
# build libtxi.a alone, this variable will still be properly defined.
ALLOCA = @ALLOCA@

SHELL = /bin/sh

CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@

prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = $(exec_prefix)/bin
# Prefix for each installed program, normally empty or `g'.

#### End of system configuration section. ####

SRCS =  getopt.c getopt.h getopt1.c bzero.c
OBJS =  getopt.o getopt1.o bzero.o $(ALLOCA)

PROGS = libtxi.a

all: texindex $(PROGS)
sub-all: all

.c.o:
	$(CC) -c $(CPPFLAGS) $(DEFS) -I. -I$(srcdir) $(CFLAGS) $<


install: all
	$(INSTALL_PROGRAM) texindex $(bindir)/texindex

uninstall:
	rm -f $(bindir)/texindex

TAGS:
	etags *.c *.h getopt*.c getopt.h

clean:
	rm -f *.o a.out core core.* texindex $(PROGS)

mostlyclean: clean

distclean: clean
	rm -f Makefile config.status

realclean: distclean
	rm -f TAGS

texindex: texindex.o libtxi.a
	$(CC) $(LDFLAGS) -o texindex texindex.o $(LOADLIBES)

libtxi.a: $(OBJS)
	ar qcv libtxi.a $(OBJS)
	$(RANLIB) libtxi.a

texindex.o: texindex.c getopt.h
getopt.o: getopt.c getopt.h
getopt1.o: getopt1.c getopt.h
alloca.o: alloca.c

# Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT:
