# 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 = -g
CFLAGS = $(CDEBUG) $(DEFS)
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

# Where installed binaries go.
bindir = $(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 getopt.c getopt1.c
OBJECTS = info.o makeinfo.o getopt.o getopt1.o
HEADERS = getopt.h
SUPPORT = Makefile.in configure 

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

PROGS = info makeinfo

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<

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

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

info.o makeinfo.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
