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