1case $CONFIG in
2'')
3    if test ! -f config.sh; then
4	ln ../config.sh . || \
5	ln ../../config.sh . || \
6	ln ../../../config.sh . || \
7	(echo "Can't find config.sh."; exit 1)
8    fi 2>/dev/null
9    . ./config.sh
10    ;;
11esac
12case "$0" in
13*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
14esac
15
16case "$d_symlink" in
17*define*) sln='ln -s' ;;
18*) sln='ln';;
19esac
20
21case "$d_dosuid" in
22*define*) suidperl='suidperl' ;;
23*) suidperl='';;
24esac
25
26echo "Extracting Makefile (with variable substitutions)"
27rm -f Makefile
28cat >Makefile <<!GROK!THIS!
29# $RCSfile: Makefile.SH,v $$Revision: 4.0.1.4 $$Date: 92/06/08 11:40:43 $
30#
31# $Log:	Makefile.SH,v $
32# Revision 4.0.1.4  92/06/08  11:40:43  lwall
33# patch20: cray didn't give enough memory to /bin/sh
34# patch20: various and sundry fixes
35#
36# Revision 4.0.1.3  91/11/05  15:48:11  lwall
37# patch11: saberized perl
38# patch11: added support for dbz
39#
40# Revision 4.0.1.2  91/06/07  10:14:43  lwall
41# patch4: cflags now emits entire cc command except for the filename
42# patch4: alternate make programs are now semi-supported
43# patch4: uperl.o no longer tries to link in libraries prematurely
44# patch4: installperl now installs x2p stuff too
45#
46# Revision 4.0.1.1  91/04/11  17:30:39  lwall
47# patch1: C flags are now settable on a per-file basis
48#
49# Revision 4.0  91/03/20  00:58:54  lwall
50# 4.0 baseline.
51#
52#
53
54CC = $cc
55YACC = $yacc
56bin = $installbin
57scriptdir = $scriptdir
58privlib = $installprivlib
59mansrc = $mansrc
60manext = $manext
61LDFLAGS = $ldflags
62CLDFLAGS = $ldflags
63SMALL = $small
64LARGE = $large $split
65mallocsrc = $mallocsrc
66mallocobj = $mallocobj
67SLN = $sln
68RMS = rm -f
69
70libs = $libs $cryptlib
71
72public = perl taintperl $suidperl
73
74shellflags = $shellflags
75
76# To use an alternate make, set $altmake in config.sh.
77MAKE = ${altmake-make}
78
79!GROK!THIS!
80
81cat >>Makefile <<'!NO!SUBS!'
82
83CCCMD = `sh $(shellflags) cflags $@`
84
85private =
86
87scripts = h2ph
88
89manpages = perl.man h2ph.man
90
91util =
92
93sh = Makefile.SH makedepend.SH h2ph.SH
94
95h1 = EXTERN.h INTERN.h arg.h array.h cmd.h config.h form.h handy.h
96h2 = hash.h perl.h regcomp.h regexp.h spat.h stab.h str.h util.h
97
98h = $(h1) $(h2)
99
100c1 = array.c cmd.c cons.c consarg.c doarg.c doio.c dolist.c dump.c
101c2 = eval.c form.c hash.c $(mallocsrc) perl.c regcomp.c regexec.c
102c3 = stab.c str.c toke.c util.c usersub.c
103
104c = $(c1) $(c2) $(c3)
105
106s1 = array.c cmd.c cons.c consarg.c doarg.c doio.c dolist.c dump.c
107s2 = eval.c form.c hash.c perl.c regcomp.c regexec.c
108s3 = stab.c str.c toke.c util.c usersub.c perly.c
109
110saber = $(s1) $(s2) $(s3)
111
112obj1 = array.o cmd.o cons.o consarg.o doarg.o doio.o dolist.o dump.o
113obj2 = eval.o form.o $(mallocobj) perl.o regcomp.o regexec.o
114obj3 = stab.o str.o toke.o util.o
115
116obj = $(obj1) $(obj2) $(obj3)
117
118tobj1 = tarray.o tcmd.o tcons.o tconsarg.o tdoarg.o tdoio.o tdolist.o tdump.o
119tobj2 = teval.o tform.o thash.o $(mallocobj) tregcomp.o tregexec.o
120tobj3 = tstab.o tstr.o ttoke.o tutil.o
121
122tobj = $(tobj1) $(tobj2) $(tobj3)
123
124lintflags = -hbvxac
125
126addedbyconf = Makefile.old bsd eunice filexp loc pdp11 usg v7
127
128# grrr
129SHELL = /bin/sh
130
131.c.o:
132	$(CCCMD) $*.c
133
134all: $(public) $(private) $(util) uperl.o $(scripts)
135	cd x2p; $(MAKE) all
136	touch all
137
138# This is the standard version that contains no "taint" checks and is
139# used for all scripts that aren't set-id or running under something set-id.
140# The $& notation is tells Sequent machines that it can do a parallel make,
141# and is harmless otherwise.
142
143perl: $& perly.o $(obj) hash.o usersub.o
144	$(CC) $(LARGE) $(CLDFLAGS) $(obj) hash.o perly.o usersub.o $(libs) -o perl
145
146# This command assumes that /usr/include/dbz.h and /usr/lib/dbz.o exist.
147
148dbzperl: $& perly.o $(obj) zhash.o usersub.o
149	$(CC) $(LARGE) $(CLDFLAGS) $(obj) zhash.o /usr/lib/dbz.o perly.o usersub.o $(libs) -o dbzperl
150
151zhash.o: hash.c $(h)
152	$(RMS) zhash.c
153	$(SLN) hash.c zhash.c
154	$(CCCMD) -DWANT_DBZ zhash.c
155	$(RMS) zhash.c
156
157uperl.o: $& perly.o $(obj) hash.o
158	-ld $(LARGE) $(LDFLAGS) -r $(obj) hash.o perly.o -o uperl.o
159
160saber: $(saber)
161	# load $(saber)
162	# load /lib/libm.a
163
164# This version, if specified in Configure, does ONLY those scripts which need
165# set-id emulation.  Suidperl must be setuid root.  It contains the "taint"
166# checks as well as the special code to validate that the script in question
167# has been invoked correctly.
168
169suidperl: $& tperly.o sperl.o $(tobj) usersub.o
170	$(CC) $(LARGE) $(CLDFLAGS) sperl.o $(tobj) tperly.o usersub.o $(libs) \
171	    -o suidperl
172
173# This version interprets scripts that are already set-id either via a wrapper
174# or through the kernel allowing set-id scripts (bad idea).  Taintperl must
175# NOT be setuid to root or anything else.  The only difference between it
176# and normal perl is the presence of the "taint" checks.
177
178taintperl: $& tperly.o tperl.o $(tobj) usersub.o
179	$(CC) $(LARGE) $(CLDFLAGS) tperl.o $(tobj) tperly.o usersub.o $(libs) \
180	    -o taintperl
181
182# Replicating all this junk is yucky, but I don't see a portable way to fix it.
183
184tperly.o: perly.c perly.h $(h)
185	$(RMS) tperly.c
186	$(SLN) perly.c tperly.c
187	$(CCCMD) -DTAINT tperly.c
188	$(RMS) tperly.c
189
190tperl.o: perl.c perly.h patchlevel.h perl.h $(h)
191	$(RMS) tperl.c
192	$(SLN) perl.c tperl.c
193	$(CCCMD) -DTAINT tperl.c
194	$(RMS) tperl.c
195
196sperl.o: perl.c perly.h patchlevel.h $(h)
197	$(RMS) sperl.c
198	$(SLN) perl.c sperl.c
199	$(CCCMD) -DTAINT -DIAMSUID sperl.c
200	$(RMS) sperl.c
201
202tarray.o: array.c $(h)
203	$(RMS) tarray.c
204	$(SLN) array.c tarray.c
205	$(CCCMD) -DTAINT tarray.c
206	$(RMS) tarray.c
207
208tcmd.o: cmd.c $(h)
209	$(RMS) tcmd.c
210	$(SLN) cmd.c tcmd.c
211	$(CCCMD) -DTAINT tcmd.c
212	$(RMS) tcmd.c
213
214tcons.o: cons.c $(h) perly.h
215	$(RMS) tcons.c
216	$(SLN) cons.c tcons.c
217	$(CCCMD) -DTAINT tcons.c
218	$(RMS) tcons.c
219
220tconsarg.o: consarg.c $(h)
221	$(RMS) tconsarg.c
222	$(SLN) consarg.c tconsarg.c
223	$(CCCMD) -DTAINT tconsarg.c
224	$(RMS) tconsarg.c
225
226tdoarg.o: doarg.c $(h)
227	$(RMS) tdoarg.c
228	$(SLN) doarg.c tdoarg.c
229	$(CCCMD) -DTAINT tdoarg.c
230	$(RMS) tdoarg.c
231
232tdoio.o: doio.c $(h)
233	$(RMS) tdoio.c
234	$(SLN) doio.c tdoio.c
235	$(CCCMD) -DTAINT tdoio.c
236	$(RMS) tdoio.c
237
238tdolist.o: dolist.c $(h)
239	$(RMS) tdolist.c
240	$(SLN) dolist.c tdolist.c
241	$(CCCMD) -DTAINT tdolist.c
242	$(RMS) tdolist.c
243
244tdump.o: dump.c $(h)
245	$(RMS) tdump.c
246	$(SLN) dump.c tdump.c
247	$(CCCMD) -DTAINT tdump.c
248	$(RMS) tdump.c
249
250teval.o: eval.c $(h)
251	$(RMS) teval.c
252	$(SLN) eval.c teval.c
253	$(CCCMD) -DTAINT teval.c
254	$(RMS) teval.c
255
256tform.o: form.c $(h)
257	$(RMS) tform.c
258	$(SLN) form.c tform.c
259	$(CCCMD) -DTAINT tform.c
260	$(RMS) tform.c
261
262thash.o: hash.c $(h)
263	$(RMS) thash.c
264	$(SLN) hash.c thash.c
265	$(CCCMD) -DTAINT thash.c
266	$(RMS) thash.c
267
268tregcomp.o: regcomp.c $(h)
269	$(RMS) tregcomp.c
270	$(SLN) regcomp.c tregcomp.c
271	$(CCCMD) -DTAINT tregcomp.c
272	$(RMS) tregcomp.c
273
274tregexec.o: regexec.c $(h)
275	$(RMS) tregexec.c
276	$(SLN) regexec.c tregexec.c
277	$(CCCMD) -DTAINT tregexec.c
278	$(RMS) tregexec.c
279
280tstab.o: stab.c $(h)
281	$(RMS) tstab.c
282	$(SLN) stab.c tstab.c
283	$(CCCMD) -DTAINT tstab.c
284	$(RMS) tstab.c
285
286tstr.o: str.c $(h) perly.h
287	$(RMS) tstr.c
288	$(SLN) str.c tstr.c
289	$(CCCMD) -DTAINT tstr.c
290	$(RMS) tstr.c
291
292ttoke.o: toke.c $(h) perly.h
293	$(RMS) ttoke.c
294	$(SLN) toke.c ttoke.c
295	$(CCCMD) -DTAINT ttoke.c
296	$(RMS) ttoke.c
297
298tutil.o: util.c $(h)
299	$(RMS) tutil.c
300	$(SLN) util.c tutil.c
301	$(CCCMD) -DTAINT tutil.c
302	$(RMS) tutil.c
303
304perly.h: perly.c
305	@ echo Dummy dependency for dumb parallel make
306	touch perly.h
307
308perly.c: perly.y perly.fixer
309	@ \
310case "$(YACC)" in \
311    *bison*) echo 'Expect' 25 shift/reduce and 59 reduce/reduce conflicts;; \
312    *) echo 'Expect' 27 shift/reduce and 57 reduce/reduce conflicts;; \
313esac
314	$(YACC) -d perly.y
315	sh $(shellflags) ./perly.fixer y.tab.c perly.c
316	mv y.tab.h perly.h
317	echo 'extern YYSTYPE yylval;' >>perly.h
318
319perly.o: perly.c perly.h $(h)
320	$(CCCMD) perly.c
321
322install: all
323	nroff -man perl.man > /usr/contrib/man/cat1/perl.0
324	nroff -man h2ph.man > /usr/contrib/man/cat1/h2ph.0
325	nroff -man x2p/s2p.man > /usr/contrib/man/cat1/s2p.0
326	nroff -man x2p/a2p.man > /usr/contrib/man/cat1/a2p.0
327	./perl installperl
328
329clean:
330	rm -f *.o all perl taintperl suidperl perly.c
331	cd x2p; $(MAKE) clean
332
333realclean: clean
334	cd x2p; $(MAKE) realclean
335	rm -f *.orig */*.orig *~ */*~ core $(addedbyconf) h2ph h2ph.man
336	rm -f perly.c perly.h t/perl Makefile config.h makedepend makedir
337	rm -f makefile x2p/Makefile x2p/makefile cflags x2p/cflags
338	rm -f c2ph pstruct
339
340# The following lint has practically everything turned on.  Unfortunately,
341# you have to wade through a lot of mumbo jumbo that can't be suppressed.
342# If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
343# for that spot.
344
345lint: perly.c $(c)
346	lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
347
348depend: makedepend
349	- test -f perly.h || cp /dev/null perly.h
350	./makedepend
351	- test -s perly.h || /bin/rm -f perly.h
352	cd x2p; $(MAKE) depend
353
354test: perl
355	- cd t && chmod +x TEST */*.t
356	- cd t && (rm -f perl; $(SLN) ../perl perl) && ./perl TEST </dev/tty
357
358clist:
359	echo $(c) | tr ' ' '\012' >.clist
360
361hlist:
362	echo $(h) | tr ' ' '\012' >.hlist
363
364shlist:
365	echo $(sh) | tr ' ' '\012' >.shlist
366
367# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
368$(obj) hash.o:
369	@ echo "You haven't done a "'"make depend" yet!'; exit 1
370makedepend: makedepend.SH
371	/bin/sh $(shellflags) makedepend.SH
372!NO!SUBS!
373$eunicefix Makefile
374case `pwd` in
375*SH)
376    $rm -f ../Makefile
377    ln Makefile ../Makefile
378    ;;
379esac
380rm -f makefile
381