# Makefile for the TeXPS software package which includes a new DVI to PostScript
# driver and programs to generate TFM files for PostScript fonts.

# Author:
# Stephan v. Bechtolsheim
# 2119 Old Oak Drive
# West Lafayette, IN 47907
# (317) 463 0162
# svb@cs.purdue.edu

# Copyright: see the documentation! The software's copyright
# is in the GNU (Free Software Foundation) spirit!

# To install the software do the following:
# (a) Print out file setup/local-defs.
# (b) Change setup/Makefile and setup/local-defs,
# (c) Do a "make World".
# (d) Do a "make doc-all".
# (d) Do a "make install" (probably as superuser).
#     You should have about 7MB of space for the compilation of the whole
#     software.

# The following goals in this makefile are important:
# World: make everything (WITHOUT the documentation though)
# doc-all: do the whole documentation processing.
# doc-print: print documentation, after a make doc-all.
# install: after a make all install all the software (irrelevant for the
#	documentation)

World:
	@echo -n 'Make World: start time is: '
	@date
	@echo	'Executing a "make World". Will process everything, excluding'
	@echo	'the documentation. You should consider doing a make clean first,'
	@echo	'so everything is recomputed from scratch!'
	make prepare
	cd setup; make all
	@echo -n 'Make World: end time is: '
	@date

# Do a make World after you cleaned up everything, AND print the documentation.
WorldWorld:
	@make clean
	@make World 1>ERRS 2>&1
	@make doc-all 1>>ERRS 2>&1

prepare::
	-if [ ! -r setup/makefile ] ; then co -l setup/makefile ; cd setup; make co; fi

all install print lint prepare relink doc::
	cd setup; make $@

# "make depend" is followed by "make prepare" to remake all
# Makefiles.
depend:
	cd setup; make $@
	make prepare

# There are cases where all we are interested in is the library which
# is part of this software and some other few things.
# This is done through calling this goal.
lib-etc:
	make prepare
	cd lib; make all
	cd otherc; make all
	cd sup; make relink install

doc-all:
	make doc-dvi-2
	make doc-ps
	make doc-print

doc-dvi doc-c-dvi doc-dvi-2 doc-ps doc-print:
	cd doc; make $@

clean::
	make prepare
	cd setup; make $@
	@echo make clean in `pwd`
	rm -f ,* \#* *.BAK *.bak *.CKP *~ *.o *.tmp ERR* a.out core
	rm -f .emacs_* lint ,* .,* *.dvi *.aux *.log *.toc *.lof *.lot
	rm -f dvitype.out texspell.out .*~ TAGS
	find . -name 'Makefile' -print -exec rm -f {} \;
