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