perl 4.0 patch 4: (combined patch)
[p5sagit/p5-mst-13.2.git] / Makefile.SH
1 case $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 2>/dev/null
9     . ./config.sh
10     ;;
11 esac
12 case "$0" in
13 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
14 esac
15
16 case "$d_symlink" in
17 *define*) sln='ln -s' ;;
18 *) sln='ln';;
19 esac
20
21 case "$d_dosuid" in
22 *define*) suidperl='suidperl' ;;
23 *) suidperl='';;
24 esac
25
26 echo "Extracting Makefile (with variable substitutions)"
27 cat >Makefile <<!GROK!THIS!
28 # $RCSfile: Makefile.SH,v $$Revision: 4.0.1.2 $$Date: 91/06/07 10:14:43 $
29 #
30 # $Log: Makefile.SH,v $
31 # Revision 4.0.1.2  91/06/07  10:14:43  lwall
32 # patch4: cflags now emits entire cc command except for the filename
33 # patch4: alternate make programs are now semi-supported
34 # patch4: uperl.o no longer tries to link in libraries prematurely
35 # patch4: installperl now installs x2p stuff too
36
37 # Revision 4.0.1.1  91/04/11  17:30:39  lwall
38 # patch1: C flags are now settable on a per-file basis
39
40 # Revision 4.0  91/03/20  00:58:54  lwall
41 # 4.0 baseline.
42
43
44
45 CC = $cc
46 YACC = $yacc
47 bin = $installbin
48 scriptdir = $scriptdir
49 privlib = $installprivlib
50 mansrc = $mansrc
51 manext = $manext
52 LDFLAGS = $ldflags
53 CLDFLAGS = $ldflags
54 SMALL = $small
55 LARGE = $large $split
56 mallocsrc = $mallocsrc
57 mallocobj = $mallocobj
58 SLN = $sln
59
60 libs = $libs $cryptlib
61
62 public = perl taintperl $suidperl
63
64 # To use an alternate make, set $altmake in config.sh.
65 MAKE = ${altmake-make}
66
67 !GROK!THIS!
68
69 cat >>Makefile <<'!NO!SUBS!'
70
71 CCCMD = `sh cflags $@`
72
73 private = 
74
75 scripts = h2ph
76
77 manpages = perl.man h2ph.man
78
79 util =
80
81 sh = Makefile.SH makedepend.SH h2ph.SH
82
83 h1 = EXTERN.h INTERN.h arg.h array.h cmd.h config.h form.h handy.h
84 h2 = hash.h perl.h regcomp.h regexp.h spat.h stab.h str.h util.h
85
86 h = $(h1) $(h2)
87
88 c1 = array.c cmd.c cons.c consarg.c doarg.c doio.c dolist.c dump.c
89 c2 = eval.c form.c hash.c $(mallocsrc) perl.c regcomp.c regexec.c
90 c3 = stab.c str.c toke.c util.c usersub.c
91
92 c = $(c1) $(c2) $(c3)
93
94 obj1 = array.o cmd.o cons.o consarg.o doarg.o doio.o dolist.o dump.o
95 obj2 = eval.o form.o hash.o $(mallocobj) perl.o regcomp.o regexec.o
96 obj3 = stab.o str.o toke.o util.o
97
98 obj = $(obj1) $(obj2) $(obj3)
99
100 tobj1 = tarray.o tcmd.o tcons.o tconsarg.o tdoarg.o tdoio.o tdolist.o tdump.o
101 tobj2 = teval.o tform.o thash.o $(mallocobj) tregcomp.o tregexec.o
102 tobj3 = tstab.o tstr.o ttoke.o tutil.o
103
104 tobj = $(tobj1) $(tobj2) $(tobj3)
105
106 lintflags = -hbvxac
107
108 addedbyconf = Makefile.old bsd eunice filexp loc pdp11 usg v7
109
110 # grrr
111 SHELL = /bin/sh
112
113 .c.o:
114         $(CCCMD) $*.c
115
116 all: $(public) $(private) $(util) uperl.o $(scripts)
117         cd x2p; $(MAKE) all
118         touch all
119
120 # This is the standard version that contains no "taint" checks and is
121 # used for all scripts that aren't set-id or running under something set-id.
122 # The $& notation is tells Sequent machines that it can do a parallel make,
123 # and is harmless otherwise.
124
125 perl: $& perly.o $(obj) usersub.o
126         $(CC) $(LARGE) $(CLDFLAGS) $(obj) perly.o usersub.o $(libs) -o perl
127
128 uperl.o: $& perly.o $(obj)
129         -ld $(LARGE) $(LDFLAGS) -r $(obj) perly.o -o uperl.o
130
131 saber: perly.c
132         # load $(c) perly.c
133
134 # This version, if specified in Configure, does ONLY those scripts which need
135 # set-id emulation.  Suidperl must be setuid root.  It contains the "taint"
136 # checks as well as the special code to validate that the script in question
137 # has been invoked correctly.
138
139 suidperl: $& tperly.o sperl.o $(tobj) usersub.o
140         $(CC) $(LARGE) $(CLDFLAGS) sperl.o $(tobj) tperly.o usersub.o $(libs) \
141             -o suidperl
142
143 # This version interprets scripts that are already set-id either via a wrapper
144 # or through the kernel allowing set-id scripts (bad idea).  Taintperl must
145 # NOT be setuid to root or anything else.  The only difference between it
146 # and normal perl is the presence of the "taint" checks.
147
148 taintperl: $& tperly.o tperl.o $(tobj) usersub.o
149         $(CC) $(LARGE) $(CLDFLAGS) tperl.o $(tobj) tperly.o usersub.o $(libs) \
150             -o taintperl
151
152 # Replicating all this junk is yucky, but I don't see a portable way to fix it.
153
154 tperly.o: perly.c perly.h $(h)
155         /bin/rm -f tperly.c
156         $(SLN) perly.c tperly.c
157         $(CCCMD) -DTAINT tperly.c
158         /bin/rm -f tperly.c
159
160 tperl.o: perl.c perly.h patchlevel.h perl.h $(h)
161         /bin/rm -f tperl.c
162         $(SLN) perl.c tperl.c
163         $(CCCMD) -DTAINT tperl.c
164         /bin/rm -f tperl.c
165
166 sperl.o: perl.c perly.h patchlevel.h $(h)
167         /bin/rm -f sperl.c
168         $(SLN) perl.c sperl.c
169         $(CCCMD) -DTAINT -DIAMSUID sperl.c
170         /bin/rm -f sperl.c
171
172 tarray.o: array.c $(h)
173         /bin/rm -f tarray.c
174         $(SLN) array.c tarray.c
175         $(CCCMD) -DTAINT tarray.c
176         /bin/rm -f tarray.c
177
178 tcmd.o: cmd.c $(h)
179         /bin/rm -f tcmd.c
180         $(SLN) cmd.c tcmd.c
181         $(CCCMD) -DTAINT tcmd.c
182         /bin/rm -f tcmd.c
183
184 tcons.o: cons.c $(h) perly.h
185         /bin/rm -f tcons.c
186         $(SLN) cons.c tcons.c
187         $(CCCMD) -DTAINT tcons.c
188         /bin/rm -f tcons.c
189
190 tconsarg.o: consarg.c $(h)
191         /bin/rm -f tconsarg.c
192         $(SLN) consarg.c tconsarg.c
193         $(CCCMD) -DTAINT tconsarg.c
194         /bin/rm -f tconsarg.c
195
196 tdoarg.o: doarg.c $(h)
197         /bin/rm -f tdoarg.c
198         $(SLN) doarg.c tdoarg.c
199         $(CCCMD) -DTAINT tdoarg.c
200         /bin/rm -f tdoarg.c
201
202 tdoio.o: doio.c $(h)
203         /bin/rm -f tdoio.c
204         $(SLN) doio.c tdoio.c
205         $(CCCMD) -DTAINT tdoio.c
206         /bin/rm -f tdoio.c
207
208 tdolist.o: dolist.c $(h)
209         /bin/rm -f tdolist.c
210         $(SLN) dolist.c tdolist.c
211         $(CCCMD) -DTAINT tdolist.c
212         /bin/rm -f tdolist.c
213
214 tdump.o: dump.c $(h)
215         /bin/rm -f tdump.c
216         $(SLN) dump.c tdump.c
217         $(CCCMD) -DTAINT tdump.c
218         /bin/rm -f tdump.c
219
220 teval.o: eval.c $(h)
221         /bin/rm -f teval.c
222         $(SLN) eval.c teval.c
223         $(CCCMD) -DTAINT teval.c
224         /bin/rm -f teval.c
225
226 tform.o: form.c $(h)
227         /bin/rm -f tform.c
228         $(SLN) form.c tform.c
229         $(CCCMD) -DTAINT tform.c
230         /bin/rm -f tform.c
231
232 thash.o: hash.c $(h)
233         /bin/rm -f thash.c
234         $(SLN) hash.c thash.c
235         $(CCCMD) -DTAINT thash.c
236         /bin/rm -f thash.c
237
238 tregcomp.o: regcomp.c $(h)
239         /bin/rm -f tregcomp.c
240         $(SLN) regcomp.c tregcomp.c
241         $(CCCMD) -DTAINT tregcomp.c
242         /bin/rm -f tregcomp.c
243
244 tregexec.o: regexec.c $(h)
245         /bin/rm -f tregexec.c
246         $(SLN) regexec.c tregexec.c
247         $(CCCMD) -DTAINT tregexec.c
248         /bin/rm -f tregexec.c
249
250 tstab.o: stab.c $(h)
251         /bin/rm -f tstab.c
252         $(SLN) stab.c tstab.c
253         $(CCCMD) -DTAINT tstab.c
254         /bin/rm -f tstab.c
255
256 tstr.o: str.c $(h) perly.h
257         /bin/rm -f tstr.c
258         $(SLN) str.c tstr.c
259         $(CCCMD) -DTAINT tstr.c
260         /bin/rm -f tstr.c
261
262 ttoke.o: toke.c $(h) perly.h
263         /bin/rm -f ttoke.c
264         $(SLN) toke.c ttoke.c
265         $(CCCMD) -DTAINT ttoke.c
266         /bin/rm -f ttoke.c
267
268 tutil.o: util.c $(h)
269         /bin/rm -f tutil.c
270         $(SLN) util.c tutil.c
271         $(CCCMD) -DTAINT tutil.c
272         /bin/rm -f tutil.c
273
274 perly.h: perly.c
275         @ echo Dummy dependency for dumb parallel make
276         touch perly.h
277
278 perly.c: perly.y perly.fixer
279         @ echo 'Expect either' 29 shift/reduce and 59 reduce/reduce conflicts...
280         @ echo '           or' 27 shift/reduce and 61 reduce/reduce conflicts...
281         $(YACC) -d perly.y
282         sh ./perly.fixer y.tab.c perly.c
283         mv y.tab.h perly.h
284         echo 'extern YYSTYPE yylval;' >>perly.h
285
286 perly.o: perly.c perly.h $(h)
287         $(CCCMD) perly.c
288
289 install: all
290         ./perl installperl
291
292 clean:
293         rm -f *.o all perl taintperl suidperl
294         cd x2p; $(MAKE) clean
295
296 realclean: clean
297         cd x2p; $(MAKE) realclean
298         rm -f *.orig */*.orig *~ */*~ core $(addedbyconf) h2ph h2ph.man
299         rm -f perly.c perly.h t/perl Makefile config.h makedepend makedir
300         rm -f makefile x2p/Makefile x2p/makefile cflags x2p/cflags
301
302 # The following lint has practically everything turned on.  Unfortunately,
303 # you have to wade through a lot of mumbo jumbo that can't be suppressed.
304 # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
305 # for that spot.
306
307 lint: perly.c $(c)
308         lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
309
310 depend: makedepend
311         - test -f perly.h || cp /dev/null perly.h
312         ./makedepend
313         - test -s perly.h || /bin/rm -f perly.h
314         cd x2p; $(MAKE) depend
315
316 test: perl
317         - cd t && chmod +x TEST */*.t
318         - cd t && (rm -f perl; $(SLN) ../perl .) && ./perl TEST </dev/tty
319
320 clist:
321         echo $(c) | tr ' ' '\012' >.clist
322
323 hlist:
324         echo $(h) | tr ' ' '\012' >.hlist
325
326 shlist:
327         echo $(sh) | tr ' ' '\012' >.shlist
328
329 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
330 $(obj):
331         @ echo "You haven't done a "'"make depend" yet!'; exit 1
332 makedepend: makedepend.SH
333         /bin/sh makedepend.SH
334 !NO!SUBS!
335 $eunicefix Makefile
336 case `pwd` in
337 *SH)
338     $rm -f ../Makefile
339     ln Makefile ../Makefile
340     ;;
341 esac