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