# Makefile for the info sources... -*- text -*-
# Copyright (C) 1990-1991 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., 675 Mass Ave, Cambridge, MA 02139, USA.

SHELL = /bin/sh

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

srcdir = @srcdir@
@VPATH@

CC = @CC@
INSTALL = @INSTALL@
INSTALLDATA = @INSTALLDATA@

# Things you might add to DEFS:
# -DSTDC_HEADERS	If you have ANSI C headers and libraries.
# -DUSG			If you have System V/ANSI C string and
#			memory functions and headers.
DEFS = @DEFS@

CDEBUG = -O
CFLAGS = $(CDEBUG) $(DEFS)
LDFLAGS = -O

LIBS = @LIBS@

# Colon-separated list of directories in which to look for info files.
DEFAULT_INFOPATH = .:$(INFODIR):/usr/gnu/info:/usr/local/emacs/info:/usr/local/lib/emacs/info

# Command used to print out a text file.  The filename follows this command.
INFO_PRINT_COMMAND = lpr

prefix = /usr/local

# Where installed binaries go.
BINDIR = @BINDIR@

# Where info files go.
INFODIR = @INFODIR@

# Where manual pages go, and their extension (not including `.').
mandir = @MANDIR@
manext = 1

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

PATHSPEC = -DDEFAULT_INFOPATH='"$(DEFAULT_INFOPATH)"'
PRINTSPEC = -DINFO_PRINT_COMMAND='"$(INFO_PRINT_COMMAND)"'
INFO_FLAGS = $(PATHSPEC) $(PRINTSPEC)

SOURCES = info.c latexindex.c getopt.c getopt1.c
OBJECTS = info.o latexindex.o getopt.o getopt1.o
HEADERS = getopt.h
SUPPORT = Makefile.in configure 

THINGS_TO_TAR = $(SOURCES) $(HEADERS) $(SUPPORT)

PROGS = info latexindex

all: $(PROGS)

info:	info.o getopt.o getopt1.o
	$(CC) $(LDFLAGS) -o info info.o getopt.o getopt1.o -ltermcap $(LIBS)

info.o: info.c
	$(CC) -c $(CFLAGS) $(INFO_FLAGS) $info.c<

latexindex: latexindex.o getopt.o getopt1.o
	$(CC) $(LDFLAGS) -o latexindex latexindex.o getopt.o getopt1.o $(LIBS)

latexindex.o: latexindex.c
	$(CC) -c $(CFLAGS) $latexindex.c<

info.o latexindex.o getopt1.o: getopt.h

install: all
	$(INSTALL) $(PROGS) $(BINDIR)

TAGS: $(SOURCES)
	etags $(SOURCES)

clean:
	rm -f $(PROGS) $(OBJECTS)

distclean: realclean
	-rm -f TAGS Makefile config.status

realclean: distclean

dist: $(THINGS_TO_TAR)
	rm -rf info-dist
	mkdir info-dist
	(cd info-dist; for i in $(THINGS_TO_TAR); do ln -s ../$$i .; done)
	tar chzf info.tar.Z info-dist
	rm -rf info-dist