mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-19 15:54:18 +00:00
Estimated hours taken: 0.5 doc/Mmake: Add rules for creating a plain text (*.text) version of the manual. Make sure we invoke `texi2html' as `perl texi2html', to avoid a problem with GNU Make 3.74 on Linux.
168 lines
4.3 KiB
Plaintext
168 lines
4.3 KiB
Plaintext
#-----------------------------------------------------------------------------#
|
|
# Copyright (C) 1995 University of Melbourne.
|
|
# This file may only be copied under the terms of the GNU General
|
|
# Public License - see the file COPYING in the Mercury distribution.
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# Mmake - Mmake file for the Mercury documentation.
|
|
|
|
MAIN_TARGET=all
|
|
|
|
MERCURY_DIR=..
|
|
include $(MERCURY_DIR)/Mmake.common
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
TEXI2DVI=texi2dvi
|
|
MAKEINFO=makeinfo
|
|
TEXI2HTML=perl texi2html
|
|
DVIPS=dvips
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.SUFFIXES: .texi .dvi .ps .text
|
|
|
|
.texi.dvi:
|
|
$(TEXI2DVI) $<
|
|
|
|
.texi.text:
|
|
$(MAKEINFO) --no-headers -o $@ $<
|
|
|
|
.dvi.ps:
|
|
$(DVIPS) $<
|
|
|
|
%.html %_toc.html: %.texi
|
|
$(TEXI2HTML) $<
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: all
|
|
all: info dvi html
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: dvi
|
|
dvi: user_guide.dvi reference_manual.dvi library.dvi faq.dvi \
|
|
transition_guide.dvi
|
|
|
|
.PHONY: info
|
|
info: mercury.info mercury_ref.info mercury_user_guide.info \
|
|
mercury_library.info mercury_faq.info mercury_trans_guide.info
|
|
|
|
.PHONY: html
|
|
html: mercury.html user_guide_toc.html reference_manual_toc.html \
|
|
library_toc.html faq_toc.html transition_guide_toc.html
|
|
|
|
.PHONY: ps
|
|
ps: user_guide.ps reference_manual.ps library.ps faq.ps transition_guide.ps
|
|
|
|
.PHONY: text
|
|
text: user_guide.text reference_manual.text library.text faq.text \
|
|
transition_guide.text
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
mercury_user_guide.info: user_guide.texi
|
|
$(MAKEINFO) $<
|
|
mercury_ref.info: reference_manual.texi
|
|
$(MAKEINFO) $<
|
|
mercury_trans_guide.info: transition_guide.texi
|
|
$(MAKEINFO) $<
|
|
mercury_faq.info: faq.texi
|
|
$(MAKEINFO) $<
|
|
mercury_library.info: library.texi
|
|
$(MAKEINFO) $<
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# The following rules automatically build the library documentation
|
|
# by extracting the module interfaces from the library source code.
|
|
|
|
library-menu.texi: $(LIBRARY_DIR)/*.m
|
|
{ \
|
|
echo ""; \
|
|
for file in $(LIBRARY_DIR)/*.m; do \
|
|
echo "* `basename $$file .m`::"; \
|
|
done; \
|
|
} > library-menu.texi
|
|
|
|
library-chapters.texi: $(LIBRARY_DIR)/*.m
|
|
for filename in $(LIBRARY_DIR)/*.m; do \
|
|
file="`basename $$filename .m`"; \
|
|
echo "@node $$file"; \
|
|
echo "@chapter $$file"; \
|
|
echo "@example"; \
|
|
sed -n -e '/:- implementation/q' \
|
|
-e 's/^%----*----% *$$/%--------------------------------------------------%/' \
|
|
-e 's/{/@{/g' \
|
|
-e 's/}/@}/g' \
|
|
-e 'p' \
|
|
"$$filename"; \
|
|
echo "@end example"; \
|
|
echo ""; \
|
|
done > library-chapters.texi
|
|
|
|
library.dvi library_toc.html mercury_library.info: \
|
|
library-menu.texi library-chapters.texi
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: dist
|
|
dist: tar
|
|
|
|
.PHONY: tar
|
|
tar: doc.text.tar.gz doc.ps.tar.gz
|
|
|
|
doc.text.tar.gz: text
|
|
tar -cf - *.text | gzip > doc.text.tar.gz
|
|
|
|
doc.ps.tar.gz: ps
|
|
tar -cf - *.ps | gzip > doc.ps.tar.gz
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: install
|
|
install: install_info install_html install_dvi
|
|
|
|
.PHONY: install_info
|
|
install_info: info
|
|
-[ -d INSTALL_INFO_DIR ] || mkdir -p $(INSTALL_INFO_DIR)
|
|
cp *.info* $(INSTALL_INFO_DIR)
|
|
|
|
.PHONY: install_html
|
|
install_html: html
|
|
-[ -d INSTALL_HTML_DIR ] || mkdir -p $(INSTALL_HTML_DIR)
|
|
cp *.html $(INSTALL_HTML_DIR)
|
|
|
|
.PHONY: install_dvi
|
|
install_dvi: dvi
|
|
-[ -d INSTALL_DVI_DIR ] || mkdir -p $(INSTALL_DVI_DIR)
|
|
cp *.dvi $(INSTALL_DVI_DIR)
|
|
|
|
# The uninstall rule here only removes the info files; the others
|
|
# are removed by the top-level uninstall rule.
|
|
.PHONY: uninstall
|
|
uninstall:
|
|
-cd $(INSTALL_INFO_DIR); rm mercury*.info*
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
clean: distclean clean_texi
|
|
|
|
.PHONY: distclean
|
|
distclean:
|
|
rm -f *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr
|
|
|
|
.PHONY: clean_texi
|
|
clean_texi:
|
|
rm -f library-menu.texi library-chapters.texi
|
|
|
|
realclean: realclean_texi
|
|
|
|
.PHONY: realclean_texi
|
|
realclean_texi:
|
|
rm -f library*.html user_guide*.html reference_manual*.html
|
|
rm -f mercury_*.info* *.dvi
|
|
|
|
#-----------------------------------------------------------------------------#
|