summaryrefslogtreecommitdiff
path: root/web/latexspider/webmakefile
blob: 42070774dba6d0a13d56ba62773be857a13f4eaa (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
# Copyright 1989 by Norman Ramsey, Odyssey Research Associates
# To be used for research purposes only
# For more information, see file COPYRIGHT in the parent directory
# Modified by Dave Love, Daresbury Lab (d.love@daresbury.ac.uk) for local 
# setup and to incorporate change files, particularly for LaTeX mods.
# To make LaTeX versions of weave, set WEAVECHANGEFILE=$(MASTER)/weave.ltx 
# and include -DLaTeX in CFLAGS.  To get a version of spider.awk usable for 
# LaTeX or plain, define SPIDERCHANGEFILE=$(MASTER)/spider.ltx and define
# LaTeX=1 so that spider.awk generates LaTeX-compatible webs.  I'm sure all
# this could be tidied up.

#HOME=/home/users0/fx#		# Make no longer inherits environment vars
# (it does inherit env vars on my system!)
THETANGLE=tangle
THEWEAVE=weave
SPIDER=any.spider
WEAVECHANGEFILE=
TANGLECHANGEFILE=
SPIDERCHANGEFILE=

#
DVI=dvi
CFLAGS=-DDEBUG -DSTAT

# CPUTYPE is a grim hack that attempts to solve the problem of multiple
# cpus sharing a file system.  In my environment I have to have different
# copies of object and executable for vax, sun3, next, iris, and other 
# cpu types.  If you will be using Spidery WEB in a homogenous processor
# environment, you can just set CPUTYPE to a constant, or eliminate it 
# entirely.  
#
# In my environment, the 'cputype' program returns a string that
# describes the current processor.  That means that the easiest thing
# for you to do is to define a 'cputype' program that does something
# sensible.  A shell script that says 'echo "vax"' is fine.

#CPUTYPE=`cputype`
CPUTYPE=`arch`

# Change the following three directories to match your installation
#
# the odd placement of # is to prevent any trailing spaces from slipping in

WEBROOT=$(HOME)/ltxspiderweb# 	# root of the WEB source distribution
DEST=$(HOME)/bin#		# place where the executables go
MACROS=$(HOME)/tex/inputs# 	# place where the macros go

MASTER=$(WEBROOT)/master# 	# master source directory
OBDIR=$(MASTER)/$(CPUTYPE)#	# common object files

TANGLESRC=tangle
CTANGLE=ceetangle -I$(MASTER)
CWEAVE=ceeweave -I$(MASTER)
AWKTANGLE=awktangle -I$(MASTER)
COMMONOBJS=$(OBDIR)/common.o $(OBDIR)/pathopen.o
COMMONC=$(MASTER)/common.c $(MASTER)/pathopen.c
COMMONSRC=$(COMMONC) $(MASTER)/spider.awk



# Our purpose is to make tangle and weave

web: tangle weave

tangle: $(COMMONOBJS) $(TANGLESRC).o
	cc $(CFLAGS) -o $(DEST)/$(THETANGLE) $(COMMONOBJS) $(TANGLESRC).o

weave: $(COMMONOBJS) weave.o
	cc $(CFLAGS) -o $(DEST)/$(THEWEAVE) $(COMMONOBJS) weave.o


source: $(TANGLESRC).c $(COMMONSRC) # make tangle.c and common src, then clean
	if [ -f WebMakefile ]; then exit 1; fi  # don't clean the master!
	if [ -f spiderman.tex ]; then exit 1; fi # don't clean the manual
	-rm -f tangle.web weave.* common.* # remove links that may be obsolete
	-rm -f *.unsorted *.list grammar.web outtoks.web scraps.web 
	-rm -f cycle.test spider.slog
	-rm -f *.o *.tex *.toc *.dvi *.log *.makelog *~ *.wlog *.printlog

# Here is how we make the common stuff

$(MASTER)/common.c: $(MASTER)/common.web $(MASTER)/common.ch
	$(CTANGLE) $(MASTER)/common $(MASTER)/common 

$(OBDIR)/common.o: $(MASTER)/common.c
	cc $(CFLAGS) -c $(MASTER)/common.c
	mv common.o $(OBDIR)


$(MASTER)/pathopen.c: $(MASTER)/pathopen.web $(MASTER)/pathopen.ch
	$(CTANGLE) $(MASTER)/pathopen  $(MASTER)/pathopen 
	mv pathopen.h $(MASTER)

$(OBDIR)/pathopen.o: $(MASTER)/pathopen.c
	cc $(CFLAGS) -c $(MASTER)/pathopen.c
	mv pathopen.o $(OBDIR)


## Now we make the tangle and weave source locally

$(TANGLESRC).c: $(MASTER)/$(TANGLESRC).web $(MASTER)/common.h grammar.web \
  $(TANGLECHANGEFILE)
	-/bin/rm -f $(TANGLESRC).web
	ln $(MASTER)/$(TANGLESRC).web $(TANGLESRC).web
#	chmod -w $(TANGLESRC).web
	$(CTANGLE) $(TANGLESRC) $(TANGLECHANGEFILE)

weave.c: $(MASTER)/weave.web $(MASTER)/common.h grammar.web $(WEAVECHANGEFILE)
	-/bin/rm -f weave.web
	ln $(MASTER)/weave.web weave.web
#	chmod -w weave.web
	$(CTANGLE) weave $(WEAVECHANGEFILE)

## Here's where we run SPIDER to create the source

grammar.web: $(MASTER)/cycle.awk $(MASTER)/spider.awk $(SPIDER)
	echo "date" `date` | cat - $(SPIDER) | awk -f $(MASTER)/spider.awk \
  LaTeX=$(LaTeX) -
	cat $(MASTER)/transcheck.list trans_keys.unsorted | awk -f \
  $(MASTER)/transcheck.awk
	awk -f $(MASTER)/cycle.awk < cycle.test
	sort *.unsorted | awk -f $(MASTER)/nodups.awk
	mv *web.tex $(MACROS)

## We might have to make spider first.

$(MASTER)/spider.awk: $(MASTER)/spider.web $(SPIDERCHANGEFILE)
	$(AWKTANGLE) $(MASTER)/spider $(SPIDERCHANGEFILE)
	mv cycle.awk nodups.awk transcheck.awk $(MASTER)
	rm junk.list

# $(MASTER)/cycle.awk: $(MASTER)/cycle.web # making spider also makes cycle
# 	$(AWKTANGLE) $(MASTER)/cycle

# Weaving:

weave.tex: $(MASTER)/weave.web grammar.web $(WEAVECHANGEFILE)
	ceeweave -I$(MASTER) $(MASTER)/weave.web $(WEAVECHANGEFILE)
	mv $(MASTER)/weave.tex .

tangle.tex: $(MASTER)/tangle.web $(TANGLECHANGEFILE)
	ceeweave -I$(MASTER) $(MASTER)/tangle.web $(TANGLECHANGEFILE)
	mv $(MASTER)/tangle.tex .

spider.tex: $(MASTER)/spider.web $(SPIDERCHANGEFILE)
	awkweave -I$(MASTER) $(MASTER)/spider.web $(SPIDERCHANGEFILE)
	mv $(MASTER)/spider.tex .

# This cleanup applies to every language

clean:
	if [ -f WebMakefile ]; then exit 1; fi # don't clean the master!
	if [ -f spiderman.tex ]; then exit 1; fi # don't clean the manual
	-rm -f tangle.web weave.web common.* # remove links that may be obsolete
	-rm -f *.unsorted *.list grammar.web outtoks.web scraps.web 
	-rm -f cycle.test spider.slog
# vital bootstrap files are kept as SAVE..., hence only remove .c files whose
# names start with lower case
	-rm -f [a-z]*.c *.o *.tex *.toc *.dvi *.log *.makelog *~ *.wlog *.printlog



# booting the new distribution
boot:
	cd ../master; rm -f *.o; for i in $(COMMONC); do \
		cc $(CFLAGS) -c $$i; \
		mv *.o $(OBDIR) ; \
	done; cd ../c
	cc $(CFLAGS) -c $(TANGLESRC).c; \
	cc $(CFLAGS) -o $(DEST)/$(THETANGLE) $(COMMONOBJS) $(TANGLESRC).o