summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/support/latex2man/Makefile
blob: 46addf65c52d6b0ff76c033c3511760fdc36a956 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# Project: 	Documentation Tools
# Descr:	Latex -->  MAN-page (groff -man), Makefile
# Author:	Dr. Jürgen Vollmer, Juergen.Vollmer@informatik-vollmer.de
# $Id: Makefile,v 1.121 2017/04/13 14:47:10 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.25
V_DATE		= 2017/04/13
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
	T=/tmp/$*-$$$$; mkdir $$T && \
	(				   \
	 cp $*.tex $*.sty $*.inc $$T  	&& \
	 cd $$T	         		&& \
	 pdflatex $*.tex 		&& \
	 pdflatex $*.tex);		   \
	mv $$T/$*.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 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">";			\
	 echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">";	\
	 echo "<html><head>";							\
	 echo "<title>Changefile of LaTeX2HTML</title>";			\
	 echo "</head><body><pre>";						\
	 sed -e's/&/\&amp;/g' -e's/>/\&gt;/g' -e's/</\&lt;/g' < CHANGES;	\
	 echo "</pre></body><html>";						\
	) > latex2man-CHANGES.html

CHANGES.pre.html: CHANGES
	 sed -e's/&/\&amp;/g' -e's/>/\&gt;/g' -e's/</\&lt;/g' < CHANGES > 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 '<?php';						\
	   echo ' $$prefix    = "..";';					\
           echo ' $$logo      = "abakus.jpg";';				\
	   echo ' $$logo_text = "russischer Abakus";';			\
	   echo ' $$language  = "en";';					\
	   echo ' include "$$prefix/scripts/header.inc"';		\
	   echo '?>';							\
	   sed < latex2man.html 					\
	    -e "1,/<body*/d"						\
            -e "/<h4 align=center>/d"					\
	    -e "s/ align=center//g"					\
	    -e "/<\/body>/d"						\
	    -e "/<\/html>/d";						\
	   echo '<?php include "$$prefix/scripts/footer.inc"?>';	\
	  ) > latex2man-html.php

latex2man-text.php: latex2man.txt Makefile
	@ (echo '<?php';							\
	   echo ' $$prefix    = "..";';						\
           echo ' $$logo      = "abakus.jpg";';					\
	   echo ' $$logo_text = "russischer Abakus";';				\
           echo ' $$langauge  = "en";';						\
	   echo ' include "$$prefix/scripts/header.inc"';			\
	   echo '?>';								\
	   echo '<h1>LaTeX2MAN<br><small>plain text / UNIX-man</small></h1>';	\
	   echo '<pre';							        \
	   echo '     style="border-style:ridge;border-width:2px;">';		\
	   cat  latex2man.txt |						        \
                sed -e's/&/\&amp;/g' -e's/>/\&gt;/g' -e's/</\&lt;/g' ;	 	\
	   echo '</pre>';							\
	   echo '<?php include "$$prefix/scripts/footer.inc"?>';		\
	  ) > 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.inc 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.inc 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