tentative fix for issue 3 (ex 53)
[mplib] / src / texk / web2c / cwebdir / Makefile
1 # This file is part of CWEB.
2 # It is distributed WITHOUT ANY WARRANTY, express or implied.
3 # Version 3.64 --- February 2002
4
5 # Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth
6
7 # Permission is granted to make and distribute verbatim copies of this
8 # document provided that the copyright notice and this permission notice
9 # are preserved on all copies.
10
11 # Permission is granted to copy and distribute modified versions of this
12 # document under the conditions for verbatim copying, provided that the
13 # entire resulting derived work is given a different name and distributed
14 # under the terms of a permission notice identical to this one.
15
16
17 # Read the README file, then edit this file to reflect local conditions
18 #
19
20 # directory for TeX inputs (cwebmac.tex goes here)
21 MACROSDIR= /usr/share/texmf/tex/generic
22
23 # directory for CWEB inputs in @i files
24 CWEBINPUTS= /usr/local/lib/cweb
25
26 # extension for manual pages ("l" distinguishes local from system stuff)
27 MANEXT= l
28 #MANEXT= 1
29
30 # directory for manual pages (cweb.1 goes here)
31 MANDIR= /usr/share/man/man$(MANEXT)
32
33 # destination directory for executables; must end in /
34 DESTDIR= /usr/local/bin/
35
36 # directory for GNU EMACS Lisp code (cweb.el goes here)
37 EMACSDIR= /usr/share/emacs/site-lisp
38
39 # Set DESTPREF to null if you want to call the executables "tangle" and "weave"
40 # (probably NOT a good idea; we recommend leaving DESTPREF=c)
41 DESTPREF=c
42
43 # Set CCHANGES to comm-foo.ch if you need changes to common.w
44 CCHANGES=
45
46 # Set TCHANGES to ctang-foo.ch if you need changes to ctangle.w
47 TCHANGES=
48
49 # Set WCHANGES to cweav-foo.ch if you need changes to cweave.w
50 WCHANGES=
51
52 # We keep debugging info around, for fun, but most users don't need it
53 CFLAGS = -g
54 #CFLAGS = -O
55 LINKFLAGS = -g
56 #LINKFLAGS = -s # for smaller (stripped) executables on many UNIX systems
57
58 # What C compiler are you using?
59 CC = cc
60
61 # RM and CP are used below in case rm and cp are aliased
62 RM= /bin/rm
63 CP= /bin/cp
64
65 # uncomment the second line if you use pdftex to bypass .dvi files
66 PDFTEX = dvipdfm
67 #PDFTEX = pdftex
68
69 ##########  You shouldn't have to change anything after this point #######
70
71 CWEAVE = ./cweave
72 CTANGLE = ./ctangle
73 SOURCES = cweave.w common.w ctangle.w
74 ALL =  common.w ctangle.w cweave.w prod.w \
75         Makefile common.c common.h ctangle.c \
76         cwebman.tex cwebmac.tex comm-vms.ch ctang-vms.ch \
77         cweav-vms.ch comm-man.ch ctang-man.ch cweav-man.ch \
78         comm-pc.ch ctang-pc.ch cweav-pc.ch comm-amiga.ch \
79         comm-bs.ch ctang-bs.ch cweav-bs.ch makefile.bs \
80         comm-ql.ch ctang-ql.ch cweav-ql.ch readme.ql \
81         comm-w32.ch ctang-w32.ch cweav-w32.ch \
82         comm-os2.ch comm-mac.ch cweb.1 cweb.el c++lib.w README
83
84 .SUFFIXES: .dvi .tex .w .pdf
85
86 .w.tex:
87         $(CWEAVE) $*
88
89 .tex.dvi:       
90         tex $<
91
92 .w.dvi:
93         make $*.tex
94         make $*.dvi
95
96 .w.c:
97         $(CTANGLE) $*
98
99 .w.o:
100         make $*.c
101         make $*.o
102
103 .w.pdf:
104         make $*.tex
105         case "$(PDFTEX)" in \
106          dvipdfm ) tex "\let\pdf+ \input $*"; dvipdfm $* ;; \
107          pdftex ) pdftex $* ;; \
108         esac
109
110 all: ctangle cweave
111
112 cautiously: ctangle
113         $(CP) common.c SAVEcommon.c
114         ./ctangle common $(CCHANGES)
115         diff common.c SAVEcommon.c
116         $(RM) SAVEcommon.c
117         $(CP) ctangle.c SAVEctangle.c
118         ./ctangle ctangle $(TCHANGES)
119         diff ctangle.c SAVEctangle.c
120         $(RM) SAVEctangle.c
121
122 SAVEctangle.c:
123         $(CP) ctangle.c SAVEctangle.c
124
125 SAVEcommon.c:
126         $(CP) common.c SAVEcommon.c
127
128 common.c: common.w $(CCHANGES)
129         $(CTANGLE) common $(CCHANGES)
130
131 common.o: common.c
132         $(CC) $(CFLAGS) -DCWEBINPUTS=\"$(CWEBINPUTS)\" -c common.c
133
134 ctangle: ctangle.o common.o
135         $(CC) $(LINKFLAGS) -o ctangle ctangle.o common.o 
136
137 ctangle.c: ctangle.w $(TCHANGES)
138         $(CTANGLE) ctangle $(TCHANGES)
139
140 cweave: cweave.o common.o
141         $(CC) $(LINKFLAGS) -o cweave cweave.o common.o
142
143 cweave.c: cweave.w $(WCHANGES)
144         $(CTANGLE) cweave $(WCHANGES)
145
146 doc: $(SOURCES:.w=.dvi)
147
148 usermanual: cwebman.tex cwebmac.tex
149         tex cwebman
150
151 fullmanual: usermanual $(SOURCES) comm-man.ch ctang-man.ch cweav-man.ch
152         make cweave
153         ./cweave common.w comm-man.ch
154         tex common.tex
155         ./cweave ctangle.w ctang-man.ch
156         tex ctangle.tex
157         ./cweave cweave.w cweav-man.ch
158         tex cweave.tex
159
160 # be sure to leave ctangle.c and common.c for bootstrapping
161 clean:
162         $(RM) -f -r *~ *.o common.tex cweave.tex cweave.c ctangle.tex \
163           *.log *.dvi *.toc *.idx *.scn *.pdf core cweave ctangle
164
165 install: all
166         - mkdir $(DESTDIR)
167         $(CP) cweave $(DESTDIR)$(DESTPREF)weave
168         chmod 755 $(DESTDIR)$(DESTPREF)weave
169         $(CP) ctangle $(DESTDIR)$(DESTPREF)tangle
170         chmod 755 $(DESTDIR)$(DESTPREF)tangle
171         - mkdir $(MANDIR)
172         $(CP) cweb.1 $(MANDIR)/cweb.$(MANEXT)
173         chmod 644 $(MANDIR)/cweb.$(MANEXT)
174         - mkdir $(MACROSDIR)
175         $(CP) cwebmac.tex $(MACROSDIR)
176         chmod 644 $(MACROSDIR)/cwebmac.tex
177         - mkdir $(EMACSDIR)
178         $(CP) cweb.el $(EMACSDIR)
179         chmod 644 $(EMACSDIR)/cweb.el
180         - mkdir $(CWEBINPUTS)
181         $(CP) c++lib.w $(CWEBINPUTS)
182         chmod 644 $(CWEBINPUTS)/c++lib.w
183
184 floppy: $(ALL) examples
185         bar cvhf /dev/rfd0 $(ALL) examples
186         bar tvf /dev/rfd0
187         eject
188
189 tags: $(ALL)
190         etags -lnone $(ALL)
191
192 tarfile: $(ALL) examples
193         tar cvhf /tmp/cweb.tar $(ALL) examples
194         gzip -9 /tmp/cweb.tar
195