perl 3.0 patch #42 (combined patch)
[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
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 cat >Makefile <<!GROK!THIS!
28 # $Header: Makefile.SH,v 3.0.1.12 91/01/11 17:05:17 lwall Locked $
29 #
30 # $Log: Makefile.SH,v $
31 # Revision 3.0.1.12  91/01/11  17:05:17  lwall
32 # patch42: added installperl script
33
34 # Revision 3.0.1.11  90/11/10  01:25:51  lwall
35 # patch38: new arbitrary precision libraries from Mark Biggar
36
37 # Revision 3.0.1.10  90/10/20  01:59:21  lwall
38 # patch37: added cryptlib support to Makefile
39
40 # Revision 3.0.1.9  90/10/15  14:41:34  lwall
41 # patch29: various portability fixes
42
43 # Revision 3.0.1.8  90/08/13  21:50:49  lwall
44 # patch28: not all yaccs are the same
45
46 # Revision 3.0.1.7  90/08/09  02:19:56  lwall
47 # patch19: Configure now asks where you want to put scripts
48 # patch19: Added support for linked-in C subroutines
49
50 # Revision 3.0.1.6  90/03/27  15:27:15  lwall
51 # patch16: MSDOS support
52
53 # Revision 3.0.1.5  90/03/12  16:15:17  lwall
54 # patch13: some dependencies missing on perly.h
55 # patch13: some relief for buggy parallel makes
56 # patch13: bison doesn't declare extern YYSTYPE yylval;
57
58 # Revision 3.0.1.4  90/02/28  16:19:43  lwall
59 # patch9: extraneous $ on suidperl in Makefile
60
61 # Revision 3.0.1.3  89/12/21  19:09:26  lwall
62 # patch7: Configure now lets you pick between yacc or bison
63
64 # Revision 3.0.1.2  89/11/11  04:07:30  lwall
65 # patch2: $sockethdr incorporated into $ccflags
66 # patch2: $libs now has most of the -l libraries
67
68 # Revision 3.0.1.1  89/10/26  23:00:38  lwall
69 # patch1: Makefile.SH needed some more .h dependecies
70
71 # Revision 3.0  89/10/18  15:06:43  lwall
72 # 3.0 baseline
73
74
75 CC = $cc
76 YACC = $yacc
77 bin = $bin
78 scriptdir = $scriptdir
79 privlib = $privlib
80 mansrc = $mansrc
81 manext = $manext
82 CFLAGS = $ccflags $optimize
83 LDFLAGS = $ldflags
84 CLDFLAGS = $ldflags
85 SMALL = $small
86 LARGE = $large $split
87 mallocsrc = $mallocsrc
88 mallocobj = $mallocobj
89 SLN = $sln
90
91 libs = $libs $cryptlib
92
93 public = perl taintperl $suidperl
94
95 !GROK!THIS!
96
97 cat >>Makefile <<'!NO!SUBS!'
98 private = 
99
100 scripts = h2ph
101
102 MAKE = make
103
104 manpages = perl.man h2ph.man
105
106 util =
107
108 sh = Makefile.SH makedepend.SH h2ph.SH
109
110 h1 = EXTERN.h INTERN.h arg.h array.h cmd.h config.h form.h handy.h
111 h2 = hash.h perl.h regcomp.h regexp.h spat.h stab.h str.h util.h
112
113 h = $(h1) $(h2)
114
115 c1 = array.c cmd.c cons.c consarg.c doarg.c doio.c dolist.c dump.c
116 c2 = eval.c form.c hash.c $(mallocsrc) perly.c regcomp.c regexec.c
117 c3 = stab.c str.c toke.c util.c usersub.c
118
119 c = $(c1) $(c2) $(c3)
120
121 obj1 = array.o cmd.o cons.o consarg.o doarg.o doio.o dolist.o dump.o
122 obj2 = eval.o form.o hash.o $(mallocobj) perly.o regcomp.o regexec.o
123 obj3 = stab.o str.o toke.o util.o
124
125 obj = $(obj1) $(obj2) $(obj3)
126
127 tobj1 = tarray.o tcmd.o tcons.o tconsarg.o tdoarg.o tdoio.o tdolist.o tdump.o
128 tobj2 = teval.o tform.o thash.o $(mallocobj) tregcomp.o tregexec.o
129 tobj3 = tstab.o tstr.o ttoke.o tutil.o
130
131 tobj = $(tobj1) $(tobj2) $(tobj3)
132
133 lintflags = -hbvxac
134
135 addedbyconf = Makefile.old bsd eunice filexp loc pdp11 usg v7
136
137 # grrr
138 SHELL = /bin/sh
139
140 .c.o:
141         $(CC) -c $(CFLAGS) $(LARGE) $*.c
142
143 all: $(public) $(private) $(util) perl.man uperl.o $(scripts)
144         cd x2p; $(MAKE) all
145         touch all
146
147 # This is the standard version that contains no "taint" checks and is
148 # used for all scripts that aren't set-id or running under something set-id.
149
150 perl: perl.o $(obj) usersub.o
151         $(CC) $(LARGE) $(CLDFLAGS) $(obj) perl.o usersub.o $(libs) -o perl
152
153 uperl.o: perl.o $(obj)
154         -ld $(LARGE) $(LDFLAGS) -r $(obj) perl.o $(libs) -o uperl.o
155
156 saber: perl.c
157         # load $(c) perl.c
158
159 # This version, if specified in Configure, does ONLY those scripts which need
160 # set-id emulation.  Suidperl must be setuid root.  It contains the "taint"
161 # checks as well as the special code to validate that the script in question
162 # has been invoked correctly.
163
164 suidperl: tperl.o sperly.o $(tobj) usersub.o
165         $(CC) $(LARGE) $(CLDFLAGS) sperly.o $(tobj) tperl.o usersub.o $(libs) \
166             -o suidperl
167
168 # This version interprets scripts that are already set-id either via a wrapper
169 # or through the kernel allowing set-id scripts (bad idea).  Taintperl must
170 # NOT be setuid to root or anything else.  The only difference between it
171 # and normal perl is the presence of the "taint" checks.
172
173 taintperl: tperl.o tperly.o $(tobj) usersub.o
174         $(CC) $(LARGE) $(CLDFLAGS) tperly.o $(tobj) tperl.o usersub.o $(libs) \
175             -o taintperl
176
177 # Replicating all this junk is yucky, but I don't see a portable way to fix it.
178
179 tperl.o: perl.c perly.h $(h)
180         /bin/rm -f tperl.c
181         $(SLN) perl.c tperl.c
182         $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tperl.c
183         /bin/rm -f tperl.c
184
185 tperly.o: perly.c perly.h $(h)
186         /bin/rm -f tperly.c
187         $(SLN) perly.c tperly.c
188         $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tperly.c
189         /bin/rm -f tperly.c
190
191 sperly.o: perly.c perly.h patchlevel.h $(h)
192         /bin/rm -f sperly.c
193         $(SLN) perly.c sperly.c
194         $(CC) -c -DTAINT -DIAMSUID $(CFLAGS) $(LARGE) sperly.c
195         /bin/rm -f sperly.c
196
197 tarray.o: array.c $(h)
198         /bin/rm -f tarray.c
199         $(SLN) array.c tarray.c
200         $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tarray.c
201         /bin/rm -f tarray.c
202
203 tcmd.o: cmd.c $(h)
204         /bin/rm -f tcmd.c
205         $(SLN) cmd.c tcmd.c
206         $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tcmd.c
207         /bin/rm -f tcmd.c
208
209 tcons.o: cons.c $(h) perly.h
210         /bin/rm -f tcons.c
211         $(SLN) cons.c tcons.c
212         $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tcons.c
213         /bin/rm -f tcons.c
214
215 tconsarg.o: consarg.c $(h)
216         /bin/rm -f tconsarg.c
217         $(SLN) consarg.c tconsarg.c
218         $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tconsarg.c
219         /bin/rm -f tconsarg.c
220
221 tdoarg.o: doarg.c $(h)
222         /bin/rm -f tdoarg.c
223         $(SLN) doarg.c tdoarg.c
224         $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tdoarg.c
225         /bin/rm -f tdoarg.c
226
227 tdoio.o: doio.c $(h)
228         /bin/rm -f tdoio.c
229         $(SLN) doio.c tdoio.c
230         $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tdoio.c
231         /bin/rm -f tdoio.c
232
233 tdolist.o: dolist.c $(h)
234         /bin/rm -f tdolist.c
235         $(SLN) dolist.c tdolist.c
236         $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tdolist.c
237         /bin/rm -f tdolist.c
238
239 tdump.o: dump.c $(h)
240         /bin/rm -f tdump.c
241         $(SLN) dump.c tdump.c
242         $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tdump.c
243         /bin/rm -f tdump.c
244
245 teval.o: eval.c $(h)
246         /bin/rm -f teval.c
247         $(SLN) eval.c teval.c
248         $(CC) -c -DTAINT $(CFLAGS) $(LARGE) teval.c
249         /bin/rm -f teval.c
250
251 tform.o: form.c $(h)
252         /bin/rm -f tform.c
253         $(SLN) form.c tform.c
254         $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tform.c
255         /bin/rm -f tform.c
256
257 thash.o: hash.c $(h)
258         /bin/rm -f thash.c
259         $(SLN) hash.c thash.c
260         $(CC) -c -DTAINT $(CFLAGS) $(LARGE) thash.c
261         /bin/rm -f thash.c
262
263 tregcomp.o: regcomp.c $(h)
264         /bin/rm -f tregcomp.c
265         $(SLN) regcomp.c tregcomp.c
266         $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tregcomp.c
267         /bin/rm -f tregcomp.c
268
269 tregexec.o: regexec.c $(h)
270         /bin/rm -f tregexec.c
271         $(SLN) regexec.c tregexec.c
272         $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tregexec.c
273         /bin/rm -f tregexec.c
274
275 tstab.o: stab.c $(h)
276         /bin/rm -f tstab.c
277         $(SLN) stab.c tstab.c
278         $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tstab.c
279         /bin/rm -f tstab.c
280
281 tstr.o: str.c $(h) perly.h
282         /bin/rm -f tstr.c
283         $(SLN) str.c tstr.c
284         $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tstr.c
285         /bin/rm -f tstr.c
286
287 ttoke.o: toke.c $(h) perly.h
288         /bin/rm -f ttoke.c
289         $(SLN) toke.c ttoke.c
290         $(CC) -c -DTAINT $(CFLAGS) $(LARGE) ttoke.c
291         /bin/rm -f ttoke.c
292
293 tutil.o: util.c $(h)
294         /bin/rm -f tutil.c
295         $(SLN) util.c tutil.c
296         $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tutil.c
297         /bin/rm -f tutil.c
298
299 perly.h: perl.c
300         @ echo Dummy dependency for dumb parallel make
301         touch perly.h
302
303 perl.c: perl.y
304         @ echo 'Expect either' 29 shift/reduce and 59 reduce/reduce conflicts...
305         @ echo '           or' 27 shift/reduce and 61 reduce/reduce conflicts...
306         $(YACC) -d perl.y
307         mv y.tab.c perl.c
308         mv y.tab.h perly.h
309         echo 'extern YYSTYPE yylval;' >>perly.h
310
311 perl.o: perl.c perly.h $(h)
312         $(CC) -c $(CFLAGS) $(LARGE) perl.c
313
314 perl.man: perl_man.1 perl_man.2 perl_man.3 perl_man.4 patchlevel.h perl
315         ./perl  -e '($$r,$$p)=$$]=~/(\d+\.\d+).*\n\D*(\d+)/;' \
316                 -e 'print ".ds RP Release $$r Patchlevel $$p\n";' >perl.man
317         cat perl_man.[1-4] >>perl.man
318
319 install: all
320         ./perl installperl
321         cd x2p; $(MAKE) install
322
323 clean:
324         rm -f *.o all perl taintperl suidperl perl.man
325         cd x2p; $(MAKE) clean
326
327 realclean: clean
328         cd x2p; $(MAKE) realclean
329         rm -f *.orig */*.orig *~ */*~ core $(addedbyconf) h2ph h2ph.man
330         rm -f perl.c perly.h t/perl Makefile config.h makedepend makedir
331         rm -f x2p/Makefile
332
333 # The following lint has practically everything turned on.  Unfortunately,
334 # you have to wade through a lot of mumbo jumbo that can't be suppressed.
335 # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
336 # for that spot.
337
338 lint: perl.c $(c)
339         lint $(lintflags) $(defs) perl.c $(c) > perl.fuzz
340
341 depend: makedepend
342         - test -f perly.h || cp /dev/null perly.h
343         ./makedepend
344         - test -s perly.h || /bin/rm -f perly.h
345         cd x2p; $(MAKE) depend
346
347 test: perl
348         - chmod +x t/TEST t/base.* t/comp.* t/cmd.* t/io.* t/op.* t/lib.*; \
349         cd t && (rm -f perl; $(SLN) ../perl .) && ./perl TEST
350
351 clist:
352         echo $(c) | tr ' ' '\012' >.clist
353
354 hlist:
355         echo $(h) | tr ' ' '\012' >.hlist
356
357 shlist:
358         echo $(sh) | tr ' ' '\012' >.shlist
359
360 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
361 $(obj):
362         @ echo "You haven't done a "'"make depend" yet!'; exit 1
363 makedepend: makedepend.SH
364         /bin/sh makedepend.SH
365 !NO!SUBS!
366 $eunicefix Makefile
367 case `pwd` in
368 *SH)
369     $rm -f ../Makefile
370     ln Makefile ../Makefile
371     ;;
372 esac