SV: END {} blocks run in perl_run
[p5sagit/p5-mst-13.2.git] / Makefile.SH
index b6c30f9..c44837d 100644 (file)
@@ -218,6 +218,12 @@ SHELL = $sh
 # how to tr(anslate) newlines
 TRNL = '$trnl'
 
+OPTIMIZE = $optimize
+
+EXTRAS = $extras
+
+INSTALLPREFIXEXP = $prefix
+
 !GROK!THIS!
 # not used by Makefile but by installperl;
 # mentioned here so that metaconfig picks these up
@@ -232,7 +238,7 @@ CCCMD    = `sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $(LIBPERL) $@`
 
 CCCMDSRC = `sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $(LIBPERL) $<`
 
-private = preplibrary lib/ExtUtils/Miniperl.pm lib/Config.pm
+private = preplibrary lib/Config.pm lib/ExtUtils/Miniperl.pm
 
 # Files to be built with variable substitution before miniperl
 # is available.
@@ -299,7 +305,7 @@ lintflags = -hbvxac
 
 .PHONY: all compile translators utilities
 
-all: $(FIRSTMAKEFILE) miniperl extra.pods $(private) $(public) $(dynamic_ext) $(nonxs_ext)
+all: $(FIRSTMAKEFILE) miniperl extra.pods $(private) $(public) $(dynamic_ext) $(nonxs_ext) extras.make
        @echo " ";
        @echo " Everything is up to date. 'make test' to run test suite."
 
@@ -621,26 +627,27 @@ sperl$(OBJ_EXT): perl.c $(h)
 #      test -d lib/auto || mkdir lib/auto
 #
 .PHONY: preplibrary
-preplibrary: miniperl lib/Config.pm lib/lib.pm lib/re.pm
+preplibrary: miniperl lib/Config.pm lib/lib.pm
        @sh ./makedir lib/auto
        @echo " AutoSplitting perl library"
        $(LDLIBPTH) ./miniperl -Ilib -e 'use AutoSplit; \
                autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm
+       $(MAKE) lib/re.pm
 
 # Take care to avoid modifying lib/Config.pm without reason
 # (If trying to create a new port and having problems with the configpm script,
 # try 'make minitest' and/or commenting out the tests at the end of configpm.)
-lib/Config.pm: config.sh miniperl configpm lib/re.pm
+lib/Config.pm: config.sh miniperl configpm
        $(LDLIBPTH) ./miniperl configpm configpm.tmp
        sh mv-if-diff configpm.tmp $@
 
 lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl minimod.pl lib/Config.pm
        $(LDLIBPTH) ./miniperl minimod.pl > minimod.tmp
        sh mv-if-diff minimod.tmp $@
+       -touch lib/ExtUtils/Miniperl.pm
 
 lib/re.pm: ext/re/re.pm
-       @-rm -f $@
-       cat ext/re/re.pm > $@
+       cp ext/re/re.pm ext/re/re.tmp && sh mv-if-diff ext/re/re.tmp lib/re.pm
 
 $(plextract):  miniperl lib/Config.pm
        @-rm -f $@
@@ -658,8 +665,18 @@ extra.pods: miniperl
            cd pod ; $(LNS) ../$$x "perl"$$nx".pod" ; cd .. ; \
            echo "pod/perl"$$nx".pod" >> extra.pods ; \
        done
+       -@rm -f pod/perlvms.pod
        -@test -f vms/perlvms.pod && cd pod && $(LNS) ../vms/perlvms.pod perlvms.pod && cd .. && echo "pod/perlvms.pod" >> extra.pods
 
+extras.make: perl
+       -@test -s extras.lst && $(LDLIBPTH) PATH=`pwd`:${PATH} PERL5LIB=`pwd`/lib ./perl -Ilib -MCPAN -e '@ARGV&&make(@ARGV)' `cat extras.lst`
+
+extras.test: perl
+       -@test -s extras.lst && $(LDLIBPTH) PATH=`pwd`:${PATH} PERL5LIB=`pwd`/lib ./perl -Ilib -MCPAN -e '@ARGV&&test(@ARGV)' `cat extras.lst`
+
+extras.install: perl
+       -@test -s extras.lst && $(LDLIBPTH) PATH=`pwd`:${PATH} PERL5LIB=`pwd`/lib ./perl -Ilib -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst`
+
 .PHONY: install install-strip install-all install-verbose install-silent \
        no-install install.perl install.man installman install.html installhtml
 
@@ -687,6 +704,7 @@ install.perl:       all installperl
        else :; \
        fi
        $(LDLIBPTH) ./perl installperl $(INSTALLFLAGS) $(STRIPFLAGS)
+       $(MAKE) extras.install
 
 install.man:   all installman
        $(LDLIBPTH) ./perl installman $(INSTALLFLAGS)
@@ -767,31 +785,6 @@ CHMOD_W = chmod +w
 # To force them to be regenerated, type
 #      make regen_headers
 
-keywords.h:    keywords.pl
-       -perl keywords.pl
-
-OPCODE_PL_OUTPUT = opcode.h opnames.h pp_proto.h pp.sym
-
-$(OPCODE_PL_OUTPUT): opcode.pl
-       -perl opcode.pl
-
-# Really the prerequisites for the next rule  should only be "embed.pl pp.sym"
-# Writing it this way gives make a big hint to always run opcode.pl before
-# embed.pl. The alternative - running embed.pl then opcode.pl causes embed.pl
-# to be re-run next make invocation, and then all object files get recompiled.
-
-proto.h embed.h embedvar.h global.sym objXSUB.h perlapi.h perlapi.c pod/perlintern.pod pod/perlapi.pod: embed.pl $(OPCODE_PL_OUTPUT)
-       -perl embed.pl
-
-ext/ByteLoader/byterun.h ext/ByteLoader/byterun.c ext/B/B/Asmdata.pm: bytecode.pl
-       -perl bytecode.pl
-
-regnodes.h:    regcomp.pl
-       -perl regcomp.pl
-
-warnings.h lib/warnings.pm: warnings.pl
-       -perl warnings.pl
-
 AUTOGEN_FILES = keywords.h opcode.h opnames.h pp_proto.h pp.sym proto.h \
                embed.h embedvar.h global.sym \
                pod/perlintern.pod pod/perlapi.pod \
@@ -829,13 +822,9 @@ $(DYNALOADER):     miniperl preplibrary FORCE
        @$(LDLIBPTH) sh ext/util/make_ext static $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
 
 d_dummy $(dynamic_ext):        miniperl preplibrary $(DYNALOADER) FORCE
-       @-rm -f lib/re.pm
-       @cat ext/re/re.pm > lib/re.pm
        @$(LDLIBPTH) sh ext/util/make_ext dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
 
 s_dummy $(static_ext): miniperl preplibrary $(DYNALOADER) FORCE
-       @-rm -f lib/re.pm
-       @cat ext/re/re.pm > lib/re.pm
        @$(LDLIBPTH) sh ext/util/make_ext static $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
 
 n_dummy $(nonxs_ext):  miniperl preplibrary $(DYNALOADER) FORCE
@@ -852,7 +841,7 @@ realclean:  _realcleaner _mopup
 
 _clobber:
        -@rm -f Cross/run-* Cross/to-* Cross/from-*
-       rm -f config.sh cppstdin Policy.sh
+       rm -f config.sh cppstdin Policy.sh extras.lst
 
 clobber:       _realcleaner _mopup _clobber
 
@@ -966,7 +955,7 @@ _test_prep:
 
 test_prep_pre: preplibrary utilities $(nonxs_ext)
 
-test_prep: test_prep_pre miniperl ./perl$(EXE_EXT) $(dynamic_ext) $(TEST_PERL_DLL)
+test_prep: test_prep_pre miniperl perl$(EXE_EXT) $(dynamic_ext) $(TEST_PERL_DLL)
        PERL=./perl $(MAKE) _test_prep
 
 _test_tty: