perl 4.0 patch 31: patch #20, continued
[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)
fe14fcc3 8 fi 2>/dev/null
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)"
b3634b01 27rm -f Makefile
8d063cd8 28cat >Makefile <<!GROK!THIS!
b3634b01 29# $RCSfile: Makefile.SH,v $$Revision: 4.0.1.4 $$Date: 92/06/08 11:40:43 $
8d063cd8 30#
31# $Log: Makefile.SH,v $
b3634b01 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#
f1ca563b 36# Revision 4.0.1.3 91/11/05 15:48:11 lwall
37# patch11: saberized perl
38# patch11: added support for dbz
39#
132b68a5 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#
1c3d792e 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#
fe14fcc3 49# Revision 4.0 91/03/20 00:58:54 lwall
50# 4.0 baseline.
7e1cf235 51#
8d063cd8 52#
8d063cd8 53
54CC = $cc
d8f2e4cc 55YACC = $yacc
fe14fcc3 56bin = $installbin
79220ce3 57scriptdir = $scriptdir
fe14fcc3 58privlib = $installprivlib
8d063cd8 59mansrc = $mansrc
60manext = $manext
8d063cd8 61LDFLAGS = $ldflags
b6ccd89c 62CLDFLAGS = $ldflags
8d063cd8 63SMALL = $small
64LARGE = $large $split
a1cc2bdc 65mallocsrc = $mallocsrc
66mallocobj = $mallocobj
2e1b3b7e 67SLN = $sln
f1ca563b 68RMS = rm -f
8d063cd8 69
e5d73d77 70libs = $libs $cryptlib
8d063cd8 71
a687059c 72public = perl taintperl $suidperl
8d063cd8 73
b3634b01 74shellflags = $shellflags
75
132b68a5 76# To use an alternate make, set $altmake in config.sh.
77MAKE = ${altmake-make}
78
13281fa4 79!GROK!THIS!
8d063cd8 80
13281fa4 81cat >>Makefile <<'!NO!SUBS!'
1c3d792e 82
b3634b01 83CCCMD = `sh $(shellflags) cflags $@`
1c3d792e 84
8d063cd8 85private =
86
79220ce3 87scripts = h2ph
88
79220ce3 89manpages = perl.man h2ph.man
8d063cd8 90
91util =
92
79220ce3 93sh = Makefile.SH makedepend.SH h2ph.SH
8d063cd8 94
95h1 = EXTERN.h INTERN.h arg.h array.h cmd.h config.h form.h handy.h
a687059c 96h2 = hash.h perl.h regcomp.h regexp.h spat.h stab.h str.h util.h
8d063cd8 97
98h = $(h1) $(h2)
99
a687059c 100c1 = array.c cmd.c cons.c consarg.c doarg.c doio.c dolist.c dump.c
fe14fcc3 101c2 = eval.c form.c hash.c $(mallocsrc) perl.c regcomp.c regexec.c
b6ccd89c 102c3 = stab.c str.c toke.c util.c usersub.c
a687059c 103
104c = $(c1) $(c2) $(c3)
105
f1ca563b 106s1 = array.c cmd.c cons.c consarg.c doarg.c doio.c dolist.c dump.c
107s2 = eval.c form.c hash.c perl.c regcomp.c regexec.c
108s3 = stab.c str.c toke.c util.c usersub.c perly.c
109
110saber = $(s1) $(s2) $(s3)
111
a687059c 112obj1 = array.o cmd.o cons.o consarg.o doarg.o doio.o dolist.o dump.o
f1ca563b 113obj2 = eval.o form.o $(mallocobj) perl.o regcomp.o regexec.o
a687059c 114obj3 = stab.o str.o toke.o util.o
8d063cd8 115
a687059c 116obj = $(obj1) $(obj2) $(obj3)
8d063cd8 117
a687059c 118tobj1 = tarray.o tcmd.o tcons.o tconsarg.o tdoarg.o tdoio.o tdolist.o tdump.o
119tobj2 = teval.o tform.o thash.o $(mallocobj) tregcomp.o tregexec.o
120tobj3 = tstab.o tstr.o ttoke.o tutil.o
8d063cd8 121
a687059c 122tobj = $(tobj1) $(tobj2) $(tobj3)
8d063cd8 123
a687059c 124lintflags = -hbvxac
8d063cd8 125
126addedbyconf = Makefile.old bsd eunice filexp loc pdp11 usg v7
127
128# grrr
129SHELL = /bin/sh
130
131.c.o:
132b68a5 132 $(CCCMD) $*.c
8d063cd8 133
fe14fcc3 134all: $(public) $(private) $(util) uperl.o $(scripts)
a687059c 135 cd x2p; $(MAKE) all
d8f2e4cc 136 touch all
13281fa4 137
a687059c 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.
1c3d792e 140# The $& notation is tells Sequent machines that it can do a parallel make,
141# and is harmless otherwise.
13281fa4 142
f1ca563b 143perl: $& 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
148dbzperl: $& 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
151zhash.o: hash.c $(h)
152 $(RMS) zhash.c
153 $(SLN) hash.c zhash.c
154 $(CCCMD) -DWANT_DBZ zhash.c
155 $(RMS) zhash.c
79220ce3 156
f1ca563b 157uperl.o: $& perly.o $(obj) hash.o
158 -ld $(LARGE) $(LDFLAGS) -r $(obj) hash.o perly.o -o uperl.o
79220ce3 159
f1ca563b 160saber: $(saber)
161 # load $(saber)
162 # load /lib/libm.a
a687059c 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.
13281fa4 168
fe14fcc3 169suidperl: $& tperly.o sperl.o $(tobj) usersub.o
170 $(CC) $(LARGE) $(CLDFLAGS) sperl.o $(tobj) tperly.o usersub.o $(libs) \
79220ce3 171 -o suidperl
13281fa4 172
a687059c 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
fe14fcc3 178taintperl: $& tperly.o tperl.o $(tobj) usersub.o
179 $(CC) $(LARGE) $(CLDFLAGS) tperl.o $(tobj) tperly.o usersub.o $(libs) \
79220ce3 180 -o taintperl
a687059c 181
182# Replicating all this junk is yucky, but I don't see a portable way to fix it.
183
03a14243 184tperly.o: perly.c perly.h $(h)
f1ca563b 185 $(RMS) tperly.c
a687059c 186 $(SLN) perly.c tperly.c
132b68a5 187 $(CCCMD) -DTAINT tperly.c
f1ca563b 188 $(RMS) tperly.c
a687059c 189
fe14fcc3 190tperl.o: perl.c perly.h patchlevel.h perl.h $(h)
f1ca563b 191 $(RMS) tperl.c
fe14fcc3 192 $(SLN) perl.c tperl.c
132b68a5 193 $(CCCMD) -DTAINT tperl.c
f1ca563b 194 $(RMS) tperl.c
fe14fcc3 195
196sperl.o: perl.c perly.h patchlevel.h $(h)
f1ca563b 197 $(RMS) sperl.c
fe14fcc3 198 $(SLN) perl.c sperl.c
132b68a5 199 $(CCCMD) -DTAINT -DIAMSUID sperl.c
f1ca563b 200 $(RMS) sperl.c
13281fa4 201
03a14243 202tarray.o: array.c $(h)
f1ca563b 203 $(RMS) tarray.c
a687059c 204 $(SLN) array.c tarray.c
132b68a5 205 $(CCCMD) -DTAINT tarray.c
f1ca563b 206 $(RMS) tarray.c
a687059c 207
03a14243 208tcmd.o: cmd.c $(h)
f1ca563b 209 $(RMS) tcmd.c
a687059c 210 $(SLN) cmd.c tcmd.c
132b68a5 211 $(CCCMD) -DTAINT tcmd.c
f1ca563b 212 $(RMS) tcmd.c
a687059c 213
ff2452de 214tcons.o: cons.c $(h) perly.h
f1ca563b 215 $(RMS) tcons.c
a687059c 216 $(SLN) cons.c tcons.c
132b68a5 217 $(CCCMD) -DTAINT tcons.c
f1ca563b 218 $(RMS) tcons.c
a687059c 219
03a14243 220tconsarg.o: consarg.c $(h)
f1ca563b 221 $(RMS) tconsarg.c
a687059c 222 $(SLN) consarg.c tconsarg.c
132b68a5 223 $(CCCMD) -DTAINT tconsarg.c
f1ca563b 224 $(RMS) tconsarg.c
a687059c 225
03a14243 226tdoarg.o: doarg.c $(h)
f1ca563b 227 $(RMS) tdoarg.c
a687059c 228 $(SLN) doarg.c tdoarg.c
132b68a5 229 $(CCCMD) -DTAINT tdoarg.c
f1ca563b 230 $(RMS) tdoarg.c
a687059c 231
03a14243 232tdoio.o: doio.c $(h)
f1ca563b 233 $(RMS) tdoio.c
a687059c 234 $(SLN) doio.c tdoio.c
132b68a5 235 $(CCCMD) -DTAINT tdoio.c
f1ca563b 236 $(RMS) tdoio.c
a687059c 237
03a14243 238tdolist.o: dolist.c $(h)
f1ca563b 239 $(RMS) tdolist.c
a687059c 240 $(SLN) dolist.c tdolist.c
132b68a5 241 $(CCCMD) -DTAINT tdolist.c
f1ca563b 242 $(RMS) tdolist.c
a687059c 243
03a14243 244tdump.o: dump.c $(h)
f1ca563b 245 $(RMS) tdump.c
a687059c 246 $(SLN) dump.c tdump.c
132b68a5 247 $(CCCMD) -DTAINT tdump.c
f1ca563b 248 $(RMS) tdump.c
a687059c 249
03a14243 250teval.o: eval.c $(h)
f1ca563b 251 $(RMS) teval.c
a687059c 252 $(SLN) eval.c teval.c
132b68a5 253 $(CCCMD) -DTAINT teval.c
f1ca563b 254 $(RMS) teval.c
a687059c 255
03a14243 256tform.o: form.c $(h)
f1ca563b 257 $(RMS) tform.c
a687059c 258 $(SLN) form.c tform.c
132b68a5 259 $(CCCMD) -DTAINT tform.c
f1ca563b 260 $(RMS) tform.c
a687059c 261
03a14243 262thash.o: hash.c $(h)
f1ca563b 263 $(RMS) thash.c
a687059c 264 $(SLN) hash.c thash.c
132b68a5 265 $(CCCMD) -DTAINT thash.c
f1ca563b 266 $(RMS) thash.c
a687059c 267
03a14243 268tregcomp.o: regcomp.c $(h)
f1ca563b 269 $(RMS) tregcomp.c
a687059c 270 $(SLN) regcomp.c tregcomp.c
132b68a5 271 $(CCCMD) -DTAINT tregcomp.c
f1ca563b 272 $(RMS) tregcomp.c
a687059c 273
03a14243 274tregexec.o: regexec.c $(h)
f1ca563b 275 $(RMS) tregexec.c
a687059c 276 $(SLN) regexec.c tregexec.c
132b68a5 277 $(CCCMD) -DTAINT tregexec.c
f1ca563b 278 $(RMS) tregexec.c
a687059c 279
03a14243 280tstab.o: stab.c $(h)
f1ca563b 281 $(RMS) tstab.c
a687059c 282 $(SLN) stab.c tstab.c
132b68a5 283 $(CCCMD) -DTAINT tstab.c
f1ca563b 284 $(RMS) tstab.c
a687059c 285
ff2452de 286tstr.o: str.c $(h) perly.h
f1ca563b 287 $(RMS) tstr.c
a687059c 288 $(SLN) str.c tstr.c
132b68a5 289 $(CCCMD) -DTAINT tstr.c
f1ca563b 290 $(RMS) tstr.c
a687059c 291
ff2452de 292ttoke.o: toke.c $(h) perly.h
f1ca563b 293 $(RMS) ttoke.c
a687059c 294 $(SLN) toke.c ttoke.c
132b68a5 295 $(CCCMD) -DTAINT ttoke.c
f1ca563b 296 $(RMS) ttoke.c
a687059c 297
03a14243 298tutil.o: util.c $(h)
f1ca563b 299 $(RMS) tutil.c
a687059c 300 $(SLN) util.c tutil.c
132b68a5 301 $(CCCMD) -DTAINT tutil.c
f1ca563b 302 $(RMS) tutil.c
8d063cd8 303
fe14fcc3 304perly.h: perly.c
ff2452de 305 @ echo Dummy dependency for dumb parallel make
306 touch perly.h
307
132b68a5 308perly.c: perly.y perly.fixer
b3634b01 309 @ \
310case "$(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;; \
313esac
fe14fcc3 314 $(YACC) -d perly.y
b3634b01 315 sh $(shellflags) ./perly.fixer y.tab.c perly.c
378cc40b 316 mv y.tab.h perly.h
ff2452de 317 echo 'extern YYSTYPE yylval;' >>perly.h
8d063cd8 318
fe14fcc3 319perly.o: perly.c perly.h $(h)
132b68a5 320 $(CCCMD) perly.c
8d063cd8 321
a687059c 322install: all
7e1cf235 323 ./perl installperl
8d063cd8 324
325clean:
b3634b01 326 rm -f *.o all perl taintperl suidperl perly.c
a687059c 327 cd x2p; $(MAKE) clean
8d063cd8 328
b6ccd89c 329realclean: clean
a687059c 330 cd x2p; $(MAKE) realclean
b6ccd89c 331 rm -f *.orig */*.orig *~ */*~ core $(addedbyconf) h2ph h2ph.man
fe14fcc3 332 rm -f perly.c perly.h t/perl Makefile config.h makedepend makedir
132b68a5 333 rm -f makefile x2p/Makefile x2p/makefile cflags x2p/cflags
f1ca563b 334 rm -f c2ph pstruct
8d063cd8 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
fe14fcc3 341lint: perly.c $(c)
342 lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
8d063cd8 343
344depend: makedepend
378cc40b 345 - test -f perly.h || cp /dev/null perly.h
fdf95cbb 346 ./makedepend
378cc40b 347 - test -s perly.h || /bin/rm -f perly.h
a687059c 348 cd x2p; $(MAKE) depend
8d063cd8 349
350test: perl
fe14fcc3 351 - cd t && chmod +x TEST */*.t
b3634b01 352 - cd t && (rm -f perl; $(SLN) ../perl perl) && ./perl TEST </dev/tty
8d063cd8 353
354clist:
355 echo $(c) | tr ' ' '\012' >.clist
356
357hlist:
358 echo $(h) | tr ' ' '\012' >.hlist
359
360shlist:
361 echo $(sh) | tr ' ' '\012' >.shlist
362
363# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
f1ca563b 364$(obj) hash.o:
8d063cd8 365 @ echo "You haven't done a "'"make depend" yet!'; exit 1
366makedepend: makedepend.SH
b3634b01 367 /bin/sh $(shellflags) makedepend.SH
8d063cd8 368!NO!SUBS!
369$eunicefix Makefile
370case `pwd` in
371*SH)
372 $rm -f ../Makefile
373 ln Makefile ../Makefile
374 ;;
375esac
f1ca563b 376rm -f makefile