# 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 = @srcdir@

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

# Things you might add to DEFS:
# -DSTDC_HEADERS	If you have ANSI C headers and libraries.
# -DHAVE_UNISTD_H	If you have unistd.h.
# -DUSG			If you have System V/ANSI C string and
#			memory functions and headers.
# -DUSGr3		If you need to include sys/stream.h and sys/ptem.h
#			to get the screen size from the kernel.
DEFS = @DEFS@

CFLAGS = -g
LDFLAGS = -g

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
exec_prefix = $(prefix)

# Where installed binaries go.
bindir = $(exec_prefix)/bin

# Where info files go.
infodir = $(prefix)/info

# Where manual pages go, and their extension (not including `.').
mandir = $(prefix)/man/man1
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 makeinfo.c texindex.c getopt.c getopt1.c
OBJECTS = info.o makeinfo.o texindex.o getopt.o getopt1.o
HEADERS = getopt.h
SUPPORT = Makefile.in configure 

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

PROGS = info makeinfo texindex

all: $(PROGS)

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

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

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

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

makeinfo.o: makeinfo.c
	$(CC) -c $(CFLAGS) $(MAKEINFO_FLAGS) $makeinfo.c<

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

info.o makeinfo.o texindex.o getopt1.o: getopt.h

install: all
	for f in $(PROGS); do $(INSTALL_PROGRAM) $$f $(bindir)/$$f; done

TAGS: $(SOURCES)
	etags $(SOURCES)

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

mostlyclean: clean

distclean: clean
	rm -f Makefile config.status

realclean: distclean
	rm -f TAGS

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

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