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