# (GNU) Makefile for the  Epoch Reference Manual
# modelled after the lispref Makefile
#
# 20 July 1990

# Redefine `TEX' if `tex' does not invoke plain TeX. For example:
# TEX=platex

TEX=tex

# Where the TeX macros are kept:
texmacrodir = /usr/local/lib/tex/macros

# Where the Emacs hierarchy lives ($EMACS in the INSTALL document for Emacs.)
# For example: 
# emacslibdir = /usr/local/gnu/lib/emacs

# Directory where Emacs is installed, by default:
emacslibdir = /usr/local/emacs

# Unless you have a nonstandard Emacs installation, these shouldn't have to 
# be changed.
emacsinfodir = $(emacslibdir)/info

# The name of the manual:

manual = epoch

# Uncomment this line for permuted index.
permuted_index = 1 

# List of all the texinfo files in the manual:

srcs = \
	basics.texinfo \
        events.texinfo \
        screens.texinfo \
	buttons.texinfo \
        index.texinfo \
        x11.texinfo \
	chapters.texinfo \
        intro.texinfo \
	epoch.texinfo \
        misc.texinfo

.PHONY: epoch.dvi clean

epoch.dvi: $(srcs) index.texinfo texindex
	# First shot to define xrefs:
	$(TEX) epoch.texinfo

	# permute-index produces index.fns.
ifdef permuted_index
	csh -f permute-index
else
	./texindex epoch.??
endif
	$(TEX) epoch.texinfo

# The info file is named `epoch'.

epoch: makeinfo $(srcs)
	./makeinfo epoch.texinfo

install: epoch epoch.dvi
	mv epoch epoch-* $(emacsinfodir)
	@echo also add the line for epoch to $(emacsinfodir)/dir.

installall: install
	install -c texinfo.tex $(texmacrodir)

clean:
	rm -f $(manual).??? $(manual).?? make.out core 
	rm -f makeinfo.o makeinfo getopt.o getopt1.o
	rm -f texindex.o texindex

dist:
	tar chf epoch.tar README Makefile permute-index $(srcs) \
   texinfo.tex texindex.c makeinfo.c getopt.c getopt1.c getopt.h \
   epoch.dvi epoch.aux epoch.??s epoch epoch-*
	compress epoch.tar

shar: 
	shar README Makefile permute-index $(srcs) \
   texinfo.tex texindex.c makeinfo.c > epoch.shar < /dev/null


# Make two programs used in generating output from texinfo.
CC=gcc
CFLAGS = -g

texindex: texindex.o
	$(CC) -o $@ $(LDFLAGS) $(CFLAGS) $?
texindex.o: texindex.c

MAKEINFO_MAJOR = 1
MAKEINFO_MINOR = 0
MAKEINFO_FLAGS = -DMAKEINFO_MAJOR=$(MAKEINFO_MAJOR) -DMAKEINFO_MINOR=$(MAKEINFO_MINOR)

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

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