
#
# Makefile.in
# (if you're reading Makefile, it's autogenerated from Makefile.in)
# $Id: Makefile.in,v 1.31 2006/01/14 23:26:41 johnh Exp $
#

######################################################################
#
# user configurable parameters
#

prefix=@prefix@
# LIB_DIR should be a private place for notes-mode stuff.
LIB_DIR=@datadir@/notes-mode
# EL_DIR should be where your site-specific emacs .el{,c}'s go.
EL_DIR=@lisp_dir@
# INFO_DIR is for emacs info files.
INFO_DIR=@infodir@
INSTALL_INFO=@install_info@
INSTALL_INFO_SECTION=@install_info_section@

# must be perl 5.000 or better.
PERL=@perlbin@
# must be 19 or greater
EMACS=@emacsbin@

MKDIR_P=@mkdir_p@

#
# end of user configurable parameters
#
######################################################################


INSTALLABLE_OTHERS = \
	README \
	sample.notesrc \
	release

OTHERS = \
	COPYING \
	Makefile.in \
	configure \
	configure.in \
	install-sh \
	notes-mode.texi \
	notes-mode.info \
	notes-mode.ps.gz

SCRIPTS = \
	mkall mkindex mkprevnext mkrawindex mkindexcache \
	mkconfig mknew catsubject notesinit setcrontab \
	Notes.pm NotesIndex.pm NotesVars.pm

ELS = \
	notes-variables.el \
	notes-mode.el notes-index-mode.el \
	notes-url.el notes-aux.el \
	notes-emacs.el notes-xemacs.el \
	notes-first.el

ITMP = /tmp/notes-mode

MY_PERL=/usr/bin/perl
MY_LIB_DIR=/home/johnh/NOTES/BIN
MY_EL_DIR=/home/johnh/LIB/EMACS

######################################################################
#
# Compliation stuff.
#

all:
	@echo "nothing required for make; just run \"make install\""


######################################################################
#
# Installation stuff.
#

# install_bins: $(BINS)

install_els: 
	$(MKDIR_P) $(EL_DIR)
	$(MKDIR_P) $(LIB_DIR)
	echo '(setq load-path (cons "$(EL_DIR)" load-path))' >.notes-recompile.el
	echo '(cd "$(EL_DIR)")' >>.notes-recompile.el
	for i in $(ELS); \
	do \
		sed -e 's@$(MY_LIB_DIR)@$(LIB_DIR)@' \
			-e 's@$(MY_EL_DIR)@$(EL_DIR)@' \
			-e 's@$(MY_LIB_DIR)@$(LIB_DIR)@' < $$i >$(EL_DIR)/$$i; \
		echo '(byte-compile-file "'$$i'")' >>.notes-recompile.el; \
	done
	@echo Warnings in the elisp compilation can be ignored.
	$(EMACS) -q -batch -l .notes-recompile.el

install_scripts:
	for i in $(SCRIPTS); \
	do \
		sed -e 's@$(MY_PERL)@$(PERL)@' \
			-e 's@$(MY_EL_DIR)@$(EL_DIR)@' \
			-e 's@$(MY_LIB_DIR)@$(LIB_DIR)@' < $$i >$(LIB_DIR)/$$i; \
		chmod +x $(LIB_DIR)/$$i; \
	done

install_others:
	cp $(INSTALLABLE_OTHERS) $(LIB_DIR)

install_info:
	$(MKDIR_P) $(INFO_DIR)
	cp notes-mode.info $(INFO_DIR)/notes-mode
	if test x$(INSTALL_INFO) = xno; \
	then \
		 echo 'You must manually add notes mode to your info "dir" file.'; \
	else \
		$(INSTALL_INFO) $(INSTALL_INFO_SECTION) --info-file=notes-mode.info --dir-file=$(INFO_DIR)/dir; \
	fi


install_whatnext:
	@echo "Once notes-mode is installed, start it by running emacs,"
	@echo "and then do M-x load-library RET notes-mode RET."
	@echo "Or run   info notes-mode   to read the manual."


install: install_els install_scripts install_others install_info install_whatnext
	@echo Notes-mode is installed.


######################################################################
#
# Documentation stuff.
#

notes-mode.info: notes-mode.texi
	makeinfo notes-mode.texi

notes-mode.dvi: notes-mode.texi
	texi2dvi notes-mode.texi

notes-mode.ps.gz: notes-mode.dvi notes-mode.texi
	dvips -f notes-mode.dvi |gzip >notes-mode.ps.gz

html:
	test -d HTML || mkdir HTML
	( cd HTML; texi2html -split_chapter ../notes-mode.texi )
	( cd HTML; texi2html -monolithic ../notes-mode.texi )

texi: notes-mode.info notes-mode.dvi notes-mode.ps.gz html

# Install_www is only for me.
WWW_DIR=$$HOME/WORKING/JOHNH_WWW/SOFTWARE/NOTES_MODE
install_www: texi
	cp HTML/*.html $(WWW_DIR)
	cp notes-mode.ps.gz $(WWW_DIR)
	cp notes-mode-`cat release`.tar.gz $(WWW_DIR)

######################################################################
#
# Release stuff.
#

tar.gz: texi
	$(MKDIR_P) $(ITMP)-`cat release`
	cp $(INSTALLABLE_OTHERS) $(OTHERS)  $(ITMP)-`cat release`
	mkdir $(ITMP)-`cat release`/HTML
	cp -R HTML/.  $(ITMP)-`cat release`/HTML
	cp $(SCRIPTS)  $(ITMP)-`cat release`
#	cp $(SRCS)  $(ITMP)-`cat release`
	for i in $(ELS); do cp $$i $(ITMP)-`cat release`; done
#	cp -r SAMPLE  $(ITMP)-`cat release`
#	echo "dir: $(ITMP)-`cat release`/SAMPLE" >$(ITMP)/notesrc
#	( NOTESRC=$(ITMP)-`cat release`/notesrc; export NOTESRC;  $(ITMP)-`cat release`/mkall )
	( cd /tmp; tar cvf - ./notes-mode-* ) | gzip >notes-mode-`cat release`.tar.gz
	rm -rf $(ITMP)-`cat release`/HTML
	rm -f $(ITMP)-`cat release`/*
	rmdir $(ITMP)-`cat release`

tar.gz.uu: tar.gz
	uuencode notes-mode-`cat release`.tar.gz <notes-mode-`cat release`.tar.gz >notes-mode-`cat release`.tar.gz.uu

RELEASE_DIR=$$HOME/WORKING/JOHNH_WWW/SOFTWARE/NOTES_MODE

copy_release:
	cp notes-mode-`cat release`.tar.gz $(RELEASE_DIR)
	mv notes-mode-`cat release`.tar.gz RELEASES
	cp HTML/notes-mode/* $(RELEASE_DIR)
	cp HTML/notes-mode.html $(RELEASE_DIR)

