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