summaryrefslogtreecommitdiff
path: root/web/maple/mapleweb/Makefile
blob: c9edbfdfb5ee5b6d2540f94dde2444e04deb62b5 (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
# 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.

HOME=/users/redusers#			# Make no longer inherits environment vars

THETANGLE=tangle
THEWEAVE=weave
SPIDER=any.spider
#
DVI=dvi
CFLAGS=-DDEBUG -g -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`

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

WEBROOT=$(HOME)/spider# 	# 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: mktangle 

mktangle: $(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 # no change file
	$(CTANGLE) $(MASTER)/common 

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

$(MASTER)/pathopen.c: $(MASTER)/pathopen.web # no change file
	$(CTANGLE) $(MASTER)/pathopen 
	mv pathopen.h $(MASTER)

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

$(OBDIR):
	if /bin/test ! -d $(OBDIR) ; then mkdir $(OBDIR) ; fi

## Now we make the tangle and weave source locally

$(TANGLESRC).c: $(MASTER)/$(TANGLESRC).web $(MASTER)/common.h grammar.web tangle.ch
	-/bin/rm -f $(TANGLESRC).web
	ln $(MASTER)/$(TANGLESRC).web $(TANGLESRC).web
	$(CTANGLE) $(TANGLESRC) tangle.ch

weave.c: $(MASTER)/weave.web $(MASTER)/common.h grammar.web weave.ch
# van vorige lijn: rweave.ch 
	-/bin/rm -f weave.web
	ln $(MASTER)/weave.web weave.web
	$(CTANGLE) weave weave.ch

## 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
	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
	$(AWKTANGLE) $(MASTER)/spider
	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


# 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.* 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 *.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