perl 4.0 patch 31: patch #20, continued
[p5sagit/p5-mst-13.2.git] / Makefile.SH
1 case $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     ;;
11 esac
12 case "$0" in
13 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
14 esac
15
16 case "$d_symlink" in
17 *define*) sln='ln -s' ;;
18 *) sln='ln';;
19 esac
20
21 case "$d_dosuid" in
22 *define*) suidperl='suidperl' ;;
23 *) suidperl='';;
24 esac
25
26 echo "Extracting Makefile (with variable substitutions)"
27 rm -f Makefile
28 cat >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
54 CC = $cc
55 YACC = $yacc
56 bin = $installbin
57 scriptdir = $scriptdir
58 privlib = $installprivlib
59 mansrc = $mansrc
60 manext = $manext
61 LDFLAGS = $ldflags
62 CLDFLAGS = $ldflags
63 SMALL = $small
64 LARGE = $large $split
65 mallocsrc = $mallocsrc
66 mallocobj = $mallocobj
67 SLN = $sln
68 RMS = rm -f
69
70 libs = $libs $cryptlib
71
72 public = perl taintperl $suidperl
73
74 shellflags = $shellflags
75
76 # To use an alternate make, set $altmake in config.sh.
77 MAKE = ${altmake-make}
78
79 !GROK!THIS!
80
81 cat >>Makefile <<'!NO!SUBS!'
82
83 CCCMD = `sh $(shellflags) cflags $@`
84
85 private = 
86
87 scripts = h2ph
88
89 manpages = perl.man h2ph.man
90
91 util =
92
93 sh = Makefile.SH makedepend.SH h2ph.SH
94
95 h1 = EXTERN.h INTERN.h arg.h array.h cmd.h config.h form.h handy.h
96 h2 = hash.h perl.h regcomp.h regexp.h spat.h stab.h str.h util.h
97
98 h = $(h1) $(h2)
99
100 c1 = array.c cmd.c cons.c consarg.c doarg.c doio.c dolist.c dump.c
101 c2 = eval.c form.c hash.c $(mallocsrc) perl.c regcomp.c regexec.c
102 c3 = stab.c str.c toke.c util.c usersub.c
103
104 c = $(c1) $(c2) $(c3)
105
106 s1 = array.c cmd.c cons.c consarg.c doarg.c doio.c dolist.c dump.c
107 s2 = eval.c form.c hash.c perl.c regcomp.c regexec.c
108 s3 = stab.c str.c toke.c util.c usersub.c perly.c
109
110 saber = $(s1) $(s2) $(s3)
111
112 obj1 = array.o cmd.o cons.o consarg.o doarg.o doio.o dolist.o dump.o
113 obj2 = eval.o form.o $(mallocobj) perl.o regcomp.o regexec.o
114 obj3 = stab.o str.o toke.o util.o
115
116 obj = $(obj1) $(obj2) $(obj3)
117
118 tobj1 = tarray.o tcmd.o tcons.o tconsarg.o tdoarg.o tdoio.o tdolist.o tdump.o
119 tobj2 = teval.o tform.o thash.o $(mallocobj) tregcomp.o tregexec.o
120 tobj3 = tstab.o tstr.o ttoke.o tutil.o
121
122 tobj = $(tobj1) $(tobj2) $(tobj3)
123
124 lintflags = -hbvxac
125
126 addedbyconf = Makefile.old bsd eunice filexp loc pdp11 usg v7
127
128 # grrr
129 SHELL = /bin/sh
130
131 .c.o:
132         $(CCCMD) $*.c
133
134 all: $(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
143 perl: $& 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
148 dbzperl: $& 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
151 zhash.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
157 uperl.o: $& perly.o $(obj) hash.o
158         -ld $(LARGE) $(LDFLAGS) -r $(obj) hash.o perly.o -o uperl.o
159
160 saber: $(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
169 suidperl: $& 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
178 taintperl: $& 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
184 tperly.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
190 tperl.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
196 sperl.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
202 tarray.o: array.c $(h)
203         $(RMS) tarray.c
204         $(SLN) array.c tarray.c
205         $(CCCMD) -DTAINT tarray.c
206         $(RMS) tarray.c
207
208 tcmd.o: cmd.c $(h)
209         $(RMS) tcmd.c
210         $(SLN) cmd.c tcmd.c
211         $(CCCMD) -DTAINT tcmd.c
212         $(RMS) tcmd.c
213
214 tcons.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
220 tconsarg.o: consarg.c $(h)
221         $(RMS) tconsarg.c
222         $(SLN) consarg.c tconsarg.c
223         $(CCCMD) -DTAINT tconsarg.c
224         $(RMS) tconsarg.c
225
226 tdoarg.o: doarg.c $(h)
227         $(RMS) tdoarg.c
228         $(SLN) doarg.c tdoarg.c
229         $(CCCMD) -DTAINT tdoarg.c
230         $(RMS) tdoarg.c
231
232 tdoio.o: doio.c $(h)
233         $(RMS) tdoio.c
234         $(SLN) doio.c tdoio.c
235         $(CCCMD) -DTAINT tdoio.c
236         $(RMS) tdoio.c
237
238 tdolist.o: dolist.c $(h)
239         $(RMS) tdolist.c
240         $(SLN) dolist.c tdolist.c
241         $(CCCMD) -DTAINT tdolist.c
242         $(RMS) tdolist.c
243
244 tdump.o: dump.c $(h)
245         $(RMS) tdump.c
246         $(SLN) dump.c tdump.c
247         $(CCCMD) -DTAINT tdump.c
248         $(RMS) tdump.c
249
250 teval.o: eval.c $(h)
251         $(RMS) teval.c
252         $(SLN) eval.c teval.c
253         $(CCCMD) -DTAINT teval.c
254         $(RMS) teval.c
255
256 tform.o: form.c $(h)
257         $(RMS) tform.c
258         $(SLN) form.c tform.c
259         $(CCCMD) -DTAINT tform.c
260         $(RMS) tform.c
261
262 thash.o: hash.c $(h)
263         $(RMS) thash.c
264         $(SLN) hash.c thash.c
265         $(CCCMD) -DTAINT thash.c
266         $(RMS) thash.c
267
268 tregcomp.o: regcomp.c $(h)
269         $(RMS) tregcomp.c
270         $(SLN) regcomp.c tregcomp.c
271         $(CCCMD) -DTAINT tregcomp.c
272         $(RMS) tregcomp.c
273
274 tregexec.o: regexec.c $(h)
275         $(RMS) tregexec.c
276         $(SLN) regexec.c tregexec.c
277         $(CCCMD) -DTAINT tregexec.c
278         $(RMS) tregexec.c
279
280 tstab.o: stab.c $(h)
281         $(RMS) tstab.c
282         $(SLN) stab.c tstab.c
283         $(CCCMD) -DTAINT tstab.c
284         $(RMS) tstab.c
285
286 tstr.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
292 ttoke.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
298 tutil.o: util.c $(h)
299         $(RMS) tutil.c
300         $(SLN) util.c tutil.c
301         $(CCCMD) -DTAINT tutil.c
302         $(RMS) tutil.c
303
304 perly.h: perly.c
305         @ echo Dummy dependency for dumb parallel make
306         touch perly.h
307
308 perly.c: perly.y perly.fixer
309         @ \
310 case "$(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;; \
313 esac
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
319 perly.o: perly.c perly.h $(h)
320         $(CCCMD) perly.c
321
322 install: all
323         ./perl installperl
324
325 clean:
326         rm -f *.o all perl taintperl suidperl perly.c
327         cd x2p; $(MAKE) clean
328
329 realclean: clean
330         cd x2p; $(MAKE) realclean
331         rm -f *.orig */*.orig *~ */*~ core $(addedbyconf) h2ph h2ph.man
332         rm -f perly.c perly.h t/perl Makefile config.h makedepend makedir
333         rm -f makefile x2p/Makefile x2p/makefile cflags x2p/cflags
334         rm -f c2ph pstruct
335
336 # The following lint has practically everything turned on.  Unfortunately,
337 # you have to wade through a lot of mumbo jumbo that can't be suppressed.
338 # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
339 # for that spot.
340
341 lint: perly.c $(c)
342         lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
343
344 depend: makedepend
345         - test -f perly.h || cp /dev/null perly.h
346         ./makedepend
347         - test -s perly.h || /bin/rm -f perly.h
348         cd x2p; $(MAKE) depend
349
350 test: perl
351         - cd t && chmod +x TEST */*.t
352         - cd t && (rm -f perl; $(SLN) ../perl perl) && ./perl TEST </dev/tty
353
354 clist:
355         echo $(c) | tr ' ' '\012' >.clist
356
357 hlist:
358         echo $(h) | tr ' ' '\012' >.hlist
359
360 shlist:
361         echo $(sh) | tr ' ' '\012' >.shlist
362
363 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
364 $(obj) hash.o:
365         @ echo "You haven't done a "'"make depend" yet!'; exit 1
366 makedepend: makedepend.SH
367         /bin/sh $(shellflags) makedepend.SH
368 !NO!SUBS!
369 $eunicefix Makefile
370 case `pwd` in
371 *SH)
372     $rm -f ../Makefile
373     ln Makefile ../Makefile
374     ;;
375 esac
376 rm -f makefile