perl 4.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)
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)"
27cat >Makefile <<!GROK!THIS!
f1ca563b 28# $RCSfile: Makefile.SH,v $$Revision: 4.0.1.3 $$Date: 91/11/05 15:48:11 $
8d063cd8 29#
30# $Log: Makefile.SH,v $
f1ca563b 31# Revision 4.0.1.3 91/11/05 15:48:11 lwall
32# patch11: saberized perl
33# patch11: added support for dbz
34#
132b68a5 35# Revision 4.0.1.2 91/06/07 10:14:43 lwall
36# patch4: cflags now emits entire cc command except for the filename
37# patch4: alternate make programs are now semi-supported
38# patch4: uperl.o no longer tries to link in libraries prematurely
39# patch4: installperl now installs x2p stuff too
40#
1c3d792e 41# Revision 4.0.1.1 91/04/11 17:30:39 lwall
42# patch1: C flags are now settable on a per-file basis
43#
fe14fcc3 44# Revision 4.0 91/03/20 00:58:54 lwall
45# 4.0 baseline.
7e1cf235 46#
8d063cd8 47#
8d063cd8 48
49CC = $cc
d8f2e4cc 50YACC = $yacc
fe14fcc3 51bin = $installbin
79220ce3 52scriptdir = $scriptdir
fe14fcc3 53privlib = $installprivlib
8d063cd8 54mansrc = $mansrc
55manext = $manext
8d063cd8 56LDFLAGS = $ldflags
b6ccd89c 57CLDFLAGS = $ldflags
8d063cd8 58SMALL = $small
59LARGE = $large $split
a1cc2bdc 60mallocsrc = $mallocsrc
61mallocobj = $mallocobj
2e1b3b7e 62SLN = $sln
f1ca563b 63RMS = rm -f
8d063cd8 64
e5d73d77 65libs = $libs $cryptlib
8d063cd8 66
a687059c 67public = perl taintperl $suidperl
8d063cd8 68
132b68a5 69# To use an alternate make, set $altmake in config.sh.
70MAKE = ${altmake-make}
71
13281fa4 72!GROK!THIS!
8d063cd8 73
13281fa4 74cat >>Makefile <<'!NO!SUBS!'
1c3d792e 75
132b68a5 76CCCMD = `sh cflags $@`
1c3d792e 77
8d063cd8 78private =
79
79220ce3 80scripts = h2ph
81
79220ce3 82manpages = perl.man h2ph.man
8d063cd8 83
84util =
85
79220ce3 86sh = Makefile.SH makedepend.SH h2ph.SH
8d063cd8 87
88h1 = EXTERN.h INTERN.h arg.h array.h cmd.h config.h form.h handy.h
a687059c 89h2 = hash.h perl.h regcomp.h regexp.h spat.h stab.h str.h util.h
8d063cd8 90
91h = $(h1) $(h2)
92
a687059c 93c1 = array.c cmd.c cons.c consarg.c doarg.c doio.c dolist.c dump.c
fe14fcc3 94c2 = eval.c form.c hash.c $(mallocsrc) perl.c regcomp.c regexec.c
b6ccd89c 95c3 = stab.c str.c toke.c util.c usersub.c
a687059c 96
97c = $(c1) $(c2) $(c3)
98
f1ca563b 99s1 = array.c cmd.c cons.c consarg.c doarg.c doio.c dolist.c dump.c
100s2 = eval.c form.c hash.c perl.c regcomp.c regexec.c
101s3 = stab.c str.c toke.c util.c usersub.c perly.c
102
103saber = $(s1) $(s2) $(s3)
104
a687059c 105obj1 = array.o cmd.o cons.o consarg.o doarg.o doio.o dolist.o dump.o
f1ca563b 106obj2 = eval.o form.o $(mallocobj) perl.o regcomp.o regexec.o
a687059c 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:
132b68a5 125 $(CCCMD) $*.c
8d063cd8 126
fe14fcc3 127all: $(public) $(private) $(util) 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.
1c3d792e 133# The $& notation is tells Sequent machines that it can do a parallel make,
134# and is harmless otherwise.
13281fa4 135
f1ca563b 136perl: $& perly.o $(obj) hash.o usersub.o
137 $(CC) $(LARGE) $(CLDFLAGS) $(obj) hash.o perly.o usersub.o $(libs) -o perl
138
139# This command assumes that /usr/include/dbz.h and /usr/lib/dbz.o exist.
140
141dbzperl: $& perly.o $(obj) zhash.o usersub.o
142 $(CC) $(LARGE) $(CLDFLAGS) $(obj) zhash.o /usr/lib/dbz.o perly.o usersub.o $(libs) -o dbzperl
143
144zhash.o: hash.c $(h)
145 $(RMS) zhash.c
146 $(SLN) hash.c zhash.c
147 $(CCCMD) -DWANT_DBZ zhash.c
148 $(RMS) zhash.c
79220ce3 149
f1ca563b 150uperl.o: $& perly.o $(obj) hash.o
151 -ld $(LARGE) $(LDFLAGS) -r $(obj) hash.o perly.o -o uperl.o
79220ce3 152
f1ca563b 153saber: $(saber)
154 # load $(saber)
155 # load /lib/libm.a
a687059c 156
157# This version, if specified in Configure, does ONLY those scripts which need
158# set-id emulation. Suidperl must be setuid root. It contains the "taint"
159# checks as well as the special code to validate that the script in question
160# has been invoked correctly.
13281fa4 161
fe14fcc3 162suidperl: $& tperly.o sperl.o $(tobj) usersub.o
163 $(CC) $(LARGE) $(CLDFLAGS) sperl.o $(tobj) tperly.o usersub.o $(libs) \
79220ce3 164 -o suidperl
13281fa4 165
a687059c 166# This version interprets scripts that are already set-id either via a wrapper
167# or through the kernel allowing set-id scripts (bad idea). Taintperl must
168# NOT be setuid to root or anything else. The only difference between it
169# and normal perl is the presence of the "taint" checks.
170
fe14fcc3 171taintperl: $& tperly.o tperl.o $(tobj) usersub.o
172 $(CC) $(LARGE) $(CLDFLAGS) tperl.o $(tobj) tperly.o usersub.o $(libs) \
79220ce3 173 -o taintperl
a687059c 174
175# Replicating all this junk is yucky, but I don't see a portable way to fix it.
176
03a14243 177tperly.o: perly.c perly.h $(h)
f1ca563b 178 $(RMS) tperly.c
a687059c 179 $(SLN) perly.c tperly.c
132b68a5 180 $(CCCMD) -DTAINT tperly.c
f1ca563b 181 $(RMS) tperly.c
a687059c 182
fe14fcc3 183tperl.o: perl.c perly.h patchlevel.h perl.h $(h)
f1ca563b 184 $(RMS) tperl.c
fe14fcc3 185 $(SLN) perl.c tperl.c
132b68a5 186 $(CCCMD) -DTAINT tperl.c
f1ca563b 187 $(RMS) tperl.c
fe14fcc3 188
189sperl.o: perl.c perly.h patchlevel.h $(h)
f1ca563b 190 $(RMS) sperl.c
fe14fcc3 191 $(SLN) perl.c sperl.c
132b68a5 192 $(CCCMD) -DTAINT -DIAMSUID sperl.c
f1ca563b 193 $(RMS) sperl.c
13281fa4 194
03a14243 195tarray.o: array.c $(h)
f1ca563b 196 $(RMS) tarray.c
a687059c 197 $(SLN) array.c tarray.c
132b68a5 198 $(CCCMD) -DTAINT tarray.c
f1ca563b 199 $(RMS) tarray.c
a687059c 200
03a14243 201tcmd.o: cmd.c $(h)
f1ca563b 202 $(RMS) tcmd.c
a687059c 203 $(SLN) cmd.c tcmd.c
132b68a5 204 $(CCCMD) -DTAINT tcmd.c
f1ca563b 205 $(RMS) tcmd.c
a687059c 206
ff2452de 207tcons.o: cons.c $(h) perly.h
f1ca563b 208 $(RMS) tcons.c
a687059c 209 $(SLN) cons.c tcons.c
132b68a5 210 $(CCCMD) -DTAINT tcons.c
f1ca563b 211 $(RMS) tcons.c
a687059c 212
03a14243 213tconsarg.o: consarg.c $(h)
f1ca563b 214 $(RMS) tconsarg.c
a687059c 215 $(SLN) consarg.c tconsarg.c
132b68a5 216 $(CCCMD) -DTAINT tconsarg.c
f1ca563b 217 $(RMS) tconsarg.c
a687059c 218
03a14243 219tdoarg.o: doarg.c $(h)
f1ca563b 220 $(RMS) tdoarg.c
a687059c 221 $(SLN) doarg.c tdoarg.c
132b68a5 222 $(CCCMD) -DTAINT tdoarg.c
f1ca563b 223 $(RMS) tdoarg.c
a687059c 224
03a14243 225tdoio.o: doio.c $(h)
f1ca563b 226 $(RMS) tdoio.c
a687059c 227 $(SLN) doio.c tdoio.c
132b68a5 228 $(CCCMD) -DTAINT tdoio.c
f1ca563b 229 $(RMS) tdoio.c
a687059c 230
03a14243 231tdolist.o: dolist.c $(h)
f1ca563b 232 $(RMS) tdolist.c
a687059c 233 $(SLN) dolist.c tdolist.c
132b68a5 234 $(CCCMD) -DTAINT tdolist.c
f1ca563b 235 $(RMS) tdolist.c
a687059c 236
03a14243 237tdump.o: dump.c $(h)
f1ca563b 238 $(RMS) tdump.c
a687059c 239 $(SLN) dump.c tdump.c
132b68a5 240 $(CCCMD) -DTAINT tdump.c
f1ca563b 241 $(RMS) tdump.c
a687059c 242
03a14243 243teval.o: eval.c $(h)
f1ca563b 244 $(RMS) teval.c
a687059c 245 $(SLN) eval.c teval.c
132b68a5 246 $(CCCMD) -DTAINT teval.c
f1ca563b 247 $(RMS) teval.c
a687059c 248
03a14243 249tform.o: form.c $(h)
f1ca563b 250 $(RMS) tform.c
a687059c 251 $(SLN) form.c tform.c
132b68a5 252 $(CCCMD) -DTAINT tform.c
f1ca563b 253 $(RMS) tform.c
a687059c 254
03a14243 255thash.o: hash.c $(h)
f1ca563b 256 $(RMS) thash.c
a687059c 257 $(SLN) hash.c thash.c
132b68a5 258 $(CCCMD) -DTAINT thash.c
f1ca563b 259 $(RMS) thash.c
a687059c 260
03a14243 261tregcomp.o: regcomp.c $(h)
f1ca563b 262 $(RMS) tregcomp.c
a687059c 263 $(SLN) regcomp.c tregcomp.c
132b68a5 264 $(CCCMD) -DTAINT tregcomp.c
f1ca563b 265 $(RMS) tregcomp.c
a687059c 266
03a14243 267tregexec.o: regexec.c $(h)
f1ca563b 268 $(RMS) tregexec.c
a687059c 269 $(SLN) regexec.c tregexec.c
132b68a5 270 $(CCCMD) -DTAINT tregexec.c
f1ca563b 271 $(RMS) tregexec.c
a687059c 272
03a14243 273tstab.o: stab.c $(h)
f1ca563b 274 $(RMS) tstab.c
a687059c 275 $(SLN) stab.c tstab.c
132b68a5 276 $(CCCMD) -DTAINT tstab.c
f1ca563b 277 $(RMS) tstab.c
a687059c 278
ff2452de 279tstr.o: str.c $(h) perly.h
f1ca563b 280 $(RMS) tstr.c
a687059c 281 $(SLN) str.c tstr.c
132b68a5 282 $(CCCMD) -DTAINT tstr.c
f1ca563b 283 $(RMS) tstr.c
a687059c 284
ff2452de 285ttoke.o: toke.c $(h) perly.h
f1ca563b 286 $(RMS) ttoke.c
a687059c 287 $(SLN) toke.c ttoke.c
132b68a5 288 $(CCCMD) -DTAINT ttoke.c
f1ca563b 289 $(RMS) ttoke.c
a687059c 290
03a14243 291tutil.o: util.c $(h)
f1ca563b 292 $(RMS) tutil.c
a687059c 293 $(SLN) util.c tutil.c
132b68a5 294 $(CCCMD) -DTAINT tutil.c
f1ca563b 295 $(RMS) tutil.c
8d063cd8 296
fe14fcc3 297perly.h: perly.c
ff2452de 298 @ echo Dummy dependency for dumb parallel make
299 touch perly.h
300
132b68a5 301perly.c: perly.y perly.fixer
6eb13c3b 302 @ echo 'Expect either' 29 shift/reduce and 59 reduce/reduce conflicts...
303 @ echo ' or' 27 shift/reduce and 61 reduce/reduce conflicts...
fe14fcc3 304 $(YACC) -d perly.y
132b68a5 305 sh ./perly.fixer y.tab.c perly.c
378cc40b 306 mv y.tab.h perly.h
ff2452de 307 echo 'extern YYSTYPE yylval;' >>perly.h
8d063cd8 308
fe14fcc3 309perly.o: perly.c perly.h $(h)
132b68a5 310 $(CCCMD) perly.c
8d063cd8 311
a687059c 312install: all
7e1cf235 313 ./perl installperl
8d063cd8 314
315clean:
fe14fcc3 316 rm -f *.o all perl taintperl suidperl
a687059c 317 cd x2p; $(MAKE) clean
8d063cd8 318
b6ccd89c 319realclean: clean
a687059c 320 cd x2p; $(MAKE) realclean
b6ccd89c 321 rm -f *.orig */*.orig *~ */*~ core $(addedbyconf) h2ph h2ph.man
fe14fcc3 322 rm -f perly.c perly.h t/perl Makefile config.h makedepend makedir
132b68a5 323 rm -f makefile x2p/Makefile x2p/makefile cflags x2p/cflags
f1ca563b 324 rm -f c2ph pstruct
8d063cd8 325
326# The following lint has practically everything turned on. Unfortunately,
327# you have to wade through a lot of mumbo jumbo that can't be suppressed.
328# If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
329# for that spot.
330
fe14fcc3 331lint: perly.c $(c)
332 lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
8d063cd8 333
334depend: makedepend
378cc40b 335 - test -f perly.h || cp /dev/null perly.h
fdf95cbb 336 ./makedepend
378cc40b 337 - test -s perly.h || /bin/rm -f perly.h
a687059c 338 cd x2p; $(MAKE) depend
8d063cd8 339
340test: perl
fe14fcc3 341 - cd t && chmod +x TEST */*.t
342 - cd t && (rm -f perl; $(SLN) ../perl .) && ./perl TEST </dev/tty
8d063cd8 343
344clist:
345 echo $(c) | tr ' ' '\012' >.clist
346
347hlist:
348 echo $(h) | tr ' ' '\012' >.hlist
349
350shlist:
351 echo $(sh) | tr ' ' '\012' >.shlist
352
353# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
f1ca563b 354$(obj) hash.o:
8d063cd8 355 @ echo "You haven't done a "'"make depend" yet!'; exit 1
356makedepend: makedepend.SH
357 /bin/sh makedepend.SH
358!NO!SUBS!
359$eunicefix Makefile
360case `pwd` in
361*SH)
362 $rm -f ../Makefile
363 ln Makefile ../Makefile
364 ;;
365esac
f1ca563b 366rm -f makefile