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