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