This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 5.0 alpha 9
[perl5.git] / Makefile.SH
1 case $CONFIG in
2 '')
3         if test -f config.sh; then TOP=.;
4         elif test -f ../config.sh; then TOP=..;
5         elif test -f ../../config.sh; then TOP=../..;
6         elif test -f ../../../config.sh; then TOP=../../..;
7         elif test -f ../../../../config.sh; then TOP=../../../..;
8         else
9                 echo "Can't find config.sh."; exit 1
10         fi
11         . $TOP/config.sh
12         ;;
13 esac
14 : This forces SH files to create target in same directory as SH file.
15 : This is so that make depend always knows where to find SH derivatives.
16 case "$0" in
17 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
18 esac
19
20 case "$d_dosuid" in
21 *define*) suidperl='suidperl' ;;
22 *) suidperl='';;
23 esac
24
25 : Certain parts of Makefile need to be commented out if dynamic
26 : loading is not used.
27 case "$usedl" in
28 define) comment='' ;;
29 *)      comment='#' ;;
30 esac
31
32 echo "Extracting Makefile (with variable substitutions)"
33 : This section of the file will have variable substitutions done on it.
34 : Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
35 : Protect any dollar signs and backticks that you do not want interpreted
36 : by putting a backslash in front.  You may delete these comments.
37 $spitshell >Makefile <<!GROK!THIS!
38 # $Makefile.SH,v $Revision: 4.1 $Date: 92/08/07 17:18:08 $
39 # This file is derived from Makefile.SH.  Any changes made here will
40 # be lost the next time you run Configure.
41 #  Makefile is used to generate makefile.  The only difference
42 #  is that makefile has the dependencies filled in at the end.
43 #
44 # \$Log:        Makefile.SH,v \$
45 # Revision 4.1  92/08/07  17:18:08  lwall
46 # Stage 6 Snapshot
47
48 # Revision 4.0.1.4  92/06/08  11:40:43  lwall
49 # patch20: cray didn't give enough memory to /bin/sh
50 # patch20: various and sundry fixes
51
52 # Revision 4.0.1.3  91/11/05  15:48:11  lwall
53 # patch11: saberized perl
54 # patch11: added support for dbz
55
56 # Revision 4.0.1.2  91/06/07  10:14:43  lwall
57 # patch4: cflags now emits entire cc command except for the filename
58 # patch4: alternate make programs are now semi-supported
59 # patch4: uperl.o no longer tries to link in libraries prematurely
60 # patch4: installperl now installs x2p stuff too
61
62 # Revision 4.0.1.1  91/04/11  17:30:39  lwall
63 # patch1: C flags are now settable on a per-file basis
64
65 # Revision 4.0  91/03/20  00:58:54  lwall
66 # 4.0 baseline.
67
68
69
70 # I now supply perly.c with the kits, so don't remake perly.c without byacc
71 BYACC = $byacc
72 CC = $cc
73 bin = $installbin
74 scriptdir = $scriptdir
75 privlib = $installprivlib
76 mansrc = $mansrc
77 manext = $manext
78 LDFLAGS = $ldflags
79 CLDFLAGS = $ldflags
80
81 SMALL = $small
82 LARGE = $large $split
83 mallocsrc = $mallocsrc
84 mallocobj = $mallocobj
85 dlsrc = $dlsrc
86 dlobj = $dlobj
87 dldir = $dldir
88 LNS = $lns
89 RMS = rm -f
90 ranlib = $ranlib
91
92 # The following are used to build and install shared libraries for
93 # dynamic loading.
94 LDDLFLAGS = $lddlflags
95 CCDLFLAGS = $ccdlflags
96 CCCDLFLAGS = $cccdlflags
97 SHLIBSUFFIX = $shlibsuffix
98
99 libs = $libs $cryptlib
100
101 public = perl $suidperl
102
103 shellflags = $shellflags
104
105 ## To use an alternate make, set $altmake in config.sh.
106 MAKE = ${altmake-make}
107 !GROK!THIS!
108
109 ## In the following dollars and backticks do not need the extra backslash.
110 $spitshell >>Makefile <<'!NO!SUBS!'
111
112 CCCMD = `sh $(shellflags) cflags $@`
113
114 private = 
115
116 scripts = h2ph
117
118 manpages = perl.man h2ph.man
119
120 util =
121
122 sh = Makefile.SH cflags.SH embed_h.SH makedepend.SH makedir.SH writemain.SH
123
124 h1 = EXTERN.h INTERN.h av.h cop.h config.h embed.h form.h handy.h
125 h2 = hv.h op.h opcode.h perl.h regcomp.h regexp.h gv.h sv.h util.h
126
127 h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h 
128 h2 = embed.h form.h gv.h handy.h hv.h hvdbm.h keywords.h mg.h op.h
129 h3 = opcode.h patchlevel.h perl.h perly.h pp.h proto.h regcomp.h
130 h4 = regexp.h scope.h sv.h unixish.h util.h
131 h = $(h1) $(h2) $(h3) $(h4)
132
133 c1 = av.c scope.c op.c doop.c doio.c dump.c hv.c
134 c2 = $(mallocsrc) mg.c perly.c pp.c regcomp.c regexec.c
135 c3 = gv.c sv.c taint.c toke.c util.c deb.c run.c
136
137 c = $(c1) $(c2) $(c3) $(dlsrc) miniperlmain.c perlmain.c
138
139 s1 = av.c scope.c op.c doop.c doio.c dump.c hv.c
140 s2 = $(mallocsrc) mg.c perly.c pp.c regcomp.c regexec.c
141 s3 = gv.c sv.c taint.c toke.c util.c deb.c run.c perly.c
142
143 saber = $(s1) $(s2) $(s3) $(dlsrc)
144
145 obj1 = av.o scope.o op.o doop.o doio.o dump.o hv.o
146 obj2 = $(mallocobj) mg.o perly.o pp.o regcomp.o regexec.o
147 obj3 = gv.o sv.o taint.o toke.o util.o deb.o run.o
148
149 obj = $(obj1) $(obj2) $(obj3)
150
151 lintflags = -hbvxac
152
153 addedbyconf = Makefile.old bsd eunice filexp loc pdp11 usg v7
154
155 # grrr
156 SHELL = /bin/sh
157
158 .c.o:
159         $(CCCMD) $*.c
160
161 all: miniperl perl lib/Config.pm
162
163 #all: $(public) $(private) $(util) $(scripts)
164 #       cd x2p; $(MAKE) all
165 #       touch all
166
167 # Phony target to force checking subdirectories.
168 FORCE:
169
170 !NO!SUBS!
171
172 ### Some makes have problems with the following dependency
173 ### if $(dlsrc) or $(dlobj) is empty.
174 ### Therefore, comment it out if dlsrc is null.
175 ### 
176 $spitshell >>Makefile <<!GROK!THIS!
177 ${comment}
178 ${comment}\$(dlsrc): \$(dldir)/\$(dlsrc)
179 ${comment}      cp \$(dldir)/\$(dlsrc) \$(dlsrc)
180
181 ${comment}\$(dlobj): \$(dlsrc)
182 ${comment}      \$(CCCMD) \$(dlsrc)
183
184 !GROK!THIS!
185
186 ###
187 ### Boilerplate for all the .xs files in the ext directory.  
188 ### XXX FIXME:  At some point we also need to copy .pm files out of 
189 ### XXX the ext directory into lib.
190 ### XXX FIXME:  At some point we need to run autosplit on the .pm
191 ### XXX files.
192 ### Configure sets extensions to a string like
193 ### "ext/dbm/NDBM_File.xs ext/dbm/ODBM_File.xs ext/dbm/GDBM_File.xs \
194 ###  ext/dbm/SDBM_File.xs ext/posix/POSIX.xs"
195 ext=" "
196 extdep=" "
197 extobj=" "
198 extsrc=" "
199 # extradep gives any extra dependencies of this extension.
200 # extraobj gives any extra thinks to link with this extension.
201 for f in $extensions
202 do
203     base=`echo $f | $sed -e 's@.*/\(.*\).xs@\1@'`
204     ext="$ext $base"
205     extsrc="$extsrc $base.c"
206     case $base in
207         SDBM_File) extradep="ext/dbm/sdbm/libsdbm.a"
208                    extraobj="ext/dbm/sdbm/libsdbm.a" ;;
209         POSIX) extradep=""   
210                extraobj="-lm" ;;
211         *) extradep=""
212            extraobj="" ;;
213     esac
214     case "$usedl" in
215         define) extdep="$extdep lib/auto/$base/${base}\$(SHLIBSUFFIX)"
216                 ;;
217         *)      extdep="$extdep $base.o $extradep"
218                 extobj="$extobj $base.o $extraobj" ;; 
219     esac
220     
221     $spitshell >>Makefile <<!GROK!THIS!
222
223 # $base extension
224 $base.o: $base.c
225         \$(CCCMD) \$(CCCDLFLAGS) \$*.c
226
227 $base.c:        $f ext/xsubpp ext/typemap
228         test -f miniperl || make miniperl
229         ./miniperl ext/xsubpp $f >tmp
230         mv tmp $base.c
231
232 ${comment}lib/auto/$base/$base\$(SHLIBSUFFIX): $base.o $extradep
233 ${comment}      test -d lib/auto/$base || mkdir lib/auto/$base
234 ${comment}      ld \$(LDDLFLAGS) -o \$@ $base.o $extraobj
235 !GROK!THIS!
236
237 done
238
239 $spitshell >>Makefile <<!GROK!THIS!
240
241 # List of extensions (used by writemain) to generate perlmain.c
242 ext=$ext
243 extsrc=$extsrc
244 # Extension dependencies.
245 extdep=$extdep
246 # How to include extensions in linking command
247 extobj=$extobj
248
249 ext/dbm/sdbm/libsdbm.a: ext/dbm/sdbm/sdbm.h ext/dbm/sdbm/sdbm.c
250         cd ext/dbm/sdbm; \$(MAKE) -f Makefile libsdbm.a
251
252 !GROK!THIS!
253
254 ### Now on to the rest of the Makefile.
255 $spitshell >>Makefile <<'!NO!SUBS!'
256 # The $& notation tells Sequent machines that it can do a parallel make,
257 # and is harmless otherwise.
258
259 miniperl: $& miniperlmain.o perl.o $(obj)
260         $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain.o perl.o $(obj) $(libs)
261
262 perlmain.c: miniperlmain.c
263         sh writemain $(ext) > perlmain.c
264
265 perlmain.o: perlmain.c
266
267 perl: $& perlmain.o perl.o $(obj) $(dlobj) $(extdep)
268         $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain.o perl.o $(obj) $(dlobj) $(extobj) $(libs)
269
270 pureperl: $& perlmain.o perl.o $(obj) $(dlobj) $(extdep)
271         purify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain.o perl.o $(obj) $(dlobj) $(extobj) $(libs)
272
273 quantperl: $& perlmain.o perl.o $(obj) $(dlobj) $(extdep)
274         quantify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain.o perl.o $(obj) $(dlobj) $(extobj) $(libs)
275
276 libperl.rlb: libperl.a
277         $(ranlib) libperl.a
278         touch libperl.rlb
279
280 libperl.a: $& perl.o $(obj)
281         ar rcuv libperl.a $(obj)
282
283 # This version, if specified in Configure, does ONLY those scripts which need
284 # set-id emulation.  Suidperl must be setuid root.  It contains the "taint"
285 # checks as well as the special code to validate that the script in question
286 # has been invoked correctly.
287
288 suidperl: $& sperl.o perlmain.o libperl.rlb
289         $(CC) $(LARGE) $(CLDFLAGS) sperl.o perlmain.o libperl.a $(libs) -o suidperl
290
291 lib/Config.pm: config.sh miniperl
292         ./miniperl configpm
293
294 saber: $(saber)
295         # load $(saber)
296         # load /lib/libm.a
297
298 sperl.o: perl.c perly.h patchlevel.h $(h)
299         $(RMS) sperl.c
300         $(LNS) perl.c sperl.c
301         $(CCCMD) -DIAMSUID sperl.c
302         $(RMS) sperl.c
303
304 perly.h: perly.c
305         @ echo Dummy dependency for dumb parallel make
306         touch perly.h
307
308 opcode.h: opcode.pl
309         - perl opcode.pl
310
311 embed.h: embed_h.SH global.sym interp.sym
312         sh embed_h.SH
313
314 perly.c:
315         @ echo 'Expect' 80 shift/reduce and 62 reduce/reduce conflicts
316         $(BYACC) -d perly.y
317         sh $(shellflags) ./perly.fixer y.tab.c perly.c
318         mv y.tab.h perly.h
319         echo 'extern YYSTYPE yylval;' >>perly.h
320
321 perly.o: perly.c perly.h $(h)
322         $(CCCMD) perly.c
323
324 install: all
325         ./perl installperl
326
327 clean:
328         rm -f *.o all perl miniperl
329         rm -f POSIX.c ?DBM_File.c perlmain.c
330         rm -f ext/dbm/sdbm/libsdbm.a
331         cd ext/dbm/sdbm; $(MAKE) -f Makefile clean
332         cd x2p; $(MAKE) clean
333
334 realclean: clean
335         cd x2p; $(MAKE) realclean
336         cd ext/dbm/sdbm; $(MAKE) -f Makefile realclean
337         rm -f *.orig */*.orig *~ */*~ core $(addedbyconf) h2ph h2ph.man
338         rm -f Makefile cflags embed_h makedepend makedir writemain
339         rm -f config.h t/perl makefile makefile.old cflags 
340         rm -rf lib/auto/?DBM_File lib/auto/POSIX
341         rm -f x2p/Makefile x2p/makefile x2p/makefile.old x2p/cflags
342         rm -f lib/Config.pm
343         rm -f c2ph pstruct
344
345 # The following lint has practically everything turned on.  Unfortunately,
346 # you have to wade through a lot of mumbo jumbo that can't be suppressed.
347 # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
348 # for that spot.
349
350 lint: perly.c $(c)
351         lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
352
353 depend: makedepend
354         - test -f perly.h || cp /dev/null perly.h
355         ./makedepend
356         - test -s perly.h || /bin/rm -f perly.h
357         cd x2p; $(MAKE) depend
358
359 test: perl lib/Config.pm
360         - cd t && chmod +x TEST */*.t
361         - cd t && (rm -f perl; $(LNS) ../perl perl) && ./perl TEST </dev/tty
362
363 clist:  $(c)
364         echo $(c) | tr ' ' '\012' >.clist
365
366 hlist:  $(h)
367         echo $(h) | tr ' ' '\012' >.hlist
368
369 shlist: $(sh)
370         echo $(sh) | tr ' ' '\012' >.shlist
371
372 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
373 # If this runs make out of memory, delete /usr/include lines.
374 !NO!SUBS!
375
376 $eunicefix Makefile
377 case `pwd` in
378 *SH)
379     $rm -f ../Makefile
380     ln Makefile ../Makefile
381     ;;
382 esac
383 rm -f makefile