# Project: Documentation Tools # Descr: Latex --> MAN-page (groff -man), Makefile # Author: Dr. Jürgen Vollmer, Juergen.Vollmer@informatik-vollmer.de # $Id: Makefile,v 1.110 2010/12/22 12:46:25 vollmer Exp $ BASE = latex2man #-------- user configuration section BIN_DIR = $(HOME)/bin MAN_DIR = $(HOME)/man HTML_DIR = $(HOME)/public_html INFO_DIR = $(HOME)/info TEX_DIR = $(HOME)/tex/inputs CFG_DIR = $(HOME)/tex/inputs #-------- end of user configuration section DATE = `date +%Y-%m-%d` DATE2 = `date +%Y/%m/%d` TAR_BAK = $(BASE)-$(DATE)-backup.tar.gz TAR_SRC = $(BASE)-$(DATE)-source.tar.gz TAR_DIST = $(BASE)-$(VERSION).tar.gz EX = --exclude "*.o" --exclude core --exclude "*.tar.gz" --exclude "*~" \ --exclude "*.a" --exclude "*.php" EXrcs = $(EX) --exclude "*/RCS/*" --exclude "*/RCS" VERSION = 1.24 V_DATE = 2010/12/22 latex2man = ./latex2man D = $ HOMEPAGE = $(HOME)/Privat/informatik-vollmer/software .PHONY: all clean realclean diff backup src-tar #.SUFFIXES: .tex .html .ps .info .texi .txt all: $(BASE).1 $(BASE).html $(BASE).texi $(BASE).info $(BASE).txt $(BASE).pdf latex2man-CHANGES.html $(MAKE) clean %.ps: %.tex latex $*.tex latex $*.tex dvips -o $*.ps $*.dvi %.pdf: %.tex rm -f /tmp/$*.tex /tmp/$*.pdf /tmp/$*.aux /tmp/$*.toc /tmp/$*.log /tmp/$*.sty (cp $*.tex $*.sty /tmp && \ cd /tmp && \ pdflatex $*.tex && \ pdflatex $*.tex); mv /tmp/$*.pdf . %.info: %.texi makeinfo $*.texi %.txt: %.1 groff -t -man -Tlatin1 $*.1 | \ sed -e 's/.//g' \ -e 's/7|//g' \ -e 's/[6-9]//g' \ -e 's///g' \ -e 's/­$$/- /' > $*.txt %.1: %.tex $(latex2man) -M $*.tex $*.1 %.html: %.tex $(latex2man) -H -c $*.css $*.tex $*.html %.texi: %.tex $(latex2man) -T $*.tex $*.texi latex2man-CHANGES.html: CHANGES @( \ echo ""; \ echo ""; \ echo ""; \ echo "Changefile of LaTeX2HTML"; \ echo "
";						\
	 sed -e's/&/\&/g' -e's/>/\>/g' -e's/";						\
	) > latex2man-CHANGES.html

CHANGES.pre.html: CHANGES
	 sed -e's/&/\&/g' -e's/>/\>/g' -e's/ CHANGES.pre.html;	\

$(BASE).php: $(BASE).php.src Makefile CHANGES.pre.html
	 sed < $(BASE).php.src 				\
	     -e "s|@VERSION@|$(VERSION)|g"		\
	     -e "s|@DATE@|$(V_DATE)|g"			\
	     -e "/@CHANGELOG@/r CHANGES.pre.html"	\
	     -e "/^@.*@$$/d"				\
	     -e "s|$(BASE).src|$(BASE)|g"		\
	     -e "s|$(D)\(Id: $(BASE),v .*\) $(D)|\1|g" |\
	 sed  -e "/$(D)Id: CHANGES,v/d"			\
	 > $(BASE).php
	rm -f CHANGES.pre.html

latex2man-html.php: latex2man.html Makefile
	@ (echo '';							\
	   sed < latex2man.html 					\
	    -e "1,//d"					\
	    -e "s/ align=center//g"					\
	    -e "/<\/body>/d"						\
	    -e "/<\/html>/d";						\
	   echo '';	\
	  ) > latex2man-html.php

latex2man-text.php: latex2man.txt Makefile
	@ (echo '';								\
	   echo '

LaTeX2MAN
plain text / UNIX-man

'; \ echo ''; \ cat latex2man.txt | \ sed -e's/&/\&/g' -e's/>/\>/g' -e's/'; \ echo ''; \ ) > latex2man-text.php homepage: latex2man.pdf latex2man.txt latex2man.php latex2man-html.php latex2man-CHANGES.html latex2man-text.php latex2man.info cp -fp $(TAR_DIST) latex2man.pdf latex2man*.php latex2man.info latex2man-CHANGES.html latex2man.css $(HOMEPAGE) rm -f *.php install: realclean all @echo @if [ ! -f $(INFO_DIR)/dir ]; \ then \ (echo ; \ echo ""; \ echo "File: dir Node: Top This is the top of the INFO tree"; \ echo "* Menu: " ) \ > $(INFO_DIR)/dir ; \ fi cp -f $(BASE) $(BIN_DIR) cp -f $(BASE).sty $(TEX_DIR) cp -f $(BASE).cfg $(CFG_DIR) cp -f $(BASE).1 $(MAN_DIR)/man1 cp -f $(BASE).html $(HTML_DIR) cp -f $(BASE).css $(HTML_DIR) cp -f $(BASE).info $(INFO_DIR) install-info $(BASE).info $(INFO_DIR)/dir $(MAKE) clean uninstall: rm -f $(BIN_DIR)/$(BASE) rm -f $(TEX_DIR)/$(BASE).sty rm -f $(CFG_DIR)/$(BASE).cfg rm -f $(MAN_DIR)/man1/$(BASE).1 rm -f $(HTML_DIR)/$(BASE).html rm -f $(HTML_DIR)/$(BASE).css rm -f $(INFO_DIR)/$(BASE).info - install-info --quiet --remove $(BASE).info $(INFO_DIR)/dir src-tar: $(MAKE) realclean all @cd ..; tar $(EXrcs) -czvf $(BASE)/$(TAR_SRC) $(BASE) dist: rm -f THIS-IS-VERSION-* @- co -l latex2man latex2man.tex latex2man.sty README @rm -f .xxx; cp latex2man .xxx @sed < .xxx -e 's/$VERSION = .*/$VERSION = "$(VERSION)";/' > latex2man @rm -f .xxx; cp latex2man.tex .xxx @sed < .xxx -e 's/^\\setVersion{[0-9]*\(\.[0-9]*\)*}/\\setVersion{$(VERSION)}/' \ -e 's|^\\setDate{[0-9]*/[0-9]*/[0-9]*}|\\setDate{$(V_DATE)}|' \ > latex2man.tex @rm -f .xxx; cp latex2man.sty .xxx @sed < .xxx -e 's/^%% VERSION:.*/%% VERSION: $(VERSION)/' \ -e "s|^\(\\\\ProvidesPackage{latex2man}\).*|\1[$(DATE2) v$(VERSION)]|"\ > latex2man.sty rm -f .xxx; cp README .xxx @sed < .xxx -e 's/^VERSION:.*/VERSION: $(VERSION)/' > README @rm -f .xxx ci -u -m"Distribution" latex2man latex2man.tex latex2man.sty README - $(MAKE) realclean all @echo "VERSION $(VERSION) DATE=$(V_DATE)" > THIS-IS-VERSION-$(VERSION) @cd ..; tar $(EXrcs) -czvf $(BASE)/$(TAR_DIST) \ $(BASE)/latex2man \ $(BASE)/latex2man.tex \ $(BASE)/latex2man.cfg \ $(BASE)/latex2man.sty \ $(BASE)/latex2man.trans \ $(BASE)/latex2man.css \ $(BASE)/latex2man.1 \ $(BASE)/latex2man.txt \ $(BASE)/latex2man.html \ $(BASE)/latex2man.texi \ $(BASE)/latex2man.info \ $(BASE)/latex2man.pdf \ $(BASE)/Makefile \ $(BASE)/README \ $(BASE)/INSTALL \ $(BASE)/CHANGES \ $(BASE)/latex2man-CHANGES.html \ $(BASE)/THIS-IS-VERSION-$(VERSION) backup: @ cd ..; tar $(EX) -czvf /tmp/$(TAR_BAK) $(BASE) @ copy-to-backup -al -d $(BASE) /tmp/$(TAR_BAK) @ rm /tmp/$(TAR_BAK) clean: rm -f *~ *.aux *.log *.dvi .xxx *.out realclean: clean rm -f *.ps *.1 *.html *.texi *.info *.txt *.pdf diff: @echo @echo "Check for differences with RCS" @echo for i in RCS/* ; do [ -f `basename $$i ,v` ] && rcsdiff -q $$i; done @echo