TUG Unix CD: HTML documentation

Ulrik Vieth TWG-TDS@SHSU.edu
Mon, 26 Feb 1996 11:44:51 +0100


> what files do you put in which directory in a really nice working TDS?

Here's another answer to Sebastian's question.  

Appended below is my first attempt at writing a mostly generic
installation Makefile, which I wrote for mflogo-1.5c in December.
Apart from the 'check-fonts' and 'install-fonts' targets, which 
are very specific to mflogo, most of this should work for any
single-file .dtx package, if you change the variables PACKAGE
and SRCFILES, TEXFILES, DOCFILES appropriately.

Anyone interested in improving this?

Cheers, Ulrik.


## Makefile for the installation of the `mflogo' package:
## 
## Note: this Makefile is *totally unsupported* as it is 
## my first attempt at writing an installation Makefile.
##
## This assumes that you have a TDS-compliant Unix/Web2C
## installation, such as e.g. teTeX and that some common
## Unix utilities like 'cp', 'tar', 'mkdir', or 'test' 
## are available.

## Usage:
##
## say 'make' or 'make all' to unpack the macros and produce
## the documentation
##
## say 'make install' to install everything except the fonts
##
## say 'make install-fonts' to install the fonts if needed


### package specifics (don't change!):

# package name, used in directories
PACKAGE = mflogo

# file names, used in dependencies
SRCFILES = mflogo.dtx mflogo.ins
TEXFILES = mflogo.sty Ulogo.fd
DOCFILES = mflogo.dvi

# install $(FONTARCHIVE), if $(FONT_TO_TRY) isn't found
FONT_TO_TRY = logod10.tfm
FONTARCHIVE = logofont.tar


### customizable variables:

# Where the TeX installation resides:
TEXMF   = /opt/tex/texmf

SRCDIR  = $(TEXMF)/source/latex/$(PACKAGE)
TEXDIR  = $(TEXMF)/tex/latex/$(PACKAGE)
DOCDIR  = $(TEXMF)/doc/latex/misc

FONTDIR = $(TEXMF)/fonts/source/public/$(PACKAGE)
TFMDIR  = $(TEXMF)/fonts/tfm/public/$(PACKAGE)


# How to run LaTeX(2e):
LATEX   = yes | latex
#LATEX   = latex

# How to install the files:
INSTALL = cp -p
#INSTALL = install -c

# How to update the directory database:
TEXHASH = texhash
#TEXHASH = (cd $(TEXMF); ls -R $(TEXMF) > ls-R)

# How to check if the required fonts are installed:
#
KPSEWHICHCMD = kpsewhich tfm $(FONT_TO_TRY)
#KPSEWHICHCMD = kpsewhich $(FONT_TO_TRY)
#KPSEWHICHCMD = find $(TEXMF)/fonts -name "$(FONT_TO_TRY)" -print


### unpack targets:

default: all
all: check-fonts make-sty make-doc

make-sty: $(TEXFILES)
make-doc: $(DOCFILES)
.PHONY: make-sty make-doc

# Procude LaTeX macros:
$(TEXFILES): $(SRCFILES)
	$(LATEX) $(PACKAGE).ins

# Produce documentation:
$(DOCFILES): $(SRCFILES) $(TEXFILES)
	$(LATEX) $(PACKAGE).dtx

# Check if the required fonts are installed:
check-fonts:
	$(KPSEWHICHCMD) > /dev/null || $(MAKE) install-fonts
.PHONY:	check-fonts


### install targets:

install: install-sty install-doc # install-fonts
	$(MAKE) post-install
.PHONY:	install

# Install LaTeX macros:
install-sty: $(TEXFILES)
	test -d $(TEXDIR) || mkdir $(TEXDIR)
	(for f in $(TEXFILES); do $(INSTALL) $$f $(TEXDIR); done)
.PHONY:	install-sty

# Install documentation:
install-doc: $(DOCFILES)
	test -d $(DOCDIR) || mkdir $(DOCDIR)
	(for f in $(DOCFILES); do $(INSTALL) $$f $(DOCDIR); done)
.PHONY:	install-doc

# Install font sources and TFM files:
install-fonts: $(FONTARCHIVE)
	(cd $(TEXMF); tar xvf $(SRCDIR)/$(FONTARCHIVE) )
	$(MAKE) post-install
.PHONY:	install-fonts

# Update the directory database:
post-install:
	$(TEXHASH)
.PHONY:	post-install


### clean targets:

clean: 
	rm -f *.log *.aux *.toc *.lof *.lot *.bbl *.blg 
	rm -f *.idx *.ind *.ilg *.glo *.gls

distclean: clean
	rm -f $(TEXFILES) $(DOCFILES)

uninstall:
	(for f in $(TEXFILES); do rm -f $(TEXDIR)/$$f; done)
	(for f in $(DOCFILES); do rm -f $(DOCDIR)/$$f; done)