summaryrefslogtreecommitdiff
path: root/dviware/crudetype/version3/makefile
blob: 45e620680258c8ea64ad1ff1ebe83b2bfdc7e186 (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
229
230
231
232
233
234
235
236
237
238
# Makefile for Unix version of CRUDETYPE.
#
# {{ Originally written by P.King, much altered by RMD}}

#
# COPYRIGHT ( C ) P. King, Heriot-Watt University, 1988.
#
# Permission is given to any person to make and distribute copies of this
# software, subject to the following conditions:
#
# 1. All copies of the software must carry an exact copy of this notice.
#
# 2. This software is distributed free of charge, "AS IS" with absolutely no
# guarantee of performance. Any persons receiving or using this software must do
# so entirely at their own risk. Neither the authors nor their institutions
# accept any liability for any defects of this software, or for any consequential
# loss or damage however caused.
#
# 3. Any person who changes this software must clearly mark it as modified and
# add a note describing the changes made.
#
#
# They depend on the Berkeley implementation of Pascal, and have only been tried
# on BSD4.2 UNIX.
#
#
#
#
#
# Makefile:
# --------------------------------
#
#   Adapted from:
#   Makefile for TeX82 distribution, subdirectory `=TeXware'
#   version for 4.2 bsd
#
#   This file makes CRUDETYPE from its WEB source.
#
#   Note: The -J option on the 'pc' commands below is the only way to
#         'pc' to use the -J option to the assembler (which makes it
#         do the sensible thing with branches).  This flag is not
#         documented, which is correct, since 'pc' should really be
#         using it all of the time...  (Grrr..)
#
#   Note: several parts of this Makefile are unsatisfactory; I could
#   not get them to work.
#
#
#  Before using this makefile, change these macros to conform to
#  local practice:

################################################################
# Which image(s) do you want to build? See README for some names
################################################################

all:	$(IMAGES)

POSSIBLE_IMAGES= crudetype crude-p noscheme-p noscheme-c  hpgf

IMAGES =

################################################################
# Where does the S-ware live? In TEX version3 there are files:
# site.h  and defaults.h in the top level directory of TEX that
# describe your machine. 
################################################################

SITEDIR= /tex/ver3
SITE_H=$(SITEDIR)/site.h
DEFT_H=$(SITEDIR)/defaults.h

# I had to rewrite common.defines

COMMONDIR= .
COMM_DEFS=$(COMMONDIR)/w2c.defines	

# Where to install things

BINDIR=/tex
MANDIR=/usr/man/manl

################################################################
# Compiler options
################################################################

OPT= -O
CFLAGS=$(OPT) -I$(SITEDIR)
PFLAGS= -J -g -C
LDFLAGS= $(OPT)
INSTALL = cp -m 555

################################################################
# Names of compilers etc
################################################################

CC = cc
PC = pc
TANGLE=-tangle
RM=/bin/rm
YACC=yacc	# You can substitute "bison -y" for "yacc" if you like
LEX=lex		# Note: If you're going to use flex, compile web2cl.c with "-DFLEX"


.c.o:		
		$(CC) $(CFLAGS) -c $*.c

.p.o:
		$(PC) $(PFLAGS) -c $*.p


################################################################
# This is what I regard as the 'normal' version of Crudetype, using
# my modified web2c.
################################################################

CRUDE_C_OBJS= crude-c.o w2c-ext.o w2c-main.o

crudetype:	$(CRUDE_C_OBJS)
		cc $(LDFLAGS) -o $@ $(CRUDE_C_OBJS)

$(CRUDE_C_OBJS):	$(SITE_H) $(DEFT_H)

crude-c.c:	crude-c.p w2c $(COMM_DEFS)
		w2c -d$(COMM_DEFS) <crude-c.p >crude-c.c

crude-c.p:	crudetype.web unix-c.ch
		$(TANGLE) crudetype unix-c
		mv crudetype.p crude-c.p


################################################################
#Compile w2c itself
################################################################

WC_OBJS= w2cy.o w2cl.o w2c.o


w2c:		$(WC_OBJS)
		$(CC)  $(LDFLAGS) -o  w2c $(WC_OBJS)  -ll

$(WC_OBJS):	w2c-symtab.h  w2cy.h w2c.h

w2cl.c:		w2c.lex $(SITE_H) $(DEFT_H)
		$(LEX) w2c.lex
		mv -f lex.yy.c w2cl.c

w2cy.c:		w2c.yacc $(SITE_H) $(DEFT_H)
		$(YACC) -d w2c.yacc
		mv -f y.tab.c w2cy.c
		-cmp y.tab.h w2cy.h || cp y.tab.h w2cy.h

################################################################
# Version using pc is called crude-p
################################################################


crude-p: 	crude-p.o unixext.o
		$(PC) $(PFLAGS) -o $@  crude-p.o unixext.o $(PCLIB)

crude-p.p:	crudetype.web unix-pas.ch
		$(TANGLE) crudetype unix-pas
		mv crudetype.p crude-p.p


################################################################
# YEUCHY mess for no coding schemes
################################################################

noscheme-p:	noscheme-p.o unixext.o
		$(PC) $(PFLAGS) -o $@  noscheme-p.o unixext.o $(PCLIB)

noscheme-p.p: 	noscheme.web unix-pas.ch
		$(TANGLE) noscheme unix-pas
		mv noscheme.p noscheme-p.p

noscheme.web: 	crudetype.web noscheme.add
		cat crudetype.web noscheme.add > $@

################################################################
# More mess. Noscheme compiled with W2C
#
################################################################

NOSC_OBJS= noscheme-c.o w2c-ext.o w2c-main.o

noscheme-c:	$(NOSC_OBJS)
		cc $(LDFLAGS) -o $@ $(NOSC_OBJS)

$(NOSC_OBJS):	$(SITE_H) $(DEFT_H)

noscheme-c.c:	noscheme-c.p w2c $(COMM_DEFS)
		w2c -d$(COMM_DEFS) <noscheme-c.p >noscheme-c.c

noscheme-c.p:	noscheme.web unix-c.ch
		$(TANGLE) noscheme unix-c
		mv noscheme.p noscheme-c.p


################################################################
# Typical example of a printer changefile
################################################################


hpgf: hpgf.o unixext.o
		$(PC) $(PFLAGS) -o hpgf hpgf.o unixext.o $(PCLIB)

hpgf.p: crudetype.web  unixhp.ch
		$(TANGLE) crudetype unixhp
		mv crudetype.p hpgf.p
	
unixhp.ch: unix-pas.ch hpgf.ch
		cat unix-pas.ch hpgf.ch > $@


################################################################
# Install etc. You probably want to alter the installed names.
################################################################

install: $(IMAGES)
	for i in $(POSSIBLE_IMAGES) ; do\
		if -i $$i \
			$(INSTALL) $$i  $(BINDIR); \
		fi \
	done
	$(INSTALL) unixcru.man $(MANDIR)crudetype.l


veryclean:	clean
		$(RM) -f  crude-c.c noscheme-c.c

clean:
		$(RM) -f *.p *.o $(POSSIBLE_IMAGES) \
			y.* lex.* w2c w2cy.c w2cy.h w2cl.c coerce.h \
			noscheme.web unixhp.ch \
			answers.tex index.tex  \
			*.dvi *.lpr *.log *~ *#