# Generated automatically from Makefile.in by configure.
# Master Makefile for GNU permuted indexer.
# Copyright (C) 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 = /home/markolf/src/gnu/gptx-0.2


# If you use gcc, you should either run the fixincludes script that
# comes with it or else use gcc with the -traditional option.  Otherwise
# ioctl calls will be compiled incorrectly on some systems.
CC = gcc -O
AR = ar
# Set RANLIB = echo if your system doesn't have or need ranlib.
RANLIB = ranlib
# Use makeinfo if you have it, else format through GNU Emacs.
MAKEINFO = makeinfo
# Use cp if you don't have install.
INSTALL = installbsd -c
INSTALLDATA = installbsd -c

# 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.
# -DCHAR_UNSIGNED	If type `char' is unsigned.
# -DVPRINTF_MISSING	If you lack vprintf function (but have _doprnt).
# -DDOPRNT_MISSING	If you lack _doprnt function.  Also need to define
#			-DVPRINTF_MISSING.
# -DSTRERROR_MISSING	If you lack strerror function.
# -DMCHECK_MISSING	If you lack mcheck function, included in GNU malloc.

DEFS = -DSYNTAX_TABLE  -DSTDC_HEADERS -DMCHECK_MISSING

CFLAGS = -g -I$(srcdir) -I$(srcdir)/lib $(DEFS)
LDFLAGS = -g
LIBS = 

# Common prefix for installation directories.
# NOTE: This directory must exist when you start installation.
prefix = /usr/local
# Directory in which to put the executables.
bindir = $(prefix)/bin
# Directory in which to put the Info documentation.
infodir = $(prefix)/info

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

MDEFINES = bindir='$(bindir)' infodir='$(infodir)' \
LIBS='$(LIBS)' MAKEINFO='$(MAKEINFO)' AR='$(AR)' RANLIB='$(RANLIB)' \
INSTALL='$(INSTALL)' INSTALLDATA='$(INSTALLDATA)' \
CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' LIBS='$(LIBS)' CC='$(CC)'

SOURCES = gptx.c version.c

DISTFILES = README COPYING ChangeLog configure Makefile.in \
gptx.texi gptx.h $(SOURCES) boxes.el gptx.info checkout

PROGS = gptx 

all: gptx.info
	@echo making $@ in lib; cd lib; $(MAKE) $(MDEFINES) $@
	@echo making $(PROGS); $(MAKE) $(MDEFINES) $(PROGS)
.PHONY: all

check: all
	./gptx -A -f < $(srcdir)/COPYING > checkout2
	cmp $(srcdir)/checkout checkout2 && rm checkout2
.PHONY: check

install: all
	$(INSTALL) $(PROGS) $(bindir)
	$(INSTALLDATA) gptx.info $(infodir)
.PHONY: install

tags: $(SOURCES)
	ctags $(SOURCES)
.PHONY: tags

TAGS: $(SOURCES)
	etags $(SOURCES)
.PHONY: TAGS

clean:
	@echo making $@ in lib; cd lib; $(MAKE) $(MDEFINES) $@
	rm -f $(PROGS) *.o core ptx.c
.PHONY: clean

distclean: clean
	@echo making $@ in lib; cd lib; $(MAKE) $(MDEFINES) $@
	rm -f tags TAGS Makefile config.status
.PHONY: distclean

realclean: distclean
	@echo making $@ in lib; cd lib; $(MAKE) $(MDEFINES) $@
	rm -f Makefile config.status gptx.info checkout
.PHONY: realclean

dist: checkout
	echo gptx-`sed -e '/version_string/!d' -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q < version.c` > .fname
	cat .fname
	rm -rf `cat .fname`
	mkdir `cat .fname`
	ln $(DISTFILES) `cat .fname`
	mkdir `cat .fname`/lib; cd lib; $(MAKE) $@
	tar chZf `cat .fname`.tar.Z `cat .fname`
	rm -rf `cat .fname` .fname
.PHONY: dist

gptx.info: gptx.texi
	$(MAKEINFO) $(srcdir)/gptx.texi

$(PROGS): lib/libptx.a version.o

gptx: gptx.o
	$(CC) $(LDFLAGS) -o $@ gptx.o version.o lib/libptx.a $(LIBS)

ptx: ptx.o
	$(CC) $(LDFLAGS) -o $@ ptx.o version.o lib/libptx.a $(LIBS)

ptx.o: gptx.c
	rm -f ptx.c
	cp $(srcdir)/gptx.c ptx.c
	$(CC) $(CFLAGS) -DDEFAULT_IGNORE_FILE=\"\" -DPTX_COMPATIBILITY -c ptx.c
	rm -f ptx.c

gptx.o ptx.o: gptx.h lib/bumpalloc.h lib/ctype.h lib/getopt.h lib/regex.h

checkout: COPYING
	./gptx -A -f < COPYING > checkoutx
	mv checkoutx $@
