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)
21MACROSDIR= /usr/share/texmf/tex/generic
22
23# directory for CWEB inputs in @i files
24CWEBINPUTS= /usr/local/lib/cweb
25
26# extension for manual pages ("l" distinguishes local from system stuff)
27MANEXT= l
28#MANEXT= 1
29
30# directory for manual pages (cweb.1 goes here)
31MANDIR= /usr/share/man/man$(MANEXT)
32
33# destination directory for executables; must end in /
34DESTDIR= /usr/local/bin/
35
36# directory for GNU EMACS Lisp code (cweb.el goes here)
37EMACSDIR= /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)
41DESTPREF=c
42
43# Set CCHANGES to comm-foo.ch if you need changes to common.w
44CCHANGES=
45
46# Set TCHANGES to ctang-foo.ch if you need changes to ctangle.w
47TCHANGES=
48
49# Set WCHANGES to cweav-foo.ch if you need changes to cweave.w
50WCHANGES=
51
52# We keep debugging info around, for fun, but most users don't need it
53CFLAGS = -g
54#CFLAGS = -O
55LINKFLAGS = -g
56#LINKFLAGS = -s # for smaller (stripped) executables on many UNIX systems
57
58# What C compiler are you using?
59CC = cc
60
61# RM and CP are used below in case rm and cp are aliased
62RM= /bin/rm
63CP= /bin/cp
64
65# uncomment the second line if you use pdftex to bypass .dvi files
66PDFTEX = dvipdfm
67#PDFTEX = pdftex
68
69##########  You shouldn't have to change anything after this point #######
70
71CWEAVE = ./cweave
72CTANGLE = ./ctangle
73SOURCES = cweave.w common.w ctangle.w
74ALL =  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
110all: ctangle cweave
111
112cautiously: 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
122SAVEctangle.c:
123	$(CP) ctangle.c SAVEctangle.c
124
125SAVEcommon.c:
126	$(CP) common.c SAVEcommon.c
127
128common.c: common.w $(CCHANGES)
129	$(CTANGLE) common $(CCHANGES)
130
131common.o: common.c
132	$(CC) $(CFLAGS) -DCWEBINPUTS=\"$(CWEBINPUTS)\" -c common.c
133
134ctangle: ctangle.o common.o
135	$(CC) $(LINKFLAGS) -o ctangle ctangle.o common.o
136
137ctangle.c: ctangle.w $(TCHANGES)
138	$(CTANGLE) ctangle $(TCHANGES)
139
140cweave: cweave.o common.o
141	$(CC) $(LINKFLAGS) -o cweave cweave.o common.o
142
143cweave.c: cweave.w $(WCHANGES)
144	$(CTANGLE) cweave $(WCHANGES)
145
146doc: $(SOURCES:.w=.dvi)
147
148usermanual: cwebman.tex cwebmac.tex
149	tex cwebman
150
151fullmanual: 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
161clean:
162	$(RM) -f -r *~ *.o common.tex cweave.tex cweave.c ctangle.tex \
163	  *.log *.dvi *.toc *.idx *.scn *.pdf core cweave ctangle
164
165install: 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
184floppy: $(ALL) examples
185	bar cvhf /dev/rfd0 $(ALL) examples
186	bar tvf /dev/rfd0
187	eject
188
189tags: $(ALL)
190	etags -lnone $(ALL)
191
192tarfile: $(ALL) examples
193	tar cvhf /tmp/cweb.tar $(ALL) examples
194	gzip -9 /tmp/cweb.tar
195
196