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