summaryrefslogtreecommitdiff
path: root/web/noweb/src/Makefile.nw
blob: 079a844b09c12aa7fe2898f6daea5d73b453a917 (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
228
I got sick and tired of copying goo for multiple files.
This nonsense is the result.  (Too bad mk isn't everywhere.)
<<script>>=
(cat Makefile.nw; echo ""; notangle -t8 -R'generate chunks' Makefile.nw | sh) | notangle -t8 -
<<*>>=
# Copyright 1995-2018 by Norman Ramsey.  All rights reserved.
# See file COPYRIGHT for more information.
#
# Adjust these two lines for your ANSI C compiler
CC=gcc -ansi -pedantic -O -Wall -Werror
CFLAGS=
# If you have Icon, you should use the Icon versions of the noweb pipeline.
# Set LIBSRC=icon
LIBSRC=awk
# If you have no Icon compiler, but do have icont, make ICONC=icont
ICONC=iconc
ICONT=icont

# BIN is where the commands (notangle, noweave, nountangle, noroots) land
# LIB is where the pieces of the pipes (nt, markup, unmarkup) are stored
# MAN is the root of your local man pages directory
# MANEXT is the extension for your commands' man pages (usually 1 or l)
# MAN7EXT is the extension for the nowebstyle man page (usually 7)
# TEXINPUTS is the directory for TeX macro files
# ELISP is the directory for emacs lisp files, or /dev/null not to install
BIN=/usr/local/noweb
LIB=/usr/local/noweb/lib
MAN=/usr/local/noweb/man
MANEXT=1
MAN7EXT=7
TEXINPUTS=/usr/local/tex/inputs
ELISP=/dev/null

# change WEAVE if you want a different version of noweave to be installed
WEAVE=noweave		

# Stop editing.	 No user-serviceable parts below.
SHELL=/bin/sh
CINAME=
CIMSG=
MANDIR=$(MAN)/man$(MANEXT)
MAN7DIR=$(MAN)/man$(MAN7EXT)
CATDIR=$(MAN)/cat$(MANEXT)
CAT7DIR=$(MAN)/cat$(MAN7EXT)
LIBNAME=$(LIB)
TEXNAME=$(TEXINPUTS)

all: 
	cd c; make "CC=$(CC)" "CFLAGS=$(CFLAGS)" all 
	for i in shell lib xdoc tex; do (cd $$i; make all); done
	cd $(LIBSRC); make "ICONT=$(ICONT)" "ICONC=$(ICONC)" all

FAQ: FAQ.html
	sleep 1; html2ascii FAQ.html > FAQ

FAQ.html: $(HOME)/www/noweb/FAQ.html
	rm -f FAQ.html
	/bin/cp $(HOME)/www/noweb/FAQ.html FAQ.html
	chmod -w FAQ.html

install: install-code install-man install-tex install-elisp
uninstall: uninstall-code uninstall-man uninstall-tex uninstall-elisp
	-rmdir $(BIN) $(LIB) 2>/dev/null || true

install-shell:
	mkdir -p $(BIN) $(LIB)
	<<shell binaries>>
	cp shell/tmac.w $(LIB)

uninstall-shell:
	<<uninstall shell binaries>>
	rm -f $(LIB)/tmac.w

install-code: install-shell
	mkdir -p $(BIN) $(LIB)
	strip c/nt c/markup c/mnt c/finduses c/nwmktemp
	cp c/nt c/markup c/mnt c/finduses c/nwmktemp $(LIB)
	cd $(LIBSRC); make ICONT=$(ICONT) ICONC=$(ICONC) LIB=$(LIB) BIN=$(BIN) install
	cd lib; make LIB=$(LIB) install

uninstall-code: uninstall-shell
	rm -f $(LIB)/nt $(LIB)/markup $(LIB)/mnt $(LIB)/finduses 
	cd $(LIBSRC); make ICONT=$(ICONT) ICONC=$(ICONC) LIB=$(LIB) BIN=$(BIN) uninstall
	cd lib; make LIB=$(LIB) uninstall
@ I do the [[<<shell binaries>>]] before [[$(LIBSRC)]] so that the
Icon version of [[htmltoc]], if present, will overwrite the Perl
version.
@
<<generate chunks>>=
for i in noweb notangle '$(WEAVE)' nountangle nodefs noroots nuweb2noweb cpif htmltoc \
	 noroff
do
  echo '@<<shell binaries@>>='
  echo 'sed "s@|LIBDIR|@$(LIBNAME)@"' "shell/$i" '> $(BIN)/'"$i"
  echo 'chmod +x $(BIN)/'"$i"
  echo '@<<uninstall shell binaries@>>='
  echo 'rm -f $(BIN)/'"$i"
done
for i in toroff
do
  echo '@<<shell binaries@>>='
  echo 'sed "s@|LIBDIR|@$(LIBNAME)@"' "shell/$i" '> $(LIB)/'"$i"
  echo 'chmod +x $(LIB)/'"$i"
  echo '@<<uninstall shell binaries@>>='
  echo 'rm -f $(LIB)/'"$i"
done
<<*>>=
install-man:
	mkdir -p $(MAN) $(MANDIR) $(MAN7DIR)
	<<ordinary pages>>
uninstall-man:
	<<uninstall ordinary pages>>
	-rmdir $(MANDIR) $(MAN7DIR) $(MAN) 2>/dev/null || true
@ 
Slackware no longer uses preformatted compressed pages, just
compressed pages.
<<*>>=
install-gzipped-man:
	mkdir -p $(MAN) $(MANDIR) $(MAN7DIR)
	<<compressed pages>>
<<*>>=
install-preformat-man:
	-echo "Warning: install-preformat-man is obsolete, even on Slackware systems" 1>&2
	mkdir -p $(MAN) $(CATDIR) $(CAT7DIR)
	<<preformatted compressed pages>>
<<generate chunks>>=
NORMALPAGES="cpif nodefs noroots noweb noindex nuweb2noweb notangle noroff sl2h htmltoc"
NORMAL7PAGES="nowebstyle nowebfilters"
LINKPAGES="noweave nountangle"


for i in $NORMALPAGES; do
  echo '@<<ordinary pages@>>='
  echo 'sed -e "s@|LIBDIR|@$(LIBNAME)@" -e "s@|TEXINPUTS|@$(TEXNAME)@"' \
	"xdoc/$i.1" '> $(MANDIR)/'"$i"'.$(MANEXT)'
  echo '@<<uninstall ordinary pages@>>='
  echo 'rm -f $(MANDIR)/'"$i"'.$(MANEXT)'
done
for i in $NORMAL7PAGES; do
  echo '@<<ordinary pages@>>='
  echo 'sed -e "s@|LIBDIR|@$(LIBNAME)@" -e "s@|TEXINPUTS|@$(TEXNAME)@"' \
	"xdoc/$i.7" '> $(MAN7DIR)/'"$i"'.$(MAN7EXT)'
  echo '@<<uninstall ordinary pages@>>='
  echo 'rm -f $(MAN7DIR)/'"$i"'.$(MAN7EXT)'
done

for i in $LINKPAGES; do
  echo '@<<ordinary pages@>>='
  echo 'rm -f $(MANDIR)/'"$i"'.$(MANEXT)'
  echo '(cd $(MANDIR); ln notangle.$(MANEXT)' "$i"'.$(MANEXT))'
  echo '@<<uninstall ordinary pages@>>='
  echo 'rm -f $(MANDIR)/'"$i"'.$(MANEXT)'
done

echo '@<<compressed pages@>>='

for i in $NORMALPAGES; do
  echo 'sed -e "s@|LIBDIR|@$(LIBNAME)@" -e "s@|TEXINPUTS|@$(TEXNAME)@"' \
	"xdoc/$i.1" ' | gzip -9 > $(MANDIR)/'"$i"'.$(MANEXT).gz'
done
for i in $NORMAL7PAGES; do
  echo 'sed -e "s@|LIBDIR|@$(LIBNAME)@" -e "s@|TEXINPUTS|@$(TEXNAME)@"' \
	"xdoc/$i.7" ' | gzip -9 > $(MAN7DIR)/'"$i"'.$(MAN7EXT).gz'
done

for i in $LINKPAGES; do
  echo 'rm -f $(MANDIR)/'"$i"'.$(MANEXT).gz'
  echo '(cd $(MANDIR); ln notangle.$(MANEXT).gz' "$i"'.$(MANEXT).gz)'
done

echo '@<<preformatted compressed pages@>>='

for i in $NORMALPAGES; do
  echo 'sed -e "s@|LIBDIR|@$(LIBNAME)@" -e "s@|TEXINPUTS|@$(TEXNAME)@"' \
	"xdoc/$i.txt" ' | gzip > $(CATDIR)/'"$i"'.$(MANEXT).gz'
done
for i in $NORMAL7PAGES; do
  echo 'sed -e "s@|LIBDIR|@$(LIBNAME)@" -e "s@|TEXINPUTS|@$(TEXNAME)@"' \
	"xdoc/$i.txt" ' | gzip > $(CAT7DIR)/'"$i"'.$(MAN7EXT).gz'
done

for i in $LINKPAGES; do
  echo 'rm -f $(CATDIR)/'"$i"'.$(MANEXT).gz'
  echo '(cd $(CATDIR); ln notangle.$(MANEXT).gz' "$i"'.$(MANEXT).gz)'
done
<<*>>=
install-tex:
	mkdir -p $(TEXINPUTS)
	cp tex/nwmac.tex tex/noweb.sty $(TEXINPUTS)
	-texhash || echo "Program texhash not found or failed"

uninstall-tex:
	rm -f $(TEXINPUTS)/nwmac.tex $(TEXINPUTS)/noweb.sty || true

install-elisp:
	if [ "/dev/null" != "$(ELISP)" ]; then mkdir -p $(ELISP); fi
	cp elisp/noweb-mode.el $(ELISP)

uninstall-elisp:
	rm -f $(ELISP)/noweb-mode.el || true
@ 
<<*>>=
checkin:
	for i in lib tex xdoc; do (cd $$i; make "CINAME=$(CINAME)" "CIMSG=$(CIMSG)" checkin); done
	for i in c icon awk; do (cd $$i; ci -l $(CINAME) $(CIMSG) *.nw Makefile); done
	(cd elisp; ci -l $(CINAME) $(CIMSG) *.el)
	ci -l $(CINAME) $(CIMSG) Makefile.nw INSTALL INSTALL.DOS README FAQ COPYRIGHT nwmake *.nw

source: FAQ
	for i in c shell lib xdoc icon awk tex; do (cd $$i; make CPIF=">" source); done
	sleep 1
	for i in c shell lib xdoc icon awk tex; do (cd $$i; make touch); done
touch:
	touch FAQ
	for i in c shell lib xdoc icon awk tex; do (cd $$i; make touch); done
boot:
	for i in c shell lib xdoc icon awk tex; do (cd $$i; make boot); done
clean:
	for i in c shell lib xdoc icon awk tex; do (cd $$i; make clean); done
	rm -f nwsrcfilter *~ */*~

clobber: clean
	for i in c shell lib xdoc icon awk tex; do (cd $$i; make clobber); done

Makefile: Makefile.nw
	chmod +w Makefile
	notangle -R'script' Makefile.nw | sh > Makefile
	chmod -w Makefile