# Makefile for pcl-cvs, an Emacs interface to CVS.
# NOTE: pcl-cvs requires Elib to run.  See ../../contrib/elib/.

#
#ident	"@(#)original: dist-makefile,v 1.19 1993/05/31 22:43:45 ceder Exp "
#
#ident	"@(#)elisp/pcl-cvs:$Name:  $:$Id: Makefile.in,v 1.3 1996/04/15 06:33:20 kfogel Exp $"
#
# Makefile for pcl-cvs release 1.05-CVS-$Name:  $.
# Copyright (C) 1992, 1993  Per Cederqvist
#
# 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 of the License, 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@
top_srcdir = @top_srcdir@
VPATH = @srcdir@

prefix = @prefix@
exec_prefix = @exec_prefix@

# Where to put the system-wide supplementary files
libdir = $(prefix)/lib

# Where to put the Info files
infodir = $(prefix)/info

# Where to put the manual pages.
mandir = $(prefix)/man

# Used to batch-byte-compile files.
EMACS = emacs
# compile with noninteractive environment
BATCHFLAGS = -batch

# This is the directory in which the ELCFILES will be installed.
lispdir = $(libdir)/emacs/site-lisp

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

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@

# Just in case...
SHELL = /bin/sh
@SET_MAKE@

DISTFILES = \
	.cvsignore ChangeLog INSTALL Makefile.in NEWS README \
	${ELFILES} \
	pcl-cvs.texinfo texinfo.tex


# OBJDIR_DISTFILES used to include the byte-compiled elisp files, but
# this seems wrong because the person building the dist cannot have
# made the appropriate site-specific modifications to pcl-cvs.el.
# Therefore, I've taken the .elc files out of OBJDIR_DISTFILES for
# now, pending the Right Solution to this problem (which probably
# involves moving the site-specific modification section of pcl-cvs.el
# to a separate file and having autoconf generate as much of the file
# as possible).     -Karl
#
# OBJDIR_DISTFILES = $(ELCFILES) pcl-cvs.aux pcl-cvs.ps
OBJDIR_DISTFILES = pcl-cvs.aux pcl-cvs.ps


# files that contain key macro definitions.  almost everything
# depends on them because the byte-compiler inlines macro
# expansions.  everything also depends on the byte compiler
# options file since this might do odd things like turn off
# certain compiler optimizations.
CORE = 

ELFILES = pcl-cvs.el pcl-cvs-lucid.el pcl-cvs-startup.el
ELCFILES = pcl-cvs.elc pcl-cvs-lucid.elc
INFOFILES = pcl-cvs.info*
TEXTMPS = pcl-cvs.aux pcl-cvs.log pcl-cvs.toc pcl-cvs.dvi pcl-cvs.cp \
	pcl-cvs.fn pcl-cvs.vr pcl-cvs.tp pcl-cvs.ky pcl-cvs.pg \
	pcl-cvs.cps pcl-cvs.fns pcl-cvs.kys pcl-cvs.pgs pcl-cvs.tps \
	pcl-cvs.vrs

# Use cp if you don't have install.
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@

MAKEINFO = makeinfo

SET_TEXINPUTS = TEXINPUTS=.:$(srcdir):$$TEXINPUTS

# Don Knuth's TeX formatter
TEX = tex

# auxiliary program for sorting Texinfo indices
TEXINDEX = texindex

DVIPS = dvips
DVIPSFLAGS = 

# CYGNUS LOCAL: install does not depend on info
all: $(ELCFILES) # info
.PHONY:	all

.SUFFIXES:	.el .elc
# We copy the .el file to the build dir--is there a cleaner way to get
# emacs to compile the .el file from srcdir and put the .elc in the build dir?
# (that is also why we have separate rules for pcl-cvs.elc and 
# pcl-cvs-lucid.elc rather than just using a .el.elc rule).
pcl-cvs.elc: pcl-cvs.el
	@echo "You can probably ignore free variable and unknown function warnings..."
	if test -f pcl-cvs.el; then \
	  : OK, we are building in srcdir ; \
	else \
	  ln $(srcdir)/pcl-cvs.el . ; \
	fi
	$(EMACS) $(BATCHFLAGS) -f batch-byte-compile pcl-cvs.el
pcl-cvs-lucid.elc: pcl-cvs-lucid.el
	@echo "You can probably ignore free variable and unknown function warnings..."
	if test -f pcl-cvs-lucid.el; then \
	  : OK, we are building in srcdir ; \
	else \
	  ln $(srcdir)/pcl-cvs-lucid.el . ; \
	fi
	$(EMACS) $(BATCHFLAGS) -f batch-byte-compile pcl-cvs-lucid.el

check installcheck:
	@echo "$@ not supported in this makefile..."
.PHONY:	check installcheck

# CYGNUS LOCAL: install does not depend on install-info
install: install-elc # install-info install-el

install-el: $(ELFILES)
	for i in $(ELFILES) ; do \
	  $(INSTALL_DATA) $$i $(lispdir)/$$i ; \
	done

install-elc: $(ELCFILES)
	for i in $(ELCFILES) ; do \
	  $(INSTALL_DATA) $$i $(lispdir)/$$i ; \
	done

install-info: info
	test -f pcl-cvs.info || cd $(srcdir); \
	for i in *.info* ; do \
	  $(INSTALL_DATA) $$i $(infodir)/$$i ; \
	done

.PHONY:	install install-el install-elc install-info

# mkinstalldirs isn't supported for CVS yet....
installdirs: $(top_srcdir)/mkinstalldirs
	$(SHELL) $(top_srcdir)/mkinstalldirs $(lispdir) $(infodir)
.PHONY:	installdirs

uninstall:
	@echo "$@ not yet supported in this makefile..."
.PHONY:	uninstall

info: pcl-cvs.info
.PHONY:	info

pcl-cvs.info: pcl-cvs.texinfo
	$(MAKEINFO) ${srcdir}/pcl-cvs.texinfo -o pcl-cvs.info

dvi: pcl-cvs.dvi
.PHONY:	dvi

# this mess seems to be necessary to make the index right...
pcl-cvs.dvi pcl-cvs.aux: pcl-cvs.texinfo
	$(SET_TEXINPUTS) $(TEX) $(srcdir)/pcl-cvs.texinfo
	$(SET_TEXINPUTS) $(TEX) $(srcdir)/pcl-cvs.texinfo
	-$(TEXINDEX) pcl-cvs.cp pcl-cvs.fn pcl-cvs.vr pcl-cvs.tp pcl-cvs.ky \
		pcl-cvs.pg
	$(SET_TEXINPUTS) $(TEX) $(srcdir)/pcl-cvs.texinfo

pcl-cvs.ps: pcl-cvs.dvi
	$(DVIPS) $(DVIPSFLAGS) pcl-cvs.dvi -o pcl-cvs.ps

mostlyclean clean:
	rm -f *~ core $(ELCFILES) $(INFOFILES) $(TEXTMPS)
.PHONY: mostlyclean clean

distclean: clean
	rm -f Makefile tags TAGS
.PHONY: distclean

realclean maintainer-clean: distclean
	rm -f pcl-cvs.info* pcl-cvs.ps
.PHONY: realclean maintainer-clean

# you can't use ctags for lisp...
tags TAGS:
	etags *.el
.PHONY: tags

ls:
	@echo $(DISTFILES)
.PHONY: ls

dist-dir: ${OBJDIR_DISTFILES} ${DISTFILES} pcl-cvs.info
	mkdir ${DISTDIR}
	for i in ${DISTFILES}; do \
	  ln $(srcdir)/$${i} ${DISTDIR}; \
	done
	ln ${OBJDIR_DISTFILES} ${DISTDIR}
	if [ -f pcl-cvs.info-1 ]; \
	  then ln -f pcl-cvs.info-* ${DISTDIR}; \
	  else : Pacify Ultrix sh; \
	fi
.PHONY: dist-dir

subdir = tools/pcl-cvs
Makefile: ../../config.status Makefile.in
	cd ../.. && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status

# CYGNUS LOCAL: don't depend on auto-re-config
#../config.status: ../configure
#	cd .. ; $(SHELL) config.status --recheck

# CYGNUS LOCAL: don't depend on auto-re-config
#../configure: ../configure.in
#	cd $(top_srcdir) ; autoconf
