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