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