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