perl 4.0.00: (no release announcement available)
[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!
fe14fcc3 28# $Header: Makefile.SH,v 4.0 91/03/20 00:58:54 lwall Locked $
8d063cd8 29#
30# $Log: Makefile.SH,v $
fe14fcc3 31# Revision 4.0 91/03/20 00:58:54 lwall
32# 4.0 baseline.
7e1cf235 33#
8d063cd8 34#
8d063cd8 35
36CC = $cc
d8f2e4cc 37YACC = $yacc
fe14fcc3 38bin = $installbin
79220ce3 39scriptdir = $scriptdir
fe14fcc3 40privlib = $installprivlib
8d063cd8 41mansrc = $mansrc
42manext = $manext
91407755 43CFLAGS = $ccflags $optimize
8d063cd8 44LDFLAGS = $ldflags
b6ccd89c 45CLDFLAGS = $ldflags
8d063cd8 46SMALL = $small
47LARGE = $large $split
a1cc2bdc 48mallocsrc = $mallocsrc
49mallocobj = $mallocobj
2e1b3b7e 50SLN = $sln
8d063cd8 51
e5d73d77 52libs = $libs $cryptlib
8d063cd8 53
a687059c 54public = perl taintperl $suidperl
8d063cd8 55
13281fa4 56!GROK!THIS!
8d063cd8 57
13281fa4 58cat >>Makefile <<'!NO!SUBS!'
8d063cd8 59private =
60
79220ce3 61scripts = h2ph
62
a687059c 63MAKE = make
64
79220ce3 65manpages = perl.man h2ph.man
8d063cd8 66
67util =
68
79220ce3 69sh = Makefile.SH makedepend.SH h2ph.SH
8d063cd8 70
71h1 = EXTERN.h INTERN.h arg.h array.h cmd.h config.h form.h handy.h
a687059c 72h2 = hash.h perl.h regcomp.h regexp.h spat.h stab.h str.h util.h
8d063cd8 73
74h = $(h1) $(h2)
75
a687059c 76c1 = array.c cmd.c cons.c consarg.c doarg.c doio.c dolist.c dump.c
fe14fcc3 77c2 = eval.c form.c hash.c $(mallocsrc) perl.c regcomp.c regexec.c
b6ccd89c 78c3 = stab.c str.c toke.c util.c usersub.c
a687059c 79
80c = $(c1) $(c2) $(c3)
81
82obj1 = array.o cmd.o cons.o consarg.o doarg.o doio.o dolist.o dump.o
fe14fcc3 83obj2 = eval.o form.o hash.o $(mallocobj) perl.o regcomp.o regexec.o
a687059c 84obj3 = stab.o str.o toke.o util.o
8d063cd8 85
a687059c 86obj = $(obj1) $(obj2) $(obj3)
8d063cd8 87
a687059c 88tobj1 = tarray.o tcmd.o tcons.o tconsarg.o tdoarg.o tdoio.o tdolist.o tdump.o
89tobj2 = teval.o tform.o thash.o $(mallocobj) tregcomp.o tregexec.o
90tobj3 = tstab.o tstr.o ttoke.o tutil.o
8d063cd8 91
a687059c 92tobj = $(tobj1) $(tobj2) $(tobj3)
8d063cd8 93
a687059c 94lintflags = -hbvxac
8d063cd8 95
96addedbyconf = Makefile.old bsd eunice filexp loc pdp11 usg v7
97
98# grrr
99SHELL = /bin/sh
100
101.c.o:
102 $(CC) -c $(CFLAGS) $(LARGE) $*.c
103
fe14fcc3 104all: $(public) $(private) $(util) uperl.o $(scripts)
a687059c 105 cd x2p; $(MAKE) all
d8f2e4cc 106 touch all
13281fa4 107
a687059c 108# This is the standard version that contains no "taint" checks and is
109# used for all scripts that aren't set-id or running under something set-id.
13281fa4 110
fe14fcc3 111perl: $& perly.o $(obj) usersub.o
112 $(CC) $(LARGE) $(CLDFLAGS) $(obj) perly.o usersub.o $(libs) -o perl
79220ce3 113
fe14fcc3 114uperl.o: $& perly.o $(obj)
115 -ld $(LARGE) $(LDFLAGS) -r $(obj) perly.o $(libs) -o uperl.o
79220ce3 116
fe14fcc3 117saber: perly.c
118 # load $(c) perly.c
a687059c 119
120# This version, if specified in Configure, does ONLY those scripts which need
121# set-id emulation. Suidperl must be setuid root. It contains the "taint"
122# checks as well as the special code to validate that the script in question
123# has been invoked correctly.
13281fa4 124
fe14fcc3 125suidperl: $& tperly.o sperl.o $(tobj) usersub.o
126 $(CC) $(LARGE) $(CLDFLAGS) sperl.o $(tobj) tperly.o usersub.o $(libs) \
79220ce3 127 -o suidperl
13281fa4 128
a687059c 129# This version interprets scripts that are already set-id either via a wrapper
130# or through the kernel allowing set-id scripts (bad idea). Taintperl must
131# NOT be setuid to root or anything else. The only difference between it
132# and normal perl is the presence of the "taint" checks.
133
fe14fcc3 134taintperl: $& tperly.o tperl.o $(tobj) usersub.o
135 $(CC) $(LARGE) $(CLDFLAGS) tperl.o $(tobj) tperly.o usersub.o $(libs) \
79220ce3 136 -o taintperl
a687059c 137
138# Replicating all this junk is yucky, but I don't see a portable way to fix it.
139
03a14243 140tperly.o: perly.c perly.h $(h)
a687059c 141 /bin/rm -f tperly.c
142 $(SLN) perly.c tperly.c
143 $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tperly.c
144 /bin/rm -f tperly.c
145
fe14fcc3 146tperl.o: perl.c perly.h patchlevel.h perl.h $(h)
147 /bin/rm -f tperl.c
148 $(SLN) perl.c tperl.c
149 $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tperl.c
150 /bin/rm -f tperl.c
151
152sperl.o: perl.c perly.h patchlevel.h $(h)
153 /bin/rm -f sperl.c
154 $(SLN) perl.c sperl.c
155 $(CC) -c -DTAINT -DIAMSUID $(CFLAGS) $(LARGE) sperl.c
156 /bin/rm -f sperl.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
ff2452de 170tcons.o: cons.c $(h) perly.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
ff2452de 242tstr.o: str.c $(h) perly.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
ff2452de 248ttoke.o: toke.c $(h) perly.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
fe14fcc3 260perly.h: perly.c
ff2452de 261 @ echo Dummy dependency for dumb parallel make
262 touch perly.h
263
fe14fcc3 264perly.c: perly.y
6eb13c3b 265 @ echo 'Expect either' 29 shift/reduce and 59 reduce/reduce conflicts...
266 @ echo ' or' 27 shift/reduce and 61 reduce/reduce conflicts...
fe14fcc3 267 $(YACC) -d perly.y
268 sh perly.fixer y.tab.c perly.c
378cc40b 269 mv y.tab.h perly.h
ff2452de 270 echo 'extern YYSTYPE yylval;' >>perly.h
8d063cd8 271
fe14fcc3 272perly.o: perly.c perly.h $(h)
273 $(CC) -c $(CFLAGS) $(LARGE) perly.c
8d063cd8 274
a687059c 275install: all
7e1cf235 276 ./perl installperl
a687059c 277 cd x2p; $(MAKE) install
8d063cd8 278
279clean:
fe14fcc3 280 rm -f *.o all perl taintperl suidperl
a687059c 281 cd x2p; $(MAKE) clean
8d063cd8 282
b6ccd89c 283realclean: clean
a687059c 284 cd x2p; $(MAKE) realclean
b6ccd89c 285 rm -f *.orig */*.orig *~ */*~ core $(addedbyconf) h2ph h2ph.man
fe14fcc3 286 rm -f perly.c perly.h t/perl Makefile config.h makedepend makedir
a687059c 287 rm -f x2p/Makefile
8d063cd8 288
289# The following lint has practically everything turned on. Unfortunately,
290# you have to wade through a lot of mumbo jumbo that can't be suppressed.
291# If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
292# for that spot.
293
fe14fcc3 294lint: perly.c $(c)
295 lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
8d063cd8 296
297depend: makedepend
378cc40b 298 - test -f perly.h || cp /dev/null perly.h
fdf95cbb 299 ./makedepend
378cc40b 300 - test -s perly.h || /bin/rm -f perly.h
a687059c 301 cd x2p; $(MAKE) depend
8d063cd8 302
303test: perl
fe14fcc3 304 - cd t && chmod +x TEST */*.t
305 - cd t && (rm -f perl; $(SLN) ../perl .) && ./perl TEST </dev/tty
8d063cd8 306
307clist:
308 echo $(c) | tr ' ' '\012' >.clist
309
310hlist:
311 echo $(h) | tr ' ' '\012' >.hlist
312
313shlist:
314 echo $(sh) | tr ' ' '\012' >.shlist
315
316# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
d8f2e4cc 317$(obj):
8d063cd8 318 @ echo "You haven't done a "'"make depend" yet!'; exit 1
319makedepend: makedepend.SH
320 /bin/sh makedepend.SH
321!NO!SUBS!
322$eunicefix Makefile
323case `pwd` in
324*SH)
325 $rm -f ../Makefile
326 ln Makefile ../Makefile
327 ;;
328esac