# Makefile generated by imake - do not edit!
# $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $

##################### Generic Header ######################################
# $Id: Imake.tmpl,v 1.24 1993/05/29 19:59:33 queinnec Exp $

# Define commands and other parameters specific to site:

##################### Generic Site Parameters #############################
# $Id: Site.def,v 1.14 1993/06/02 20:47:39 queinnec Exp $

HOME   		= /usr/users/queinnec
HOST		= blaye
HOSTTYPE	= news_mips

LATEX		= latex
BIBTEX		= bibtex
DELATEX		= detex -l
MAKEINDEX	= makeindex
SPELL		= ispell -l
EPELLE		= epelle -latex
PACK		= compress
UNPACK		= uncompress
RM		= rm -f
CC		= cc
MAKE            = make
DVIPS           = dvips

SCCDIR          = /usr/local/lib/schemetoc
SCC             = /usr/local/bin/scc
SCI             = /usr/local/bin/sci

SCCsubCFLAGS    = -Dsony_news -DSONYNEWS -Ur3000
CFLAGS          = -O -Olimit 1600
PRINT           = print
INSTALL         = install -c
FLOPPYDIR       = /fd
CVSROOT         = /CVS.src/master

# The generic rules that hold everywhere. They mainly concern
# concern TeX generation which is a not naive task given the
# circular constraints that exist.
.SUFFIXES: .epelle .spell .ind .idx .dvi .bbl .aux .tex .bk

.tex.dvi: ;	${LATEX} $*.tex
.tex.aux: ;	${LATEX} $*.tex
.tex.bbl: ;	-${BIBTEX} $*
.idx.ind: ;	${MAKEINDEX} $*
.tex.spell: ;	${DELATEX} $*.tex | ${SPELL} | sort -u >$*.spell
.tex.epelle:
	DICOPLUS=${HOME}/.dicoplus.z ${EPELLE} $*.tex >$*.epelle

# Default entry for the LiSP2TeX tool
LiSP2TeXFLAGS   = -vU -I/usr/local/lib/LiSP2TeX
.SUFFIXES: .tex .bk
.bk.tex : ;     LiSP2TeX ${LiSP2TeXFLAGS} -- $*.bk > $*.tex

###########################################################################
# $Id: Imake.rules,v 1.16 1993/01/22 18:13:39 queinnec Exp $

###################### Specific entries ###################################

# $Id: Imakefile,v 1.9 1993/09/07 07:53:49 queinnec Exp $
# The Imakefile of LiSP2TeX (can also serve as a direct Makefile)

# By default, regenerate everything in the o/HOSTTYPE directory
# and install the result in the usual directories  (see below).
MAKEOPTIONS	= 	"SCM=${SCM}" "HOSTTYPE=${HOSTTYPE}"
work :
	@if [ X${SCM} = X ] ; then \
		echo "	Read the Imakefile and choose SCM please. "	;\
		exit 1 ; else : ; fi
	@if [ X${HOSTTYPE} = X ] ; then make work ${MAKEOPTIONS} ; else : ; fi
	@echo "	Binary files will go in o/${HOSTTYPE}/"
	@echo "	and I will use ${SCM} as Scheme compiler."
	@echo
	make mkdir ${MAKEOPTIONS}
	make o/${HOSTTYPE}/${SCM}.LiSP2TeX ${MAKEOPTIONS}
	@echo
	@echo "	Testing the new o/${HOSTTYPE}/${SCM}.LiSP2TeX..."
	make test ${MAKEOPTIONS}
	@echo
	@echo -n " Do you want to install LiSP2TeX (yes,no)[n]? "
	@read ans ; case X$$ans in X[yY]*) 		\
		echo "	Installing LiSP2TeX..."		;\
		make install ${MAKEOPTIONS}		;;\
	    *) echo "	Binary left in o/${HOSTTYPE}/${SCM}.LiSP2TeX" ;; esac
	@echo "	Everything seems OK! Happy LiSP2TeX'ing..."

##############################################################################
# An useful default rule to convert a bk file into a TeX file.
# Insert it in your own makefiles (or Imakefiles).

LiSP2TeX	= ${BINDIR}/LiSP2TeX
LiSP2TeXFLAGS	= -v -I${DOCDIR}

.SUFFIXES: .tex .bk
.bk.tex : ;	${LiSP2TeX} ${LiSP2TeXFLAGS} -- $*.bk > $*.tex

############### Public Install procedure ######################################
### You must probably be root to make the final installation.
MANEXTENSION	= 1
MANDIR		= /usr/man/man${MANEXTENSION}
BINDIR		= /usr/local/bin
DOCDIR		= /usr/local/lib/LiSP2TeX
STYDIR		= /usr/local/lib/tex/inputs
INSTALL		= install -c

# Choose your Scheme compiler among {s2c,bigloo}
#SCM		= s2c
#SCM		= bigloo

install : o/${HOSTTYPE}/${SCM}.LiSP2TeX
	@echo
	@echo '	This may fail if you are not root !'
	@echo
	${INSTALL} -s o/${HOSTTYPE}/${SCM}.LiSP2TeX ${BINDIR}/LiSP2TeX
	${INSTALL} LiSP2TeX.1   ${MANDIR}/LiSP2TeX.${MANEXTENSION}
	${INSTALL} LiSP2TeX.sty ${STYDIR}
	-mkdir ${DOCDIR}
	${INSTALL} LiSP2TeX.bk  ${DOCDIR}
	${INSTALL} LiSP2TeX.dvi ${DOCDIR}
	${INSTALL} README       ${DOCDIR}
	for f in *.mkgreek ; do ${INSTALL} $$f ${DOCDIR} ; done

################ End of public entries ########################################

### PORT Note: If you have Scheme->C just use this
#FINDER		= find-string.scm
### Otherwise use the already expanded version of the previous file:
### This is provided since macros are not standard enough.
#FINDER 	= look.scm
### But if you have Bigloo, use this one:
#FINDER		= find-string.bgl

### PORT Note: Dependencies are gathered in files: port-${SCM}.scm
### SCM can be {s2c,bigloo}.
PORT 	= port-${SCM}.scm

### The sources: Before them must be loaded the PORT prologue and after them
### must be loaded the FINDER file.
LiSPsources =  	util.scm		\
		read-objects.scm	\
		read.scm		\
	    	scan-objects.scm	\
		scan-file.scm		\
		emit.scm		\
		pp.scm			\
	  	commands.scm		\
		version.scm

### The documentation:
LiSPdocs    = 	LiSP2TeX.sty		\
		LiSP2TeX.bk		\
	    	LiSP2TeX.tex		\
		LiSP2TeX.bbl		\
		LiSP2TeX.dvi		\
		LiSP2TeX.ps		\
	   	LiSP2TeX.1		\
		reading.test		\
		README

### Some customization files for example
LiSPcustom  =	default.mkgreek		\
		number.mkgreek		\
		pp.mkgreek		\
		qnc.mkgreek

### The files to include in the distribution:
LiSPallFiles =  Imakefile		\
		Makefile		\
		port-s2c.scm		\
		port-bigloo.scm		\
		${LiSPsources}		\
		find-string.scm		\
		find-string.bgl		\
		look.scm		\
		${LiSPdocs}		\
		${LiSPcustom}
#add other ports, contrib ?????????????????????

############### Generate directories for binaries
# create subdirectories to store binaries
mkdir :
	-mkdir o
	-mkdir o/${HOSTTYPE}

# these files must be present for the installation.
install : 	LiSP2TeX.1 LiSP2TeX.sty README		\
		LiSP2TeX.bk LiSP2TeX.tex LiSP2TeX.dvi	\
		default.mkgreek number.mkgreek

################################################################################
############### This generation is adapted to Scheme->C
### The distributed version uses Scheme->C from Joel Bartlett.
### Adjust these paths if your Scheme->C is not there:
SCC  		= /usr/local/bin/scc -schf 14
SCI  		= /usr/local/bin/sci
S2CDIR 		= /usr/local/schemetoc

s2c_sources	= port-s2c.scm ${LiSPsources} find-string.scm

# Gather all files in a single module to simplify linking (if not
# compilation time :).
o/${HOSTTYPE}/LiSP2TeX.sc : ${s2c_sources}
	( echo "(module lisp2tex (main unix-main))"	;\
	  for f in ${s2c_sources}			;\
	  do echo "(include \"$$f\")" 			;\
	  done ) 				> o/${HOSTTYPE}/LiSP2TeX.sc

# Takes 200 seconds on a Sony News3200 (20MHz 1 MIPS)
o/${HOSTTYPE}/look.scm \
o/${HOSTTYPE}/s2c.LiSP2TeX : ${s2c_sources} o/${HOSTTYPE}/LiSP2TeX.sc
	cd o/${HOSTTYPE} ; ${SCC} -O -o s2c.LiSP2TeX -I ../.. LiSP2TeX.sc
	if cmp look.scm o/${HOSTTYPE}/look.scm ; then : ;\
	else mv o/${HOSTTYPE}/look.scm . ; fi

#################################################################################
############### This generation is adapted to Bigloo
# Gather all files in a single module to simplify linking (if not
# compilation time :).  The produced executable is named bigloo.LiSP2TeX.
CFLAGS		= -O
CC		= gcc
BIGLOO		= bigloo
BIGLOODIR	= /usr/local/lib/bigloo/1.4
BIGLOOFLAGS	= -O2
bigloo_sources	= port-bigloo.scm ${LiSPsources} find-string.bgl

o/${HOSTTYPE}/bigloo.LiSP2TeX.bgl : ${bigloo_sources}
	( echo "(module lisp2tex (export (unix-main args))"	;\
	  for f in ${bigloo_sources}				;\
	  do echo "(include \"../../$$f\")"			;\
	  done ; echo ")" )		> o/${HOSTTYPE}/bigloo.LiSP2TeX.bgl

o/${HOSTTYPE}/bigloo.LiSP2TeX.c : ${bigloo_sources}
o/${HOSTTYPE}/bigloo.LiSP2TeX.c : o/${HOSTTYPE}/bigloo.LiSP2TeX.bgl
	cd o/${HOSTTYPE} ; \
		${BIGLOO} ${BIGLOOFLAGS} -C+ \
		-o bigloo.LiSP2TeX.c bigloo.LiSP2TeX.bgl
o/${HOSTTYPE}/bigloo.LiSP2TeX.o : o/${HOSTTYPE}/bigloo.LiSP2TeX.c
	cd o/${HOSTTYPE} ; \
	  	${CC} ${CFLAGS} -c -o bigloo.LiSP2TeX.o -I${BIGLOODIR} \
		bigloo.LiSP2TeX.c
o/${HOSTTYPE}/main.bgl :
	@echo "(module main (main start)			\
(import (unix-main lisp2tex \"bigloo.LiSP2TeX.bgl\"))	\
(with lisp2tex) )					\
(define (start args) (unix-main args))"  > o/${HOSTTYPE}/main.bgl
o/${HOSTTYPE}/bigloo.LiSP2TeX : o/${HOSTTYPE}/main.bgl
o/${HOSTTYPE}/bigloo.LiSP2TeX : o/${HOSTTYPE}/bigloo.LiSP2TeX.o
	cd o/${HOSTTYPE} ; \
		${BIGLOO} ${BIGLOOFLAGS} -o bigloo.LiSP2TeX main.bgl
# Cut the compilation into two parts to avoid virtual memory exhaustion on
# my Sony portable.

############### Obtaining the documentation
# These entries use the installed LiSP2TeX
LiSP2TeX.tex : LiSP2TeX.bk version.scm
	${LiSP2TeX} ${LiSP2TeXFLAGS} -- LiSP2TeX.bk > LiSP2TeX.tex
LiSP2TeX.dvi : LiSP2TeX.tex LiSP2TeX.sty
	latex  LiSP2TeX.tex
	bibtex LiSP2TeX
	latex  LiSP2TeX.tex
	latex  LiSP2TeX.tex
LiSP2TeX.ps : LiSP2TeX.dvi
	dvips LiSP2TeX.dvi -o LiSP2TeX.ps
LiSP2TeX.spell : LiSP2TeX.tex
	delatex LiSP2TeX.tex | ispell -l | sort -u > LiSP2TeX.spell

############### Print the readable files
PRINT 		= print
PRDVI 		= prdvi
print : print.sources print.man print.dvi
print.sources :
	${PRINT} ${LiSPsources}
print.dvi : LiSP2TeX.dvi
	${PRDVI} LiSP2TeX.dvi
print.man :
	man LiSP2TeX | colcrt - | ${PRINT}

############### Tags
TAGS-MAKER      = etags -t
tags : ;	${TAGS-MAKER} *.scm

################################################################################
############### Test compiled LiSP2TeX
# Test the fresh LiSP2TeX.
test :
	@echo "	Regenerate documentation ..."
	time o/${HOSTTYPE}/${SCM}.LiSP2TeX ${LiSP2TeXFLAGS} -- LiSP2TeX.bk \
		> o/${HOSTTYPE}/LiSP2TeX.tex
	@echo "	Compare with reference ..."
	if [ -r LiSP2TeX.tex ]  				;\
	then diff o/${HOSTTYPE}/LiSP2TeX.tex LiSP2TeX.tex 	;\
	fi

################################################################################
############### Test with interpreter Scheme->C
test.read.sci :
	@( for f in ${s2c_sources}			;\
	   do echo "(load \"$$f\")" 			;\
	      done					;\
	   echo "(test-read \"reading.test\")"		) | ${SCI}

interp.sci :
	@( for f in ${s2c_sources}			;\
	   do echo "(load \"$$f\")" 			;\
	      done					;\
	   echo "(unix-main '(sci))" 	; tee ) | ${SCI}

TEST_OPTIONS	= 	\"-v\" \"--\" \"LiSP2TeX.bk\"
test.interp.sci :
	@( for f in ${s2c_sources}					;\
	   do echo "(load \"$$f\")" 					;\
	      done							;\
	   echo "(LiSP2TeX '(${TEST_OPTIONS}))"	 			;\
	   tee ) | ${SCI}

################################################################################
############### Test with interpreter Bigloo
test.read.bgl :
	@( for f in ${bigloo_sources}			;\
	   do echo "(load \"$$f\")" 			;\
	      done					;\
	   echo "(test-read \"reading.test\")"		) | ${BIGLOO}

interp.bgl :
	@( for f in ${bigloo_sources}			;\
	   do echo "(load \"$$f\")" 			;\
	      done					;\
	   echo "(unix-main '(bgl))" 	; tee ) | ${BIGLOO}

tmp.interp.bgl :
	@( for f in ${bigloo_sources}			;\
	   do echo "(load \"$$f\")" 			;\
	      done					;\
	   echo "(unix-main '(bgl))" )
	${BIGLOO}

test.interp.bgl :
	@( for f in ${bigloo_sources}					;\
	   do echo "(load \"$$f\")" 					;\
	      done							;\
	   echo "(LiSP2TeX '(${TEST_OPTIONS}))"	 			;\
	   tee ) | ${BIGLOO}

################################################################################
############### Making Distribution
DIST_DIR	= LiSP2TeX
LiSP2TeX.tar : ${LiSPallFiles}
	-mkdir ${DIST_DIR}
	cp -p ${LiSPallFiles} ${DIST_DIR}
	chmod ug=rw,o=r ${DIST_DIR}/?*
	tar -cvf LiSP2TeX.tar ${DIST_DIR}
	rm -rf ${DIST_DIR}
LiSP2TeX.tar.Z : LiSP2TeX.tar
	compress -f LiSP2TeX.tar

distribution :
	@echo Check that all files are checked-in wrt CVS
	make notci
	@echo -n "m ckpt (yes,no)[n]? "
	@read ans ; case X$$ans in X[yY]*) m ckpt ;; *) : ;; esac
	-rm -f version.scm
	make version.scm
	make LiSP2TeX.dvi
	cvs tag `date +LiSP2TeX%y%h%d`
	make LiSP2TeX.tar.Z
	mv LiSP2TeX.tar.Z `date +LiSP2TeX%y%h%d.tar.Z`

version.scm :
	echo ";;; Automatically generated, do not touch!!!"	> version.scm
	date "+(define version \"%y%h%d\")"			>> version.scm
	chmod a=r version.scm

############### Clean
clean :: cleanMakefile cleantex
	-rm TAGS
	-rm o/${HOSTTYPE}/SC-TO-C*
	-rm -rf LiSP2TeX*.tar* LiSP2TeX
clean.all : clean
	-rm -rf o/$HOSTTYPE} LiSP2TeX.dvi LiSP2TeX*.tar.Z LiSP2TeX.tex
	-rm look.scm version.scm

# end of Imakefile

###################### Generic entries ####################################
# The generic entries that must be everywhere;
PROMPT	=	">>>>>>>>>>>>>>>>>"

# This one does nothing
nothing :

# Check-in back all files that are checked-out whether RCS or CVS
ckpt ::
	@perl ${HOME}/perl/ckpt.prl .

# Sanitize with respect to RCS or CVS (faster than old.notci)
notci sanitize ::
	@perl ${HOME}/perl/sanitize.prl .

# Erase useless files
clean ::
	-${RM} core *.BAK *~ .*.BAK .*~

# Erase useless files in a Tex, LaTeX, BibTeX contexts
cleantex ::
	-${RM} *.log *.aux *.lof *.lot *.toc
	-${RM} *.blg *.bbl
	-${RM} *.idx *.ilg *.ind
	-${RM} *.spell *.epelle
cleandvi ::
	-${RM} *.dvi

# This entry maps a make entry on all subdirectories, the work to be
# done is held in the MAPWORK variable
MAPWORK=clean
mapdirectories ::
	@for d in `ls -F | sed -e '/\/\$$/s,.\$$,,p' -e d` 	; \
	do ( cd $$d 						; \
	     echo "			on $$d: m ${MAPWORK}" 	; \
	     m ${MAKEFLAGS} "${MAPWORK}" ) 			; \
	done

# This entry compresses all not yet compressed files of a directory. The
# makefile is not compressed in order to ease the reverse action.
compress ::
	@for f in `ls -AF`					; \
	 do case $$f in *[mM]akefile|*/|*.Z) :			;; \
                        *) echo ${PACK} $$f ; ${PACK} $$f	;; \
            esac						; \
         done

# Generate a PS and compress it. Do not force the regeneration of the
# original dvi file! The file is specified by the variable FILE.
FILE	= no-specified-file
${FILE}.Z : ${FILE}
	@perl ${HOME}/perl/coherent.prl ${FILE} ${FILE}.Z \
		"${PACK} -c ${FILE} 	> ${FILE}.Z"
${FILE}.ps ::
	@perl ${HOME}/perl/coherent.prl ${FILE}.dvi ${FILE}.ps \
		"${DVIPS} ${FILE}.dvi -o ${FILE}.ps"

# This entry regenerates Makefile if necessary
IMAKECONFIGFILES=${HOME}/config/Imake.rules \
		${HOME}/config/Imake.tmpl \
		${HOME}/config/Site.def
Makefile : Imakefile ${IMAKECONFIGFILES}
	-@chmod u+w Makefile
	@imake -I$$HOME/config -DFullHomeDir=$$HOME 			\
		-DShortHostName=$$SITE -DCodedHostType=$$HOSTTYPE	\
		-DSITE_$$SITE -DHOSTTYPE_$$HOSTTYPE
	@chmod a=r Makefile

# This entry removes the generated Makefile.
# Usually one uses it as                clean :: cleanMakefile
cleanMakefile :
	-@if [ -f Imakefile ] ; then ${RM} -f Makefile ; fi

