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