From: Nicholas Clark Date: Wed, 3 Jul 2013 16:31:02 +0000 (+0200) Subject: Replace utils/Makefile.SH with utils/Makefile.PL X-Git-Tag: v5.19.2~163^2~1 X-Git-Url: https://perl5.git.perl.org/perl5.git/commitdiff_plain/145bbcacfa5da244463c1a32e9230278dd2eff31?hp=f1f44974ad7245157b1b472771053946362694f8;ds=sidebyside Replace utils/Makefile.SH with utils/Makefile.PL This shares all the existing deficiencies of utils/Makefile.SH, and generates a byte-for-byte identical utils/Makefile, including boilerplate that claims it was generated by utils/Makefile.SH utils/Makefile remains as a file checked into the repository, and is not (yet) deleted, because as-was only *nix platforms could run utils/Makefile.SH to generate utils/Makefile. This messy state of affairs means that if you build with static linking, the checked-out utils/Makefile is modified ('../miniperl' is replaced with '../perl') The next commit will resolve just these bugs. In turn, it seems that the pre-generated utils/Makefile is only used by Win32, as VMS contains rules in descrip_mms.template to build the utilities. Probably the next thing to unpick is the build on VMS, but it seems better to reduce the size of the "problem" in both utils/Makefile.PL and vms/descrip_mms.template by attempting to move the work from them to the extension directories and ExtUtils::MakeMaker. --- diff --git a/MANIFEST b/MANIFEST index 7369af2..a0ed4d1 100644 --- a/MANIFEST +++ b/MANIFEST @@ -5439,7 +5439,7 @@ utils/json_pp.PL JSON::PP command line utility utils/libnetcfg.PL libnet utils.lst Lists utilities bundled with Perl utils/Makefile Pregenerated from utils/Makefile.SH -utils/Makefile.SH Extract the utility scripts +utils/Makefile.PL Extract the utility scripts utils/perlbug.PL A simple tool to submit a bug report utils/perldoc.PL A simple tool to find & display perl's documentation utils/perlivp.PL installation verification procedure diff --git a/Makefile.SH b/Makefile.SH index e0220db..ccc857c 100755 --- a/Makefile.SH +++ b/Makefile.SH @@ -622,7 +622,10 @@ x2p/s2p: $x2p_deps x2p/find2perl: $x2p_deps cd x2p; \$(LDLIBPTH) \$(MAKE) find2perl -utilities: $util_deps +utils/Makefile: \$(MINIPERL_EXE) \$(CONFIGPM) utils/Makefile.PL + \$(MINIPERL) -Ilib utils/Makefile.PL + +utilities: utils/Makefile $util_deps @echo " "; echo " Making utilities"; cd utils; \$(LDLIBPTH) \$(MAKE) all !GROK!THIS! diff --git a/Porting/add-package.pl b/Porting/add-package.pl index 88b96fc..fc2161d 100755 --- a/Porting/add-package.pl +++ b/Porting/add-package.pl @@ -283,8 +283,8 @@ my @ChangedFiles; push @NewFiles, $file; } - ### add an entry to utils/Makefile.SH for $bin - { my $file = "utils/Makefile.SH"; + ### add an entry to utils/Makefile.PL for $bin + { my $file = "utils/Makefile.PL"; ### not there already? unless( `grep $bin $Repo/$file` ) { diff --git a/utils/Makefile.SH b/utils/Makefile.PL similarity index 66% rename from utils/Makefile.SH rename to utils/Makefile.PL index a4a7e4a..7e33806 100644 --- a/utils/Makefile.SH +++ b/utils/Makefile.PL @@ -1,49 +1,34 @@ -case $PERL_CONFIG_SH in -'') - if test -f config.sh; then TOP=.; - elif test -f ../config.sh; then TOP=..; - elif test -f ../../config.sh; then TOP=../..; - elif test -f ../../../config.sh; then TOP=../../..; - elif test -f ../../../../config.sh; then TOP=../../../..; - else - echo "Can't find config.sh."; exit 1 - fi - . $TOP/config.sh - ;; -esac -: This forces SH files to create target in same directory as SH file. -: This is so that make depend always knows where to find SH derivatives. -case "$0" in -*/Makefile.SH) cd `expr X$0 : 'X\(.*\)/'` ;; -Makefile.SH) ;; -*) case `pwd` in - */utils) ;; - *) if test -d utils; then cd utils - else echo "Can't figure out where to write output."; exit 1 - fi;; - esac;; -esac - -echo "Extracting utils/Makefile (with variable substitutions)" -rm -f Makefile +#!./miniperl -w +use strict; +use Config; + +if (@ARGV) { + my $dir = shift; + chdir $dir or die "Can't chdir '$dir': $!"; +} + +require 'regen/regen_lib.pl'; + +my $target = 'utils/Makefile'; +print "Extracting $target (with variable substitutions)\n"; +my $fh = open_new($target, undef, undef, 1); + # These use the Cwd extension. For statically-built perls, we # need perl, not just miniperl. -case "$usedl" in - define) perl="../miniperl" ;; - *) perl="../perl" ;; -esac -cat >Makefile <>Makefile <<'!NO!SUBS!' +print $fh <<'EOT'; # Files to be built with variable substitution after miniperl is # available. Dependencies handled manually below (for now). @@ -117,12 +102,6 @@ distclean: clobber veryclean: distclean -rm -f *~ *.org -!NO!SUBS! -$eunicefix Makefile -case `pwd` in -*SH) - $rm -f ../Makefile - $ln Makefile ../Makefile - ;; -esac -rm -f $firstmakefile +EOT + +close_and_rename($fh);