TEXSRC := $(wildcard *.tex)
HTML := $(foreach SRC,$(TEXSRC),$(addprefix $(subst .tex,,$(SRC))/,$(subst .tex,.html,$(SRC))))
PS := $(subst tex,ps,$(TEXSRC))

all: .identifier_save $(PS)

force:
	dbase_maker $(HTML); linker $(HTML); link_back $(HTML);

clean: 
	rm */*.html *.ps identifier.html

.identifier_save: $(HTML)
	dbase_maker $?; linker $?; link_back $?;

# this dependency isn't working.  Don't know why.
$(HTML): %.html: $(notdir $(%.tex)) 
	/usr/local/bin/latex2html -split 0 -link 0 -address 0 -no_navigation -info 0 -t $(notdir $(basename $@)) $(notdir $(subst html,tex,$@)); stable_sub "$(subst target,$(notdir $(subst html,tex,$@)),<hr> <a href=../target>source</a>)" "</body>" $@; stable_sub "$(subst target,$(notdir $(subst html,ps,$@)), <a href=../target>psfile</a>)" "</body>" $@; stable_sub " <A HREF="mailto:jl@crush.caltech.edu">jl@crush.caltech.edu</A>" "</body>" $@; stable_sub " <A HREF="identifier.html">index</A>" "</body>" $@;

%.dvi: %.tex
	latex $<

%.ps: %.dvi
	dvips $< -o $@
