This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate:
[perl5.git] / Makefile.SH
1 #! /bin/sh
2 case $PERL_CONFIG_SH in
3 '')
4         if test -f config.sh
5                 then TOP=.
6         else
7                 echo "Can't find config.sh."; exit 1
8         fi
9         . $TOP/config.sh
10         ;;
11 esac
12
13 # H.Merijn Brand [17 Feb 2004]
14 # This comment is just to ensure that Configure will find variables that
15 # are removed/replaced in patches on blead, but are still needed in the
16 # 5.8.x, 5.6.x and 5.005.x maintainance tracks.
17 # metaconfig -m will scan all .SH files on this level (not deeper), and
18 # not in x2p and other subfolders. This file is as good as any .SH
19 # patch   references
20 # #22227 $baserev
21 # #22302 $yacc $byacc
22
23 # H.Merijn Brand [30 Oct 2004]
24 # Mentioned for the same reason for future reference
25 # #23434 $d_strlcat $d_strlcpy
26
27 : This forces SH files to create target in same directory as SH file.
28 : This is so that make depend always knows where to find SH derivatives.
29 case "$0" in
30 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
31 esac
32
33 case "$d_dosuid" in
34 *define*) suidperl='suidperl' ;;
35 *) suidperl='';;
36 esac
37
38 linklibperl='$(LIBPERL)'
39 shrpldflags='$(LDDLFLAGS)'
40 ldlibpth=''
41 DPERL_EXTERNAL_GLOB='-DPERL_EXTERNAL_GLOB'
42 case "$useshrplib" in
43 true)
44         # Prefix all runs of 'miniperl' and 'perl' with
45         # $ldlibpth so that ./perl finds *this* shared libperl.
46         case "$LD_LIBRARY_PATH" in
47         '')
48                 ldlibpth="LD_LIBRARY_PATH=`pwd`";;
49         *)
50                 ldlibpth="LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}";;
51         esac
52
53         pldlflags="$cccdlflags"
54         static_target='static_pic'
55         case "${osname}${osvers}" in
56         next4*)
57                 ld=libtool
58                 lddlflags="-dynamic -undefined warning -framework System \
59                 -compatibility_version 1 -current_version $patchlevel \
60                 -prebind -seg1addr 0x27000000 -install_name \$(shrpdir)/\$@"
61                 ;;
62         rhapsody*|darwin*)
63                 shrpldflags="${ldflags} -dynamiclib \
64                             -compatibility_version \
65                                 ${api_revision}.${api_version}.${api_subversion} \
66                              -current_version \
67                                 ${revision}.${patchlevel}.${subversion} \
68                              -install_name \$(shrpdir)/\$@"
69                 ;;
70         cygwin*)
71                 linklibperl="-lperl"
72                 ;;
73         sunos*)
74                 linklibperl="-lperl"
75                 ;;
76         netbsd*|freebsd[234]*|openbsd*|dragonfly*)
77                 linklibperl="-L. -lperl"
78                 ;;
79         interix*)
80                 linklibperl="-L. -lperl"
81                 shrpldflags="$shrpldflags -Wl,--image-base,0x57000000"
82                 ;;
83         aix*)
84                 shrpldflags="-H512 -T512 -bhalt:4 -bM:SRE -bE:perl.exp"
85                 case "$osvers" in
86                 3*)     shrpldflags="$shrpldflags -e _nostart"
87                         ;;
88                 *)      shrpldflags="$shrpldflags -b noentry"
89                         ;;
90                 esac
91                 shrpldflags="$shrpldflags $ldflags $perllibs $cryptlib"
92                 linklibperl="-L $archlibexp/CORE -L `pwd | sed 's/\/UU$//'` -lperl"
93                 ;;
94         hpux*)
95                 linklibperl="-L `pwd | sed 's/\/UU$//'` -Wl,+s -Wl,+b$archlibexp/CORE -lperl"
96                 ;;
97         os390*)
98             shrpldflags='-W l,XPLINK,dll'
99             linklibperl='libperl.x'
100             DPERL_EXTERNAL_GLOB=''
101             ;;
102         esac
103         case "$ldlibpthname" in
104         '') ;;
105         *)
106             case "$osname" in
107             os2)
108                 ldlibpth=''
109                 ;;
110             *)
111                 eval "ldlibpth=\"$ldlibpthname=`pwd`:\$$ldlibpthname\""
112                 ;;
113             esac
114             # Strip off any trailing :'s
115             ldlibpth=`echo $ldlibpth | sed 's/:*$//'`
116             ;;
117         esac
118
119         case "$ldlibpth" in
120         # Protect any spaces
121         *" "*) ldlibpth=`echo $ldlibpth|sed 's/ /\\\\ /g'` ;;
122         esac
123
124         case "$osname" in
125         linux)
126             # If there is a pre-existing $libperl from a previous
127             # installation, Linux needs to use LD_PRELOAD to
128             # override the LD_LIBRARY_PATH setting.  See the
129             # INSTALL file, under "Building a shared perl library".
130             # If there is no pre-existing $libperl, we don't need
131             # to do anything further.
132             if test -f $archlib/CORE/$libperl; then
133                 rm -f preload
134                 cat <<'EOT' > preload
135 #! /bin/sh
136 lib=$1
137 shift
138 test -r $lib && export LD_PRELOAD="$lib $LD_PRELOAD"
139 exec "$@"
140 EOT
141                 chmod 755 preload
142                 ldlibpth="$ldlibpth `pwd`/preload `pwd`/$libperl"
143             fi
144             ;;
145         os390)  test -f /bin/env && ldlibpth="/bin/env $ldlibpth"
146                 ;;
147         esac
148
149         ;;
150
151 *)      pldlflags=''
152         static_target='static'
153         ;;
154 esac
155
156 : Prepare dependency lists for Makefile.
157 dynamic_list=' '
158 extra_dep=''
159 case "$d_cplusplus" in
160 define)
161   : delete as a function name will not work.
162   dynamic_ext=`echo $dynamic_ext | sed 's/ODBM_File//'`
163   static_ext=`echo $static_ext | sed 's/ODBM_File//'`
164   ;;
165 esac
166 for f in $dynamic_ext; do
167     : the dependency named here will never exist
168       base=`echo "$f" | sed 's/.*\///'`
169     this_target="lib/auto/$f/$base.$dlext"  
170     dynamic_list="$dynamic_list $this_target"
171
172     : Parallel makes reveal that we have some interdependencies
173     case $f in
174         Math/BigInt/FastCalc) extra_dep="$extra_dep
175 $this_target: lib/auto/List/Util/Util.$dlext" ;;
176         Unicode/Normalize) extra_dep="$extra_dep
177 $this_target: uni.data" ;;
178     esac
179 done
180
181 static_list=' '
182 for f in $static_ext; do
183         base=`echo "$f" | sed 's/.*\///'`
184         static_list="$static_list lib/auto/$f/$base\$(LIB_EXT)"
185 done
186
187 nonxs_list=' '
188 for f in $nonxs_ext; do
189     base=`echo "$f" | sed 's/.*\///'`
190     nonxs_list="$nonxs_list ext/$f/pm_to_blib"
191 done
192
193 # Handle the usage of different yaccs in posix-bc (During Configure we
194 # us yacc for perly.y and byacc for a2p.y.  The makefiles must use the
195 # same configuration for run_byacc!):
196 case "$osname" in
197     posix-bc)
198         byacc=$yacc
199         ;;
200 esac
201
202 echo "Extracting Makefile (with variable substitutions)"
203 $spitshell >Makefile <<!GROK!THIS!
204 # Makefile.SH
205 # This file is derived from Makefile.SH.  Any changes made here will
206 # be lost the next time you run Configure.
207 #  Makefile is used to generate $firstmakefile.  The only difference
208 #  is that $firstmakefile has the dependencies filled in at the end.
209 #
210 #
211 # I now supply perly.c with the kits, so don't remake perly.c without byacc
212 BYACC = $byacc
213 CC = $cc
214 LD = $ld
215
216 LDFLAGS = $ldflags
217 CLDFLAGS = $ldflags
218
219 mallocsrc = $mallocsrc
220 mallocobj = $mallocobj
221 LNS = $lns
222 # NOTE: some systems don't grok "cp -f". XXX Configure test needed?
223 CPS = $cp
224 RMS = rm -f
225 ranlib = $ranlib
226
227 # The following are mentioned only to make metaconfig include the
228 # appropriate questions in Configure.  If you want to change these,
229 # edit config.sh instead, or specify --man1dir=/wherever on
230 # installman commandline.
231 bin = $installbin
232 scriptdir = $scriptdir
233 shrpdir = $archlibexp/CORE
234 privlib = $installprivlib
235 man1dir = $man1dir
236 man1ext = $man1ext
237 man3dir = $man3dir
238 man3ext = $man3ext
239
240 # The following are used to build and install shared libraries for
241 # dynamic loading.
242 LDDLFLAGS = $lddlflags
243 SHRPLDFLAGS = $shrpldflags
244 CCDLFLAGS = $ccdlflags
245 DLSUFFIX = .$dlext
246 PLDLFLAGS = $pldlflags
247 LIBPERL = $libperl
248 LLIBPERL= $linklibperl
249 SHRPENV = $shrpenv
250
251 # Static targets are ordinarily built without CCCDLFLAGS.  However,
252 # if building a shared libperl.so that might later be linked into
253 # another application, then it might be appropriate to also build static
254 # extensions (usually just DynaLoader) with relocatable code (e.g. -fPIC
255 # for GNU cc).  This is handled by ext/util/make_ext.
256 STATIC = $static_target
257
258 # The following is used to include the current directory in
259 # the dynamic loader path you are building a shared libperl.
260 LDLIBPTH = $ldlibpth
261
262 dynamic_ext = $dynamic_list
263 static_ext = $static_list
264 nonxs_ext = $nonxs_list
265 ext = \$(dynamic_ext) \$(static_ext) \$(nonxs_ext)
266 DYNALOADER = DynaLoader\$(OBJ_EXT)
267
268 libs = $perllibs $cryptlib
269
270 public = perl\$(EXE_EXT) $suidperl utilities translators
271
272 shellflags = $shellflags
273
274 # This is set to  MAKE=$make if your $make command doesn't
275 # do it for you.
276 $make_set_make
277
278 # Mention $gmake here so it gets probed for by Configure.
279
280 # These variables may need to be manually set for non-Unix systems.
281 AR = $full_ar
282 EXE_EXT = $_exe
283 LIB_EXT = $_a
284 OBJ_EXT = $_o
285 PATH_SEP = $p_
286
287 # If you're going to use valgrind and it can't be invoked as plain valgrind
288 # then you'll need to change this, or override it on the make command line.
289 VALGRIND=valgrind
290
291 FIRSTMAKEFILE = $firstmakefile
292
293 # Any special object files needed by this architecture, e.g. os2/os2.obj
294 ARCHOBJS = $archobjs
295
296 .SUFFIXES: .c \$(OBJ_EXT) .i .s
297
298 # grrr
299 SHELL = $sh
300
301 # how to tr(anslate) newlines
302 TRNL = '$trnl'
303
304 OPTIMIZE = $optimize
305
306 EXTRAS = $extras
307
308 INSTALLPREFIXEXP = $prefix
309
310 !GROK!THIS!
311 # not used by Makefile but by installperl;
312 # mentioned here so that metaconfig picks these up
313 # $installusrbinperl
314 # $versiononly
315
316 case "${osname}:${osvers}" in
317 darwin:*)
318 $spitshell >>Makefile <<EOF
319
320 # Your locales are broken (osname $osname, osvers $osvers)
321 # and to avoid the numerous
322 # perl: warning: Setting locale failed.
323 # warnings during the build process we reset the locale variables.
324
325 LC_ALL=C
326 LANG=C
327 LANGUAGE=C
328 EOF
329         ;;
330 esac
331
332 ## In the following dollars and backticks do not need the extra backslash.
333 $spitshell >>Makefile <<'!NO!SUBS!'
334
335 CCCMD    = `sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $@`
336
337 CCCMDSRC = `sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $<`
338
339 CONFIGPM = lib/Config.pm lib/Config_heavy.pl
340 private = preplibrary $(CONFIGPM) lib/Config.pod lib/ExtUtils/Miniperl.pm
341
342 # Files to be built with variable substitution before miniperl
343 # is available.
344 sh = Makefile.SH cflags.SH config_h.SH makeaperl.SH makedepend.SH \
345         makedir.SH myconfig.SH writemain.SH pod/Makefile.SH
346
347 shextract = Makefile cflags config.h makeaperl makedepend \
348         makedir myconfig writemain pod/Makefile
349
350 # Files to be built with variable substitution after miniperl is
351 # available.  Dependencies handled manually below (for now).
352
353 pl = pod/pod2html.PL pod/pod2latex.PL pod/pod2man.PL pod/pod2text.PL \
354         pod/pod2usage.PL pod/podchecker.PL pod/podselect.PL
355
356 # lib/lib.pm is not listed here because it has a rule of its own.
357 plextract = pod/pod2html pod/pod2latex pod/pod2man pod/pod2text \
358         pod/pod2usage pod/podchecker pod/podselect
359
360 addedbyconf = UU $(shextract) $(plextract) lib/lib.pm pstruct
361
362 # Unicode data files generated by mktables
363 unidatafiles = lib/unicore/Canonical.pl lib/unicore/Exact.pl \
364         lib/unicore/Properties lib/unicore/Decomposition.pl \
365         lib/unicore/CombiningClass.pl lib/unicore/Name.pl lib/unicore/PVA.pl
366
367 # Directories of Unicode data files generated by mktables
368 unidatadirs = lib/unicore/To lib/unicore/lib
369
370 h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h
371 h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h opcode.h
372 h3 = pad.h patchlevel.h perl.h perlapi.h perly.h pp.h proto.h regcomp.h
373 h4 = regexp.h scope.h sv.h unixish.h util.h iperlsys.h thread.h
374 h5 = utf8.h warnings.h
375 h = $(h1) $(h2) $(h3) $(h4) $(h5)
376
377 c1 = $(mallocsrc) av.c scope.c op.c doop.c doio.c dump.c hv.c mg.c reentr.c
378 c2 = perl.c perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c utf8.c
379 c3 = gv.c sv.c taint.c toke.c util.c deb.c run.c universal.c xsutils.c pad.c
380 c4 = globals.c perlio.c perlapi.c numeric.c mathoms.c locale.c pp_pack.c pp_sort.c
381
382 c = $(c1) $(c2) $(c3) $(c4) miniperlmain.c perlmain.c opmini.c
383
384 obj1 = $(mallocobj) gv$(OBJ_EXT) toke$(OBJ_EXT) perly$(OBJ_EXT) op$(OBJ_EXT) pad$(OBJ_EXT) regcomp$(OBJ_EXT) dump$(OBJ_EXT) util$(OBJ_EXT) mg$(OBJ_EXT) reentr$(OBJ_EXT)
385 obj2 = hv$(OBJ_EXT) av$(OBJ_EXT) perl$(OBJ_EXT) run$(OBJ_EXT) pp_hot$(OBJ_EXT) sv$(OBJ_EXT) pp$(OBJ_EXT) scope$(OBJ_EXT) pp_ctl$(OBJ_EXT) pp_sys$(OBJ_EXT)
386 obj3 = doop$(OBJ_EXT) doio$(OBJ_EXT) regexec$(OBJ_EXT) utf8$(OBJ_EXT) taint$(OBJ_EXT) deb$(OBJ_EXT) universal$(OBJ_EXT) xsutils$(OBJ_EXT) globals$(OBJ_EXT) perlio$(OBJ_EXT) perlapi$(OBJ_EXT) numeric$(OBJ_EXT) mathoms$(OBJ_EXT) locale$(OBJ_EXT) pp_pack$(OBJ_EXT) pp_sort$(OBJ_EXT)
387
388 obj = $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
389
390 lintflags = \
391     -b \
392     -n \
393     -p \
394     -Ncheck=%all \
395     -Nlevel=4 \
396     -errchk=parentheses \
397     -errhdr=%all \
398     -errfmt=src \
399     -errtags \
400     -erroff=E_ASSIGN_NARROW_CONV \
401     -erroff=E_BAD_PTR_CAST \
402     -erroff=E_BAD_PTR_CAST_ALIGN \
403     -erroff=E_BAD_PTR_INT_COMBINATION \
404     -erroff=E_BAD_SIGN_EXTEND \
405     -erroff=E_BLOCK_DECL_UNUSED \
406     -erroff=E_CASE_FALLTHRU \
407     -erroff=E_CONST_EXPR \
408     -erroff=E_CONSTANT_CONDITION \
409     -erroff=E_END_OF_LOOP_CODE_NOT_REACHED \
410     -erroff=E_EQUALITY_NOT_ASSIGNMENT \
411     -erroff=E_EXPR_NULL_EFFECT \
412     -erroff=E_FALSE_LOGICAL_EXPR \
413     -erroff=E_INCL_NUSD \
414     -erroff=E_LOOP_EMPTY \
415     -erroff=E_MAIN_PARAM \
416     -erroff=E_POINTER_TO_OBJECT \
417     -erroff=E_PTRDIFF_OVERFLOW \
418     -erroff=E_SHIFT_CNT_NEG_TOO_BIG_L \
419     -erroff=E_STATIC_UNUSED \
420     -erroff=E_TRUE_LOGICAL_EXPR
421
422 splintflags = \
423     -I/usr/lib/gcc/i486-linux-gnu/4.0.2/include/ \
424     -D__builtin_va_list=va_list \
425     -Dsigjmp_buf=jmp_buf \
426     -warnposix \
427     \
428     +boolint \
429     +charintliteral \
430     -fixedformalarray \
431     -mustfreefresh \
432     -nestedextern \
433     -predboolint \
434     -predboolothers \
435     -preproc \
436     -boolops \
437     -shadow \
438     -nullstate \
439     +longintegral \
440     +matchanyintegral \
441     -type \
442     \
443     +line-len 999 \
444     +weak
445
446 splintfiles = $(c1)
447
448 .c$(OBJ_EXT):
449         $(CCCMD) $(PLDLFLAGS) $*.c
450
451 .c.i:
452         $(CCCMDSRC) -E $*.c > $*.i
453
454 .c.s:
455         $(CCCMDSRC) -S $*.c
456
457 all: $(FIRSTMAKEFILE) miniperl$(EXE_EXT) extra.pods $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make
458         @echo " ";
459         @echo " Everything is up to date. Type '$(MAKE) test' to run test suite."
460
461 .PHONY: all compile translators utilities
462
463 compile: all
464         echo "testing compilation" > testcompile;
465         cd utils;  $(MAKE) compile;
466         cd x2p; $(MAKE) compile;
467         cd pod; $(MAKE) compile;
468
469 translators:    miniperl$(EXE_EXT) $(CONFIGPM) FORCE
470         @echo " "; echo "       Making x2p stuff"; cd x2p; $(LDLIBPTH) $(MAKE) all
471
472 utilities:      miniperl$(EXE_EXT) $(CONFIGPM) $(plextract) lib/lib.pm FORCE
473         @echo " "; echo "       Making utilities"; cd utils; $(LDLIBPTH) $(MAKE) all
474
475
476 # This is now done by installman only if you actually want the man pages.
477 #       @echo " "; echo "       Making docs"; cd pod; $(MAKE) all;
478
479 # Phony target to force checking subdirectories.
480 # Apparently some makes require an action for the FORCE target.
481 .PHONY: FORCE
482 FORCE:
483         @sh -c true
484 !NO!SUBS!
485 $spitshell >>Makefile <<!GROK!THIS!
486
487 # We do a copy of the op.c instead of a symlink because gcc gets huffy
488 # if we have a symlink forest to another disk (it complains about too many
489 # levels of symbolic links, even if we have only two)
490
491 opmini.c: op.c
492         \$(RMS) opmini.c
493         \$(CPS) op.c opmini.c
494
495 opmini\$(OBJ_EXT): opmini.c
496         \$(CCCMD) \$(PLDLFLAGS) $DPERL_EXTERNAL_GLOB opmini.c
497
498 !GROK!THIS!
499 $spitshell >>Makefile <<'!NO!SUBS!'
500 miniperlmain$(OBJ_EXT): miniperlmain.c patchlevel.h
501         $(CCCMD) $(PLDLFLAGS) $*.c
502
503 perlmain.c: miniperlmain.c config.sh $(FIRSTMAKEFILE)
504         sh writemain $(DYNALOADER) $(static_ext) > perlmain.c
505
506 !NO!SUBS!
507 case "$osname" in
508 cygwin)
509         ;; # Let cygwin/Makefile.SHs do its work.
510 *)
511         $spitshell >>Makefile <<'!NO!SUBS!'
512 perlmain$(OBJ_EXT): perlmain.c
513         $(CCCMD) $(PLDLFLAGS) $*.c
514
515 !NO!SUBS!
516         ;;
517 esac
518 $spitshell >>Makefile <<'!NO!SUBS!'
519 # The file ext.libs is a list of libraries that must be linked in
520 # for static extensions, e.g. -lm -lgdbm, etc.  The individual
521 # static extension Makefile's add to it.
522 ext.libs: $(static_ext)
523         -@test -f ext.libs || touch ext.libs
524
525 !NO!SUBS!
526
527 # How to build libperl.  This is still rather convoluted.
528 # Load up custom Makefile.SH fragment for shared loading and executables:
529 case "$osname" in
530 *)
531         Makefile_s="$osname/Makefile.SHs"
532         ;;
533 esac
534
535 case "$osname" in
536 aix)
537         $spitshell >>Makefile <<!GROK!THIS!
538 LIBS                    = $perllibs
539 # In AIX we need to change this for building Perl itself from
540 # its earlier definition (which is for building external
541 # extensions *after* Perl has been built and installed)
542 CCDLFLAGS               = `echo $ccdlflags|sed -e 's@-bE:.*/perl\.exp@-bE:perl.exp@'`
543
544 !GROK!THIS!
545         case "$useshrplib" in
546         define|true|[yY]*)
547                 $spitshell >>Makefile <<'!NO!SUBS!'
548
549 LIBPERL_NONSHR          = libperl_nonshr$(LIB_EXT)
550 MINIPERL_NONSHR         = miniperl_nonshr$(EXE_EXT)
551
552 $(LIBPERL_NONSHR): $(obj)
553         $(RMS) $(LIBPERL_NONSHR)
554         $(AR) rcu $(LIBPERL_NONSHR) $(obj)
555
556 $(MINIPERL_NONSHR): $(LIBPERL_NONSHR) miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT)
557         $(CC) $(LDFLAGS) -o $(MINIPERL_NONSHR) miniperlmain$(OBJ_EXT) \
558             opmini$(OBJ_EXT) $(LIBPERL_NONSHR) $(LIBS)
559
560 MINIPERLEXP             = $(MINIPERL_NONSHR)
561
562 LIBPERLEXPORT           = perl.exp
563
564 !NO!SUBS!
565                 
566                 ;;
567         *)      
568                 $spitshell >>Makefile <<'!NO!SUBS!'
569 MINIPERLEXP             = miniperl$(EXE_EXT)
570
571 PERLEXPORT              = perl.exp
572
573 !NO!SUBS!
574         ;;
575         esac
576         $spitshell >>Makefile <<'!NO!SUBS!'
577 perl.exp: $(MINIPERLEXP) makedef.pl config.sh $(SYM) $(SYMH)
578         ./$(MINIPERLEXP) makedef.pl PLATFORM=aix CC_FLAGS="$(OPTIMIZE)" | sort -u | sort -f > perl.exp
579
580 !NO!SUBS!
581         ;;
582 os2)
583         $spitshell >>Makefile <<'!NO!SUBS!'
584 MINIPERLEXP             = miniperl
585
586 perl5.def: $(MINIPERLEXP) makedef.pl config.sh $(SYM) $(SYMH) miniperl.map
587         ./$(MINIPERLEXP) makedef.pl PLATFORM=os2 -DPERL_DLL=$(PERL_DLL) CC_FLAGS="$(OPTIMIZE)" > perl5.def
588
589 !NO!SUBS!
590         ;;
591 esac
592
593 if test -r $Makefile_s ; then
594         . $Makefile_s
595         $spitshell >>Makefile <<!GROK!THIS!
596
597 Makefile: $Makefile_s
598 !GROK!THIS!
599 else
600         $spitshell >>Makefile <<'!NO!SUBS!'
601 $(LIBPERL): $& $(obj) $(DYNALOADER) $(LIBPERLEXPORT)
602 !NO!SUBS!
603         case "$useshrplib" in
604         true)
605                 $spitshell >>Makefile <<'!NO!SUBS!'
606         $(LD) -o $@ $(SHRPLDFLAGS) $(obj) $(DYNALOADER) $(libs)
607 !NO!SUBS!
608                 case "$osname" in
609                 aix)
610                         $spitshell >>Makefile <<'!NO!SUBS!'
611         rm -f libperl$(OBJ_EXT)
612         mv $@ libperl$(OBJ_EXT)
613         $(AR) qv $(LIBPERL) libperl$(OBJ_EXT)
614 !NO!SUBS!
615                         ;;
616                 esac
617                 ;;
618         *)
619                 $spitshell >>Makefile <<'!NO!SUBS!'
620         rm -f $(LIBPERL)
621         $(AR) rcu $(LIBPERL) $(obj) $(DYNALOADER)
622         @$(ranlib) $(LIBPERL)
623 !NO!SUBS!
624                 ;;
625         esac
626         $spitshell >>Makefile <<'!NO!SUBS!'
627
628 # How to build executables.
629
630 # The $& notation tells Sequent machines that it can do a parallel make,
631 # and is harmless otherwise.
632 # The miniperl -w -MExporter line is a basic cheap test to catch errors
633 # before make goes on to run preplibrary and then MakeMaker on extensions.
634 # This is very handy because later errors are often caused by miniperl
635 # build problems but that's not obvious to the novice.
636 # The Module used here must not depend on Config or any extensions.
637
638 !NO!SUBS!
639
640         case "${osname}${osvers}" in
641         aix*|beos*)
642                 $spitshell >>Makefile <<'!NO!SUBS!'
643 miniperl: $& miniperlmain$(OBJ_EXT) $(obj) opmini$(OBJ_EXT)
644         $(CC) -o miniperl $(CLDFLAGS) \
645             `echo $(obj) | sed 's/ op$(OBJ_EXT) / /'` \
646             miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(libs)
647         $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
648 !NO!SUBS!
649                 ;;
650         next4*)
651                 $spitshell >>Makefile <<'!NO!SUBS!'
652 miniperl: $& miniperlmain$(OBJ_EXT) $(obj) opmini$(OBJ_EXT)
653         $(CC) -o miniperl `echo $(obj) | sed 's/ op$(OBJ_EXT) / /'` \
654             miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(libs)
655         $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
656 !NO!SUBS!
657                 ;;
658         darwin*)
659                 case "$osvers" in
660                 [1-6].*) ;;
661                 *) case "$ldflags" in
662                     *"-flat_namespace"*) ;;
663                     *) # to allow opmini.o to override stuff in libperl.dylib
664                 $spitshell >>Makefile <<!NO!SUBS!
665 NAMESPACEFLAGS = -force_flat_namespace
666 !NO!SUBS!
667                        ;;
668                     esac
669                     ;;
670                 esac
671                 $spitshell >>Makefile <<'!NO!SUBS!'
672 miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(obj) opmini$(OBJ_EXT)
673         -@rm -f miniperl.xok
674         $(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o miniperl \
675             `echo $(obj) | sed 's/ op$(OBJ_EXT) / /'` \
676             miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(libs)
677         $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
678 !NO!SUBS!
679                 ;;
680         *)
681                 $spitshell >>Makefile <<'!NO!SUBS!'
682 miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(obj) opmini$(OBJ_EXT)
683         -@rm -f miniperl.xok
684         $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl \
685             `echo $(obj) | sed 's/ op$(OBJ_EXT) / /'` \
686             miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(libs)
687         $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
688 !NO!SUBS!
689                 ;;
690         esac
691
692         $spitshell >>Makefile <<'!NO!SUBS!'
693
694 perl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
695         -@rm -f miniperl.xok
696         $(SHRPENV) $(LDLIBPTH) $(CC) -o perl$(PERL_SUFFIX) $(PERL_PROFILE_LDFLAGS) $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
697
698 # Purify/Quantify Perls.
699
700 pureperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
701         $(SHRPENV) $(LDLIBPTH) purify $(CC) -o pureperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
702
703 purecovperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
704         $(SHRPENV) $(LDLIBPTH) purecov $(CC) -o purecovperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
705
706 quantperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
707         $(SHRPENV) $(LDLIBPTH) quantify $(CC) -o quantperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
708
709 # Valgrind perl (currently Linux only)
710
711 perl.valgrind.config: config.sh
712         @echo "To build perl.valgrind you must Configure -Doptimize=-g -Uusemymalloc, checking..."
713         @$(MAKE) perl.config.dashg
714         @echo "Checking usemymalloc='n' in config.sh..."
715         @grep "^usemymalloc="    config.sh
716         @grep "^usemymalloc='n'" config.sh >/dev/null || exit 1
717         @echo "And of course you have to have valgrind..."
718         $(VALGRIND) ./perl -e 1 2>/dev/null || exit 1
719
720 # Third Degree Perl (Tru64 only)
721
722 perl.config.dashg:
723         @echo "Checking optimize='-g' in config.sh..."
724         @grep "^optimize=" config.sh
725         @egrep "^optimize='(.*-g.*)'" config.sh >/dev/null || exit 1
726
727 perl.third.config: config.sh
728         @echo "To build perl.third you must Configure -Doptimize=-g -Uusemymalloc, checking..."
729         @$(MAKE) perl.config.dashg
730         @echo "Checking usemymalloc='n' in config.sh..."
731         @grep "^usemymalloc="    config.sh
732         @grep "^usemymalloc='n'" config.sh >/dev/null || exit 1
733
734 perl.third: /usr/bin/atom perl.third.config perl
735         atom -tool third -L. -all -gp -toolargs="-invalid -uninit heap+stack+copy -min 0" perl
736         @echo "Now you may run perl.third and then study perl.3log."
737
738 # Pixie Perls (Tru64 and IRIX only)
739
740 perl.pixie.config: config.sh
741         @echo "To build perl.pixie you must Configure -Doptimize=-g, checking..."
742         @$(MAKE) perl.config.dashg
743
744 perl.pixie.atom: /usr/bin/atom perl
745         atom -tool pixie -L. -all -toolargs="-quiet" perl
746
747 perl.pixie.irix: perl
748         pixie perl
749
750 perl.pixie: /usr/bin/pixie perl.pixie.config perl
751         if test -x /usr/bin/atom; then \
752           $(MAKE) perl.pixie.atom; \
753         else \
754           $(MAKE) perl.pixie.irix; \
755         fi
756         @echo "Now you may run perl.pixie and then run pixie."
757
758 # Gprof Perl
759
760 perl.config.dashpg:
761         @echo "Checking optimize='-pg' in config.sh..."
762         @grep "^optimize="      config.sh
763         @grep "^optimize='.*-pg.*'" config.sh >/dev/null || exit 1
764
765 perl.gprof.config: config.sh
766         @echo "To build perl.gprof you must Configure -Doptimize=-pg, checking..."
767         @$(MAKE) perl.config.dashpg
768
769 perl.gprof: /usr/bin/gprof perl.gprof.config
770         @-rm -f perl
771         $(MAKE) PERL_SUFFIX=.gprof PERL_PROFILE_LDFLAGS=-pg perl
772         @echo "Now you may run perl.gprof and then run gprof perl.gprof."
773
774 # Gcov Perl
775
776 perl.config.gcov:
777         @echo "To build perl.gcov you must use gcc 3.0 or newer, checking..."
778         @echo "Checking gccversion in config.sh..."
779         @grep "^gccversion="      config.sh
780         @grep "^gccversion='[3-9]\." config.sh >/dev/null || exit 1
781         @echo "To build perl.gcov you must Configure -Dccflags=-fprofile-arcs -ftest-coverage, checking..."
782         @echo "Checking ccflags='-fprofile-arcs -ftest-coverage' in config.sh..."
783         @grep "^ccflags="      config.sh
784         @grep "^ccflags='.*-fprofile-arcs -ftest-coverage.*'" config.sh >/dev/null || exit 1
785
786 perl.gcov: perl.config.gcov
787         @-rm -f perl
788         $(MAKE) PERL_SUFFIX=.gcov PERL_PROFILE_LDFLAGS='' perl
789         @echo "Now you may run perl.gcov and then run gcov some.c."
790
791 # Microperl.  This is just a convenience thing if one happens to
792 # build also the full Perl and therefore the real big Makefile:
793 # usually one should manually explicitly issue the below command.
794
795 .PHONY: microperl
796 microperl:
797         $(MAKE) -f Makefile.micro
798
799 # This version, if specified in Configure, does ONLY those scripts which need
800 # set-id emulation.  Suidperl must be setuid root.  It contains the "taint"
801 # checks as well as the special code to validate that the script in question
802 # has been invoked correctly.
803
804 suidperl$(EXE_EXT): $& sperl$(OBJ_EXT) perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
805         $(SHRPENV) $(LDLIBPTH) $(CC) -o suidperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) sperl$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
806
807 !NO!SUBS!
808
809 fi
810
811 $spitshell >>Makefile <<'!NO!SUBS!'
812
813 sperl$(OBJ_EXT): perl.c $(h)
814         $(RMS) sperl.c
815         $(LNS) perl.c sperl.c
816         $(CCCMD) -DIAMSUID sperl.c
817         $(RMS) sperl.c
818
819 # We have to call our ./makedir because Ultrix 4.3 make can't handle the line
820 #       test -d lib/auto || mkdir lib/auto
821 # We need to autosplit in two steps because VOS can't handle so many args
822 #
823 .PHONY: preplibrary
824 preplibrary: miniperl$(EXE_EXT) $(CONFIGPM) lib/lib.pm $(PREPLIBRARY_LIBPERL)
825         @sh ./makedir lib/auto
826         @echo " AutoSplitting perl library"
827         $(LDLIBPTH) ./miniperl -Ilib -e 'use AutoSplit; \
828                 autosplit_lib_modules(@ARGV)' lib/*.pm
829         $(LDLIBPTH) ./miniperl -Ilib -e 'use AutoSplit; \
830                 autosplit_lib_modules(@ARGV)' lib/*/*.pm
831         $(MAKE) lib/re.pm
832
833 lib/Config.pod: config.sh miniperl$(EXE_EXT) configpm Porting/Glossary
834         $(LDLIBPTH) ./miniperl -Ilib configpm --heavy=lib/Config_heavy.pl lib/Config.pm
835
836 $(CONFIGPM): lib/Config.pod
837
838 lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl$(EXE_EXT) minimod.pl $(CONFIGPM)
839         $(LDLIBPTH) ./miniperl minimod.pl > lib/ExtUtils/Miniperl.pm
840
841 lib/re.pm: ext/re/re.pm
842         @-rm -f $@
843         cp ext/re/re.pm lib/re.pm
844
845 $(plextract):   miniperl$(EXE_EXT) $(CONFIGPM) x2p/s2p
846         @-rm -f $@
847         $(LDLIBPTH) ./miniperl -I`pwd`/lib $@.PL
848
849 x2p/s2p: miniperl$(EXE_EXT) $(CONFIGPM) x2p/s2p.PL
850         cd x2p; $(LDLIBPTH) $(MAKE) s2p
851
852 lib/lib.pm:     miniperl$(EXE_EXT) $(CONFIGPM)
853         @-rm -f $@
854         $(LDLIBPTH) ./miniperl -Ilib lib/lib_pm.PL
855
856 unidatafiles $(unidatafiles): uni.data
857
858 uni.data: miniperl$(EXE_EXT) $(CONFIGPM) lib/unicore/mktables
859         cd lib/unicore && $(LDLIBPTH) ../../miniperl -I../../lib mktables -w
860         touch uni.data
861
862 extra.pods: miniperl$(EXE_EXT)
863         -@test ! -f extra.pods || rm -f `cat extra.pods`
864         -@rm -f extra.pods
865         -@for x in `grep -l '^=[a-z]' README.* | grep -v README.vms` ; do \
866             nx=`echo $$x | sed -e "s/README\.//"`; \
867             cd pod ; $(LNS) ../$$x "perl"$$nx".pod" ; cd .. ; \
868             echo "pod/perl"$$nx".pod" >> extra.pods ; \
869         done
870         -@rm -f pod/perlvms.pod
871         -@test -f vms/perlvms.pod && cd pod && $(LNS) ../vms/perlvms.pod perlvms.pod && cd .. && echo "pod/perlvms.pod" >> extra.pods
872         -@rm -f pod/perldelta.pod
873         -@test -f pod/perl589delta.pod && cd pod && $(LNS) perl589delta.pod perldelta.pod && cd .. && echo "pod/perldelta.pod" >> extra.pods # See buildtoc
874
875 extras.make: perl$(EXE_EXT)
876         -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) ./perl -Ilib -MCPAN -e '@ARGV&&make(@ARGV)' `cat extras.lst`
877
878 extras.test: perl$(EXE_EXT)
879         -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) ./perl -Ilib -MCPAN -e '@ARGV&&test(@ARGV)' `cat extras.lst`
880
881 extras.install: perl$(EXE_EXT)
882         -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) ./perl -Ilib -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst`
883
884 .PHONY: install install-strip install-all install-verbose install-silent \
885         no-install install.perl install.man install.html
886
887 META.yml:       Porting/makemeta Porting/Maintainers.pl Porting/Maintainers.pm
888         $(LDLIBPTH) ./miniperl -Ilib Porting/makemeta
889
890 install-strip:
891         $(MAKE) STRIPFLAGS=-s install DESTDIR="$(DESTDIR)"
892
893 install install-all:
894         $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) DESTDIR="$(DESTDIR)"
895
896 install-verbose:
897         $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-V DESTDIR="$(DESTDIR)"
898
899 install-silent:
900         $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-S DESTDIR="$(DESTDIR)"
901
902 no-install:
903         $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-n DESTDIR="$(DESTDIR)"
904
905 # Set this to an empty string to avoid an attempt of rebuild before install
906 INSTALL_DEPENDENCE = all
907
908 install.perl:   $(INSTALL_DEPENDENCE) installperl
909         if [ -n "$(COMPILE)" ]; \
910         then \
911                 cd utils; $(MAKE) compile; \
912                 cd ../x2p; $(MAKE) compile; \
913                 cd ../pod; $(MAKE) compile; \
914         else :; \
915         fi
916         $(LDLIBPTH) ./perl installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS)
917         $(MAKE) extras.install
918
919 install.man:    all installman
920         $(LDLIBPTH) ./perl installman --destdir=$(DESTDIR) $(INSTALLFLAGS)
921
922 # XXX Experimental. Hardwired values, but useful for testing.
923 # Eventually Configure could ask for some of these values.
924 install.html: all installhtml
925         -@test -f README.vms && cd vms && $(LNS) ../README.vms README_vms.pod && cd ..
926         $(LDLIBPTH) ./perl installhtml   \
927       --podroot=. --podpath=. --recurse  \
928       --htmldir=$(privlib)/html   \
929       --htmlroot=$(privlib)/html  \
930       --splithead=pod/perlipc     \
931       --splititem=pod/perlfunc    \
932       --libpods=perlfunc:perlguts:perlvar:perlrun:perlop \
933       --ignore=Porting/Maintainers.pm,Porting/patching.pod,Porting/pumpkin.pod,Porting/repository.pod \
934       --verbose
935
936
937 # I now supply perly.c with the kits, so the following section is
938 # used only if you force byacc to run by saying
939 #       make run_byacc
940 # Since we patch up the byacc output, the perly.fixer script needs
941 # to run with precisely the same version of byacc as I use.  You
942 # normally shouldn't remake perly.[ch].
943
944 .PHONY: check_byacc run_byacc
945
946 check_byacc:
947         @$(BYACC) -V 2>&1 | grep 'version 1\.8\.2'
948
949 run_byacc:      FORCE check_byacc
950         $(BYACC) -d perly.y
951         -chmod 664 perly.c perly.h
952         sh $(shellflags) ./perly.fixer y.tab.c perly.c
953         sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
954             -e 's/y\.tab/perly/g' perly.c >perly.tmp && mv perly.tmp perly.c
955         sed -e '/^extern YYSTYPE yy/D' y.tab.h >yh.tmp && mv yh.tmp y.tab.h
956         cmp -s y.tab.h perly.h && rm -f y.tab.h || mv y.tab.h perly.h
957         perl -i.old perlyline.pl perly.c
958         chmod 664 vms/perly_c.vms vms/perly_h.vms
959         perl vms/vms_yfix.pl perly.c perly.h vms/perly_c.vms vms/perly_h.vms
960
961 # We don't want to regenerate perly.c and perly.h, but they might
962 # appear out-of-date after a patch is applied or a new distribution is
963 # made.
964 perly.c: perly.y
965         -@sh -c true
966
967 perly.h: perly.y
968         -@sh -c true
969
970 PERLYVMS = vms/perly_c.vms vms/perly_h.vms
971
972 $(PERLYVMS):    perly.c perly.h vms/vms_yfix.pl
973         perl vms/vms_yfix.pl perly.c perly.h vms/perly_c.vms vms/perly_h.vms
974
975 # No compat3.sym here since and including the 5.004_50.
976 # No interp.sym since 5.005_03.
977 SYM  = global.sym globvar.sym perlio.sym pp.sym
978
979 SYMH = perlvars.h intrpvar.h thrdvar.h
980
981 CHMOD_W = chmod +w
982
983 # The following files are generated automatically
984 #       autodoc.pl:     pod/perlapi.pod pod/perlintern.pod
985 #       bytecode.pl:    ext/ByteLoader/byterun.h ext/ByteLoader/byterun.c
986 #                       ext/B/B/Asmdata.pm
987 #       embed.pl:       proto.h embed.h embedvar.h global.sym
988 #                       perlapi.h perlapi.c 
989 # [* embed.pl needs pp.sym generated by opcode.pl! *]
990 #       keywords.pl:    keywords.h
991 #       opcode.pl:      opcode.h opnames.h pp_proto.h pp.sym
992 #       regcomp.pl:     regnodes.h
993 #       warnings.pl:    warnings.h lib/warnings.pm
994 # The correct versions should be already supplied with the perl kit,
995 # in case you don't have perl available.
996 # To force them to be regenerated, run
997 #       perl regen.pl
998 # with your existing copy of perl
999 # (make regen_headers is kept for backwards compatibility)
1000
1001 AUTOGEN_FILES = keywords.h opcode.h opnames.h pp_proto.h pp.sym proto.h \
1002                 embed.h embedvar.h global.sym \
1003                 pod/perlintern.pod pod/perlapi.pod \
1004                 perlapi.h perlapi.c ext/ByteLoader/byterun.h \
1005                 ext/ByteLoader/byterun.c ext/B/B/Asmdata.pm regnodes.h \
1006                 warnings.h lib/warnings.pm
1007
1008 .PHONY: regen_headers regen_pods regen_all
1009
1010 regen regen_headers:    FORCE
1011         -perl regen.pl
1012
1013 regen_pods:     FORCE
1014         -cd pod; $(LDLIBPTH) $(MAKE) regen_pods
1015
1016 regen_all: $(PERLYVMS) regen regen_pods
1017
1018 .PHONY: manisort manicheck
1019
1020 manisort:       FORCE
1021         LC_ALL=C sort -fdc MANIFEST || (echo "WARNING: re-sorting MANIFEST"; \
1022                 LC_ALL=C sort -fdo MANIFEST MANIFEST)
1023
1024 manicheck:      FORCE
1025         perl Porting/manicheck
1026
1027 # Extensions:
1028 # Names added to $(dynamic_ext) or $(static_ext) or $(nonxs_ext) will
1029 # automatically get built.  There should ordinarily be no need to change
1030 # any of this part of makefile.
1031 #
1032 # The dummy dependency is a place holder in case $(dynamic_ext) or
1033 # $(static_ext) is empty.
1034 #
1035 # DynaLoader may be needed for extensions that use Makefile.PL.
1036
1037 $(DYNALOADER):  miniperl$(EXE_EXT) preplibrary FORCE
1038         @$(LDLIBPTH) sh ext/util/make_ext $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
1039
1040 d_dummy $(dynamic_ext): miniperl$(EXE_EXT) preplibrary $(DYNALOADER) FORCE
1041         @$(LDLIBPTH) sh ext/util/make_ext dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
1042
1043 s_dummy $(static_ext):  miniperl$(EXE_EXT) preplibrary $(DYNALOADER) FORCE
1044         @$(LDLIBPTH) sh ext/util/make_ext $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
1045
1046 n_dummy $(nonxs_ext):   miniperl$(EXE_EXT) preplibrary $(DYNALOADER) FORCE
1047         @$(LDLIBPTH) sh ext/util/make_ext nonxs $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
1048 !NO!SUBS!
1049
1050 $spitshell >>Makefile <<EOF
1051 $extra_dep
1052 EOF
1053
1054 $spitshell >>Makefile <<'!NO!SUBS!'
1055
1056 .PHONY: printconfig
1057 printconfig:
1058         @eval `$(LDLIBPTH) ./perl -Ilib -V:$(CONFIGVAR)`; echo $$$(CONFIGVAR)
1059
1060 .PHONY: clean _tidy _mopup _cleaner1 _cleaner2 \
1061         realclean _realcleaner clobber _clobber \
1062         distclean veryclean _verycleaner
1063
1064 clean:          _tidy _mopup
1065
1066 realclean:      _realcleaner _mopup
1067         @echo "Note that '$(MAKE) realclean' does not delete config.sh or Policy.sh"
1068
1069 _clobber:
1070         -@rm -f Cross/run-* Cross/to-* Cross/from-*
1071         rm -f config.sh cppstdin Policy.sh extras.lst
1072
1073 clobber:        _realcleaner _mopup _clobber
1074
1075 distclean:      clobber
1076
1077 # Like distclean but also removes emacs backups and *.orig.
1078 veryclean:      _verycleaner _mopup _clobber
1079         -@rm -f Obsolete Wanted
1080
1081 # Do not 'make _mopup' directly.
1082 _mopup:
1083         rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c opmini.c
1084         -rmdir .depending
1085         -@test -f extra.pods && rm -f `cat extra.pods`
1086         -@test -f vms/README_vms.pod && rm -f vms/README_vms.pod
1087         -rm -f perl.exp ext.libs extra.pods uni.data opmini.o
1088         -rm -f perl.export perl.dll perl.libexp perl.map perl.def
1089         -rm -f perl.loadmap miniperl.loadmap perl.prelmap miniperl.prelmap
1090         -rm -f perl.third lib*.so.perl.third perl.3log t/perl.third t/perl.3log
1091         -rm -f perl.pixie lib*.so.perl.pixie lib*.so.Addrs
1092         -rm -f perl.Addrs perl.Counts t/perl.Addrs t/perl.Counts *perl.xok
1093         -rm -f perlld cygwin.c ld2 libperl*.def libperl*.dll cygperl*.dll *.exe.stackdump
1094         -rm -f perl$(EXE_EXT) suidperl$(EXE_EXT) miniperl$(EXE_EXT) $(LIBPERL) libperl.* microperl
1095         -rm -f opcode.h-old opnames.h-old pp.sym-old pp_proto.h-old
1096         -rm -f config.over
1097
1098 # Do not 'make _tidy' directly.
1099 _tidy:
1100         -cd pod; $(LDLIBPTH) $(MAKE) clean
1101         -cd utils; $(LDLIBPTH) $(MAKE) clean
1102         -cd x2p; $(LDLIBPTH) $(MAKE) clean
1103         -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
1104         $(LDLIBPTH) sh ext/util/make_ext clean $$x MAKE=$(MAKE) ; \
1105         done
1106         rm -f testcompile compilelog
1107
1108 _cleaner1:
1109         -cd os2; rm -f Makefile
1110         -cd pod; $(LDLIBPTH) $(MAKE) $(CLEAN)
1111         -cd utils; $(LDLIBPTH) $(MAKE) $(CLEAN)
1112         -cd x2p; $(LDLIBPTH) $(MAKE) $(CLEAN)
1113         -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
1114         $(LDLIBPTH) sh ext/util/make_ext $(CLEAN) $$x MAKE=$(MAKE) ; \
1115         done
1116
1117 # Some systems do not support "?", so keep these files separate.
1118 _cleaner2:
1119         -rm -f core.*perl.*.? t/core.perl.*.? .?*.c
1120         rm -f core *perl.core t/core t/*perl.core core.* t/core.*
1121         rm -f t/misctmp* t/forktmp* t/tmp* t/c t/perl$(EXE_EXT) t/rantests
1122         rm -f so_locations $(LIBPERL_NONSHR) $(MINIPERL_NONSHR)
1123         rm -rf $(addedbyconf)
1124         rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old makefile.old
1125         rm -f $(private)
1126         rm -rf $(unidatafiles) $(unidatadirs)
1127         rm -rf lib/auto
1128         rm -f lib/.exists lib/*/.exists lib/*/*/.exists
1129         rm -f h2ph.man pstruct
1130         rm -rf .config
1131         rm -f preload
1132         rm -f testcompile compilelog
1133         rm -rf lib/Encode
1134         rm -f lib/ExtUtils/ParseXS/t/XSTest.c
1135         rm -f lib/ExtUtils/ParseXS/t/XSTest$(OBJ_EXT)
1136         rm -f lib/ExtUtils/ParseXS/t/XSTest$(DLSUFFIX)
1137         -rmdir lib/B lib/Data
1138         -rmdir lib/Filter/Util lib/IO/Socket lib/IO
1139         -rmdir lib/List lib/MIME lib/Scalar lib/Sys 
1140         -rmdir lib/threads lib/XS
1141
1142 _realcleaner:
1143         @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=realclean
1144         @$(LDLIBPTH) $(MAKE) _cleaner2
1145
1146 _verycleaner:
1147         @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=veryclean
1148         @$(LDLIBPTH) $(MAKE) _cleaner2
1149         -rm -f *~ *.orig */*~ */*.orig */*/*~ */*/*.orig
1150
1151 .PHONY: lint
1152 lint: $(c)
1153         rm -f *.ln
1154         lint $(lintflags) -DPERL_CORE -D_REENTRANT -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(c)
1155
1156 .PHONY: splint
1157 splint: $(c)
1158         splint $(splintflags) -DPERL_CORE -D_REENTRANT -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(splintfiles)
1159
1160 # Need to unset during recursion to go out of loop.
1161 # The README below ensures that the dependency list is never empty and
1162 # that when MAKEDEPEND is empty $(FIRSTMAKEFILE) doesn't need rebuilding.
1163
1164 MAKEDEPEND = Makefile makedepend
1165
1166 $(FIRSTMAKEFILE):       README $(MAKEDEPEND)
1167         $(MAKE) depend MAKEDEPEND=
1168
1169 config.h: config_h.SH config.sh
1170         $(SHELL) config_h.SH
1171
1172 # When done, touch perlmain.c so that it doesn't get remade each time.
1173 .PHONY: depend
1174 depend: makedepend
1175         sh ./makedepend MAKE=$(MAKE)
1176         - test -s perlmain.c && touch perlmain.c
1177         cd x2p; $(MAKE) depend
1178
1179 # Cannot postpone this until $firstmakefile is ready ;-)
1180 makedepend: makedepend.SH config.sh
1181         sh ./makedepend.SH
1182
1183 .PHONY: test check test_prep test_prep_nodll test_prep_pre _test_prep \
1184         test_tty test-tty _test_tty test_notty test-notty _test_notty \
1185         utest ucheck test.utf8 check.utf8 test.torture torturetest \
1186         test.utf16 check.utf16 utest.utf16 ucheck.utf16 \
1187         test.third check.third utest.third ucheck.third test_notty.third \
1188         test.deparse test_notty.deparse test_harness test_harness_notty \
1189         test.bytecompile minitest coretest test.taintwarn
1190
1191 # Cannot delegate rebuilding of t/perl to make
1192 # to allow interlaced test and minitest
1193
1194 TESTFILE=TEST
1195
1196 _test_prep:
1197         cd t && (rm -f $(PERL)$(EXE_EXT); $(LNS) ../$(PERL)$(EXE_EXT) $(PERL)$(EXE_EXT))
1198
1199 # Architecture-neutral stuff:
1200
1201 test_prep_pre: preplibrary utilities $(nonxs_ext)
1202
1203 test_prep: test_prep_pre miniperl$(EXE_EXT) $(unidatafiles) perl$(EXE_EXT) $(dynamic_ext) $(TEST_PERL_DLL)
1204         PERL=./perl $(MAKE) _test_prep
1205
1206 _test_tty:
1207         cd t && $(PERL_DEBUG) $(LDLIBPTH) $(PERL) $(TESTFILE) $(TEST_ARGS) </dev/tty
1208
1209 _test_notty:
1210         cd t && $(PERL_DEBUG) PERL_SKIP_TTY_TEST=1 $(LDLIBPTH) $(PERL) $(TESTFILE) $(TEST_ARGS)
1211
1212 # The second branch is for testing without a tty or controlling terminal,
1213 # see t/op/stat.t
1214 _test:
1215         if (true </dev/tty) >/dev/null 2>&1; then \
1216           $(MAKE) TEST_ARGS=$(TEST_ARGS) TESTFILE=$(TESTFILE) _test_tty   ; \
1217         else \
1218           $(MAKE) TEST_ARGS=$(TEST_ARGS) TESTFILE=$(TESTFILE) _test_notty ; \
1219         fi
1220         @echo "Ran tests" > t/rantests
1221
1222 test check: test_prep
1223         PERL=./perl $(MAKE) _test
1224
1225 test_tty: test_prep
1226         PERL=./perl $(MAKE) _test_tty
1227
1228 test_notty: test_prep
1229         PERL=./perl $(MAKE) _test_notty
1230
1231 utest ucheck test.utf8 check.utf8: test_prep
1232         PERL=./perl TEST_ARGS=-utf8 $(MAKE) _test
1233
1234 coretest: test_prep
1235         PERL=./perl TEST_ARGS=-core $(MAKE) _test
1236
1237 test-prep:      test_prep
1238
1239 test-tty:       test_tty
1240
1241 test-notty:     test_notty
1242
1243 # Torture testing
1244
1245 test.torture torturetest:       test_prep
1246         PERL=./perl TEST_ARGS=-torture $(MAKE) _test
1247
1248 # Targets for UTF16 testing:
1249
1250 minitest.utf16: minitest.prep
1251         - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
1252                 && $(LDLIBPTH) ./perl TEST -minitest -utf16 base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t </dev/tty
1253
1254 test.utf16 check.utf16: test_prep
1255         PERL=./perl $(MAKE) TEST_ARGS=-utf16 _test
1256
1257 utest.utf16 ucheck.utf16: test_prep
1258         PERL=./perl $(MAKE) TEST_ARGS="-utf8 -utf16" _test
1259
1260 # Targets for valgrind testing:
1261
1262 test_prep.valgrind: test_prep perl.valgrind
1263         PERL=./perl $(MAKE) _test_prep
1264
1265 test.valgrind check.valgrind:   test_prep perl.valgrind.config
1266         PERL=./perl PERL_DEBUG=PERL_VALGRIND=1 VALGRIND='$(VALGRIND)' $(MAKE) _test
1267
1268 utest.valgrind ucheck.valgrind: test_prep.valgrind perl.valgrind.config
1269         PERL=./perl PERL_DEBUG=PERL_VALGRIND=1 TEST_ARGS=-utf8 $(MAKE) _test
1270
1271 test_notty.valgrind: test_prep.valgrind perl.valgrind.config
1272         PERL=./perl $(MAKE) PERL_DEBUG=PERL_VALGRIND=1 _test_notty
1273
1274 # Targets for Third Degree testing.
1275
1276 test_prep.third: test_prep perl.third
1277         PERL=./perl.third $(MAKE) _test_prep
1278
1279 test.third check.third: test_prep.third perl.third
1280         PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 $(MAKE) _test
1281
1282 utest.third ucheck.third: test_prep.third perl.third
1283         PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 TEST_ARGS=-utf8 $(MAKE) _test
1284
1285 test_notty.third: test_prep.third perl.third
1286         PERL=./perl.third $(MAKE) PERL_DEBUG=PERL_3LOG=1 _test_notty
1287
1288 # Targets for Bytecode/ByteLoader testing.
1289
1290 test.bytecompile:       test_prep
1291         PERL=./perl TEST_ARGS=-bytecompile $(MAKE) _test
1292
1293 # Targets for Deparse testing.
1294
1295 test.deparse:   test_prep
1296         PERL=./perl TEST_ARGS=-deparse $(MAKE) _test
1297
1298 test_notty.deparse:     test_prep
1299         PERL=./perl TEST_ARGS=-deparse $(MAKE) _test_notty
1300
1301 # Targets to run the test suite with -t
1302
1303 test.taintwarn: test_prep
1304         PERL=./perl TEST_ARGS=-taintwarn $(MAKE) _test
1305
1306 minitest.prep:
1307         -@test -f lib/lib.pm && test -f lib/Config.pm || \
1308           $(MAKE) lib/Config.pm lib/lib.pm $(unidatafiles)
1309         @echo " "
1310         @echo "You may see some irrelevant test failures if you have been unable"
1311         @echo "to build lib/Config.pm, lib/lib.pm or the Unicode data files."
1312         @echo " "
1313
1314 # Can't depend on lib/Config.pm because that might be where miniperl
1315 # is crashing.
1316 minitest: miniperl$(EXE_EXT) lib/re.pm minitest.prep
1317         - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
1318                 && $(LDLIBPTH) ./perl TEST -minitest base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t </dev/tty
1319
1320 # Test via harness
1321
1322 test_harness: test_prep
1323         PERL=./perl $(MAKE) TESTFILE=harness _test
1324
1325 test_harness_notty: test_prep
1326         PERL=./perl HARNESS_NOTTY=1 $(MAKE) TESTFILE=harness _test
1327
1328 # Handy way to run perlbug -ok without having to install and run the
1329 # installed perlbug. We don't re-run the tests here - we trust the user.
1330 # Please *don't* use this unless all tests pass.
1331 # If you want to report test failures, use "make nok" instead.
1332
1333 .PHONY: ok okfile oknack okfilenack nok nokfile noknack nokfilenack
1334
1335 ok:     utilities
1336         $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)'
1337
1338 okfile: utilities
1339         $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok
1340
1341 oknack: utilities
1342         $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -A
1343
1344 okfilenack:     utilities
1345         $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok -A
1346
1347 nok:    utilities
1348         $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)'
1349
1350 nokfile:        utilities
1351         $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok
1352
1353 noknack:        utilities
1354         $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -A
1355
1356 nokfilenack:    utilities
1357         $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok -A
1358
1359 .PHONY: clist hlist shlist pllist
1360
1361 clist:  $(c)
1362         echo $(c) | tr ' ' $(TRNL) >.clist
1363
1364 hlist:  $(h)
1365         echo $(h) | tr ' ' $(TRNL) >.hlist
1366
1367 shlist: $(sh)
1368         echo $(sh) | tr ' ' $(TRNL) >.shlist
1369
1370 pllist: $(pl)
1371         echo $(pl) | tr ' ' $(TRNL) >.pllist
1372
1373 Makefile: Makefile.SH ./config.sh
1374         $(SHELL) Makefile.SH
1375
1376 .PHONY: distcheck
1377 distcheck: FORCE
1378         perl '-MExtUtils::Manifest=&fullcheck' -e 'fullcheck()'
1379
1380 .PHONY: elc
1381 elc:    emacs/cperl-mode.elc
1382
1383 emacs/cperl-mode.elc: emacs/cperl-mode.el
1384         -cd emacs; emacs -batch -q -no-site-file -f batch-byte-compile cperl-mode.el
1385
1386 .PHONY: etags ctags tags
1387
1388 etags:  TAGS
1389
1390 TAGS: emacs/cperl-mode.elc
1391         sh emacs/ptags
1392
1393 # Let's hope make will not go into an infinite loop on case-unsensitive systems
1394 # This may also fail if . is in the head of the path, since perl will
1395 # require -Ilib
1396 tags:   TAGS
1397         perl emacs/e2ctags.pl TAGS > tags
1398
1399 ctags:
1400         ctags -f Tags -N --totals --languages=c --langmap=c:+.h --exclude=opmini.c *.c *.h
1401
1402 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
1403 # If this runs make out of memory, delete /usr/include lines.
1404 !NO!SUBS!
1405
1406 $eunicefix Makefile
1407 case `pwd` in
1408 *SH)
1409     $rm -f ../Makefile
1410     $ln Makefile ../Makefile
1411     ;;
1412 esac
1413 $rm -f $firstmakefile
1414
1415 # Now do any special processing required before building.
1416
1417 case "$ebcdic" in
1418 define)
1419     xxx=''
1420     echo "This is an EBCDIC system, checking if any parser files need regenerating." >&2
1421 case "$osname" in
1422 os390|posix-bc)
1423     rm -f y.tab.c y.tab.h
1424     # yacc must be a reentrant ("pure") Bison in BS2000 Posix!
1425     yacc -d perly.y >/dev/null 2>&1
1426     if cmp -s y.tab.c perly.c; then
1427         rm -f y.tab.c
1428     else
1429         echo "perly.y -> perly.c" >&2
1430         mv -f y.tab.c perly.c
1431         chmod u+w perly.c
1432         sed -e '/^#include "perl\.h"/a\
1433 \
1434 #define yydebug    PL_yydebug\
1435 #define yynerrs    PL_yynerrs\
1436 #define yyerrflag  PL_yyerrflag\
1437 #define yychar     PL_yychar\
1438 #define yyval      PL_yyval\
1439 #define yylval     PL_yylval'                           \
1440             -e '/YYSTYPE *yyval;/D'                     \
1441             -e '/YYSTYPE *yylval;/D'                    \
1442             -e '/int  yychar,/,/yynerrs;/D'             \
1443             -e 's/int yydebug = 0;/yydebug = 0;/'       \
1444             -e 's/[^_]realloc(/PerlMem_realloc(/g'      \
1445             -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
1446             -e 's/y\.tab/perly/g' perly.c >perly.tmp && mv perly.tmp perly.c
1447         xxx="$xxx perly.c"
1448     fi
1449     case "$osname:$usethreads" in
1450     os390:define)
1451         sed -e 's@^extern int yychar, yyerrflag;@/* extern int yychar, yyerrflag; */@' perly.c > perly.tmp && mv perly.tmp perly.c
1452         ;;
1453     esac
1454     if cmp -s y.tab.h perly.h; then
1455         rm -f y.tab.h
1456     else
1457         echo "perly.y -> perly.h" >&2
1458         mv -f y.tab.h perly.h
1459         xxx="$xxx perly.h"
1460     fi
1461     if cd x2p
1462     then
1463         rm -f y.tab.c y.tab.h
1464         case "$osname" in
1465         posix-bc)
1466            # we are using two different yaccs in BS2000 Posix!
1467            byacc a2p.y >/dev/null 2>&1
1468            ;;
1469         *) # e.g. os390
1470            yacc  a2p.y >/dev/null 2>&1
1471            ;;
1472         esac
1473         if cmp -s y.tab.c a2p.c
1474         then
1475             rm -f y.tab.c
1476         else
1477             echo "a2p.y -> a2p.c" >&2
1478             mv -f y.tab.c a2p.c
1479             chmod u+w a2p.c
1480             sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
1481                 -e 's|^static void __YY_YACC_MAIN.*BS2000.*|/*static main deleted*/|' \
1482                 -e 's/y\.tab/a2p/g' a2p.c >a2p.tmp && mv a2p.tmp a2p.c
1483             xxx="$xxx a2p.c"
1484         fi
1485         # In case somebody yacc -d:ed the a2p.y.
1486         if test -f y.tab.h
1487         then
1488             if cmp -s y.tab.h a2p.h
1489             then
1490                 rm -f y.tab.h
1491             else
1492                 echo "a2p.h -> a2p.h" >&2
1493                 mv -f y.tab.h a2p.h
1494                 xxx="$xxx a2p.h"
1495             fi
1496         fi
1497         cd ..
1498     fi
1499     ;;
1500 vmesa)
1501     # Do nothing in VM/ESA.
1502     ;;
1503 *)
1504     echo "'$osname' is an EBCDIC system I don't know that well." >&4
1505     ;;
1506 esac
1507     case "$xxx" in
1508     '') echo "No parser files were regenerated.  That's okay." >&2 ;;
1509     esac
1510     ;;
1511 esac
1512
1513 # ex: set ts=8 sts=4 sw=4 noet: