-DOCNAME = yacasl2
-SRC = $(DOCNAME).texi
-CSS = style.css
-HTMLDIR = html
-
-MV ?= mv
-CP ?= cp
-MKDIR ?= mkdir
-RMRF ?= rm -rf
-PTEX ?= ptex
-TEXI2DVI ?= texi2dvi
-DVI2PDF ?= dvipdfmx
-MAKEINFO ?= gmakeinfo
-INSTALL ?= install
-INSTALL-INFO ?= ginstall-info
+DOCS := install manual
+
+CSS := style.css
+
+CP := cp
+DVIPDFMX := dvipdfmx
+GZIP := gzip
+INSTALL := install
+INSTALL-INFO := install-info
+MKDIR := mkdir
+RMR := rm -rf
+TEX := ptex
+TEXI2DVI := TEX=ptex texi2dvi
+TEX2DVI_FLAGS = -q --texinfo=@afourpaper
prefix ?= ~
infodir ?= $(prefix)/share/info
-.PHONY: all info htmlnosplit html pdf install-info clean clean-docs clean-tex-tmp
+.PHONY: base all info html htmls pdf install-info uninstall-info clean textmp-clean
-.INTERMEDIATE: $(DOCNAME).dvi
+.INTERMEDIATE: *.dvi
-all: info html htmls pdf
+base: install.txt info html
-info: $(DOCNAME).info
+all: base htmls pdf
-html: $(DOCNAME).html
- $(MV) $< index.html
+info: yacasl2.info
-htmls: $(SRC) $(CSS)
- $(INSTALL) -d $(HTMLDIR)
- $(INSTALL) $(CSS) $(HTMLDIR)/
- $(MAKEINFO) -o $(HTMLDIR) --html --css-ref=$(CSS) $(SRC)
+html: $(addsuffix .html,$(DOCS))
-pdf: $(DOCNAME).pdf
+htmls: $(addsuffix _html,$(DOCS))
-$(DOCNAME).html: $(SRC) $(CSS)
- $(MAKEINFO) -o $@ --no-split --html --css-include=$(CSS) $(SRC)
+pdf: $(addsuffix .pdf,$(DOCS))
-$(DOCNAME).pdf: $(DOCNAME).dvi
- $(DVI2PDF) $^
+yacasl2.info: manual.texi
+ $(MAKEINFO) $(MAKEINFO_FLAGS) $<
-$(DOCNAME).dvi: $(SRC)
- TEX=$(PTEX) $(TEXI2DVI) -q --texinfo=@afourpaper -o $@ $<
- @$(MAKE) clean-tex-tmp
+$(addsuffix .html,$(DOCS)) $(addsuffix _html,$(DOCS)): $(CSS)
-install-info: $(DOCNAME).info
- $(INSTALL) -d $(infodir)
- $(INSTALL) $(DOCNAME).info $(infodir)/$(DOCNAME)
- $(INSTALL-INFO) $(infodir)/$(DOCNAME) $(infodir)/dir
+%.html: %.texi
+ $(MAKEINFO) -o $@ --no-split --html --css-include=$(CSS) $<
+
+%_html: %.texi
+ if test ! -e $@; then $(MKDIR) $@; fi
+ $(CP) $(CSS) $@/
+ $(MAKEINFO) -o $@ --html --css-ref=$(CSS) $<
-uninstall-info: $(DOCNAME).info
- $(INSTALL-INFO) --delete $(infodir)/$(DOCNAME) $(infodir)/dir
- $(RM) $(infodir)/$(DOCNAME)
+%.pdf: %.dvi
+ $(DVIPDFMX) $<
+
+%.txt: %.texi
+ $(MAKEINFO) --no-headers --disable-encoding -o $@ $<
+
+install-info: yacasl2.info
+ $(INSTALL) -d $(infodir)
+ $(INSTALL) $< $(infodir)/
+ $(INSTALL-INFO) $(infodir)/$< $(infodir)/dir
+ $(GZIP) -f $(infodir)/$<
-clean: clean-docs clean-tex-tmp
+uninstall-info:
+ $(INSTALL-INFO) --delete $(infodir)/yacasl2.info $(infodir)/dir
+ $(RM) $(infodir)/yacasl2.info
-clean-docs:
- @$(RMRF) html $(DOCNAME).info $(DOCNAME).pdf index.html
+clean: textmp-clean
+ @$(RMR) *_html *.info *.html *.pdf *.dvi *.txt
-clean-tex-tmp:
- @$(RMRF) $(DOCNAME).aux $(DOCNAME).cp $(DOCNAME).cps $(DOCNAME).fn $(DOCNAME).ky $(DOCNAME).log $(DOCNAME).pg $(DOCNAME).pgs $(DOCNAME).tmp $(DOCNAME).toc $(DOCNAME).tp $(DOCNAME).vr
+textmp-clean:
+ @$(RM) *.aux *.cp *.cps *.fn *.ky *.log *.pg *.pgs *.tmp *.toc *.tp *.vr