In perl.git, the branch smoke-me/Makefile-miniperl-unification has been updated
<http://perl5.git.perl.org/perl.git/commitdiff/143479c7324640be5503b9dcf5659d18a149b6e2?hp=1530a57dfaff29c214be6c42259309d263abc973> - Log ----------------------------------------------------------------- commit 143479c7324640be5503b9dcf5659d18a149b6e2 Author: Nicholas Clark <[email protected]> Date: Mon Apr 30 16:26:37 2012 +0200 Fold the makedef.pl invocations on OS/2 and AIX into one. The necessary differences between OS/2 and AIX are declared using Makefile macros. To make Makefile.SH clearer, re-order the case statement that sets these so that OS/2 and AIX are below Cygwin. This has the downside of the diff looking more complex than it is :-( M Makefile.SH commit 5a4328d5394ebb4c155d117d0a37e105e05286f1 Author: Nicholas Clark <[email protected]> Date: Mon Apr 30 15:45:30 2012 +0200 Refactor the makedef.pl invocations on OS/2 and AIX to be identical. On AIX, C<-DPERL_DLL=$(PERL_DLL)> will expand to C<-DPERL_DLL=>, which doesn't change the generated perl.exp M Makefile.SH commit bb41886d22034f906a83b5520dddde1120b2ac2d Author: Nicholas Clark <[email protected]> Date: Mon Apr 30 14:08:07 2012 +0200 In makedef.pl, default PLATFORM to $^O. This avoids the need to set PLATFORM on the command line in the invocations of makedef.pl in Makefile.SH M Makefile.SH M makedef.pl commit 4dcd36671d4eeeb23bd4fc32ff3e9cba52a2b12f Author: Nicholas Clark <[email protected]> Date: Mon Apr 30 13:17:28 2012 +0200 In Makefile.SH, always use $(MINIPERL) to invoke makedef.pl This eliminates the macro MINIPERLEXP. As $(MINIPERL) includes -Ilib, the BEGIN block in makedef.pl that sets @INC is now redundant, because all other places that invoked makedef.pl were already setting @INC on the command line. Hence remove it. M Makefile.SH M makedef.pl commit 58553a5e1a764a7db5e5dcbe16f9ced6a853acca Author: Nicholas Clark <[email protected]> Date: Mon Apr 30 12:46:23 2012 +0200 Only set CCDLFLAGS once in the Makefile on AIX. Commit 5f9d9a1727238445 (Jul 1999) fixed Makefile.SH so that CCDLFLAGS correctly pointed the compiler to the uninstalled perl.exp, instead of the config.sh value which reflected the (not yet) installed location. However, the commit assumed that it needed to redefine CCDLFLAGS part way through the Makefile. This is unnecessary, as the macro CCDLFLAGS is not used for any purpose other than the local build. So refactor Makefile.SH to generate a Makefile which only sets CCDLFLAGS once. M Makefile.SH commit 409e6249802ee74ae34b1d643bd546ea508469f3 Author: Nicholas Clark <[email protected]> Date: Mon Apr 30 17:02:45 2012 +0200 Move the now-identical miniperl link code out of the per-OS case statement. This leaves just the NeXT vs default setting for the MINIPERL_CLDFLAGS macro in the case statement. M Makefile.SH commit cdaeb145db204602bd340625d7e7a8a029b54833 Author: Nicholas Clark <[email protected]> Date: Mon Apr 30 16:40:55 2012 +0200 Refactor the miniperl link command lines for NeXT and for the default case. The default case uses $(CLDFLAGS) when linking miniperl, whereas NeXT doesn't. (This might be an unintentional difference, unintentionally added as part of commit ecfb2188cc8402c5 in Dec 1999 which first added the NeXT special-case command line). Factor this out as MINIPERL_CLDFLAGS, which is set to $(CLDFLAGS) everywhere except NeXT. M Makefile.SH commit d8f60f25fb6292ec79d9a58e6a7b0ce9378077d7 Author: Nicholas Clark <[email protected]> Date: Mon Apr 30 15:07:45 2012 +0200 Remove the special case clause for miniperl link command line on AIX. The AIX link command line it generates is now identical to the default, so remove the special case logic. M Makefile.SH commit ca6aa6e6c60195702f67aa7b754f714c7b8a81ea Author: Nicholas Clark <[email protected]> Date: Mon Apr 30 11:15:59 2012 +0200 Re-order the miniperl link command line on AIX to be the same as the default. AIX happened to have $(CLDFLAGS) after -o miniperl, whereas the default had it before. This seems to originate to commit 535d2540a0ea9dc7 (Feb 200), which created the AIX link command by copying that for NeXT [which doesn't have $(CLDFLAGS) anywhere], and then adding $(CLDFLAGS). M Makefile.SH commit a9fd8b159d04b815ac1502b3292c34470c6507c6 Author: Nicholas Clark <[email protected]> Date: Mon Apr 30 10:49:21 2012 +0200 Eliminate the special case linking of miniperl on darwin, which is redundant. Commit cb3fc4263509f28c (May 2003) removed the use of -flat_namespace from the link flags, but added it specially in Makefile.SH for miniperl, so that symbols from opmini.o overrode those in libperl.dylib. However, a side effect of commit 908fcb8bef8cbab8 (Dec 2006) was to change the linker line to use explicit object files, meaning that op.o was no longer part of linking, meaning that the override is no longer needed. Hence darwin's link does not need special-casing. M Makefile.SH commit 3a8df612cdadcc7f59d084d673d74521f5f29f8e Author: Nicholas Clark <[email protected]> Date: Mon Apr 30 09:34:38 2012 +0200 In Makefile.SH, eliminate the MINIPERL_NONSHR target only used by AIX. The intent of the MINIPERL_NONSHR target was to provide a route to bootstrap building the shared libperl for AIX, solving the chicken & egg problem that (mini)perl is linked against the shared library, so the shared library must come first, but to build the shared library requires running a Perl script to generate the export list, hence miniperl comes first. However, the need for this special has long been superseded by events, so remove it and use the regular miniperl. Specifically, for 5.005 and earlier 1) both miniperl and perl are small stubs with just the main() function, linked with the shared libperl 2) on AIX the export list was generated by a shell script so no bootstrapping problem. However, the export list had to be manually updated in the shell script, so with commit 549a6b102c2ac8c4 in Jul 1999, the Win32 solution was generalised to work on both AIX and Win32. This uses Perl script, makedef.pl to parse various files and generate the current export list automatically. This introduces a bootstrapping problem - miniperl is needed to generate libperl.a, but libperl.a is needed to generate miniperl. This commit solves the problem by introducing a new target, MINIPERL_NONSHR, which builds a special staticly-linked miniperl (named miniperl_nonshr) in order to run makedef.pl, which in turn permits libperl.a and the regular miniperl to be built, and the build to proceed. All was well until commits 52bb0670c0d245e3 and 8d55947163edbb9f (Dec 1999) changed the default for CORE::glob() to use the XS module File::Glob, and linked miniperl against an opmini.o, built from op.c but with compiler flags to use the old glob-via-csh code. The change made for AIX was to build *miniperl_nonshr* with the bootstrapping glob code, but leave the build of miniperl unchanged. This broke the build on AIX - miniperl would build just fine, but would fail to build any XS extensions, as the ExtUtils::MakeMaker code requires working globbing. The AIX build was fixed with commit 18c4b137c9980e71 (Feb 2000) by changing Makefile.SH so that AIX used the same rules to build miniperl as NeXT. The rules for NeXT generated miniperl from an explicit list of object files, instead of using libperl.a. The result of this change was that on AIX, miniperl was now identical to miniperl_nonshr. Both correctly use the csh globbing code, but now neither require the shared libperl.a to work. This makes miniperl_nonshr redundant. So eliminate it. Curiously, as a side effect of commit 908fcb8bef8cbab8 (Dec 2006) which moved DynaLoader.o into libperl.so, the default platform build rules for miniperl were changed to use an explicit list of object files, instead of C<-lperl>, which had the side effect of building miniperl non-shared. Hence all platforms now have a non-shared miniperl when building perl with a shared perl library. M Makefile.SH commit 5e0b8f356431c5ccb6299e18a5f31df7cec20a84 Author: Nicholas Clark <[email protected]> Date: Fri Apr 27 22:20:10 2012 +0200 Fix a dependency issue when building a shared libperl on AIX. AIX requires a list of exported symbols in the file perl.exp, which is generated by makedef.pl. For the non-shared libperl case, the macro PERLEXPORT is set to this, and $(PERLEXPORT) is a pre-requisite for building dynamic extensions. However, historically, when building a shared libperl, Makefile.SH was not setting PERLEXPORT, and instead setting LIBPERLEXPORT. However, there was no dependency on this macro for building dynamic extensions. Hence the build can fail if make chooses to build dynamic extensions before perl.exp The simplest fix seems to be to use the same name, PERLEXPORT, in both cases. PERLEXPORT isn't referenced anywhere in the Makefile other than as pre-requisite for dynamic extensions and the main perl binary. The use of LIBPERLEXPORT dates back to commit 549a6b102c2ac8c4 in Jul 1999, "Fixed AIX dynamic loading and AIX shared Perl library." It's surprising that this problem hasn't bitten anyone previously. M Makefile.SH commit 5727d1bdefa186b731719f70282f016d60e534c9 Author: Nicholas Clark <[email protected]> Date: Fri Apr 27 17:56:34 2012 +0200 No need to prefix the $(CC) invocation that links miniperl with $(LDLIBPTH). $(LDLIBPTH) is used to prefix the appropriate LD_LIBRARY_PATH=... before commands in the Makefile when perl is build with a shared perl library so that the uninstalled ./perl will be able to find it. Commit c4f23d77f4b3486a (in May 1998) added the code for LDLIBPTH, but also added it to the default command line used to invoke $(CC) to link miniperl. This command doesn't need to run ./perl, hence the use of $(LDLIBPTH) is superfluous here. Removing it makes the code simpler. M Makefile.SH ----------------------------------------------------------------------- Summary of changes: Makefile.SH | 131 +++++++++++++++++----------------------------------------- makedef.pl | 3 +- 2 files changed, 40 insertions(+), 94 deletions(-) diff --git a/Makefile.SH b/Makefile.SH index ba5ab79..a4d20ae 100755 --- a/Makefile.SH +++ b/Makefile.SH @@ -27,7 +27,6 @@ case "$0" in esac linklibperl='$(LIBPERL)' -linklibperl_nonshr='' shrpldflags='$(LDDLFLAGS)' ldlibpth='' DPERL_EXTERNAL_GLOB='-DPERL_EXTERNAL_GLOB' @@ -86,7 +85,6 @@ true) esac shrpldflags="$shrpldflags $ldflags $perllibs $cryptlib" linklibperl="-L $archlibexp/CORE -L `pwd | sed 's/\/UU$//'` -lperl" - linklibperl_nonshr='-lperl_nonshr' ;; *) shrpldflags="-H512 -T512 -bhalt:4 -bM:SRE -bE:perl.exp" @@ -98,7 +96,6 @@ true) esac shrpldflags="$shrpldflags $ldflags $perllibs $cryptlib" linklibperl="-L $archlibexp/CORE -L `pwd | sed 's/\/UU$//'` -lperl" - linklibperl_nonshr='-lperl_nonshr' ;; esac ;; @@ -231,6 +228,18 @@ define|true) ;; esac +case "$osname" in + aix) + : In AIX we need to change this for building Perl itself + : The config.sh definition is for building external + : extensions *after* Perl has been built and installed + ccdlflags_uninstalled=`echo $ccdlflags|sed -e 's@-bE:.*/perl\.exp@-bE:perl.exp@'` + ;; + *) + ccdlflags_uninstalled="$ccdlflags" + ;; +esac + echo "Extracting $Makefile (with variable substitutions)" $spitshell >$Makefile <<!GROK!THIS! # $Makefile @@ -272,12 +281,11 @@ man3ext = $man3ext # dynamic loading. LDDLFLAGS = $lddlflags SHRPLDFLAGS = $shrpldflags -CCDLFLAGS = $ccdlflags +CCDLFLAGS = $ccdlflags_uninstalled DLSUFFIX = .$dlext PLDLFLAGS = $pldlflags LIBPERL = $libperl LLIBPERL= $linklibperl -LLIBPERL_NONSHR= $linklibperl_nonshr SHRPENV = $shrpenv # Static targets are ordinarily built without CCCDLFLAGS. However, @@ -685,71 +693,39 @@ case "$osname" in esac case "$osname" in -aix) - $spitshell >>$Makefile <<!GROK!THIS! -LIBS = $perllibs -# In AIX we need to change this for building Perl itself from -# its earlier definition (which is for building external -# extensions *after* Perl has been built and installed) -CCDLFLAGS = `echo $ccdlflags|sed -e 's@-bE:.*/perl\.exp@-bE:perl.exp@'` - -!GROK!THIS! - case "$useshrplib" in - define|true|[yY]*) - $spitshell >>$Makefile <<'!NO!SUBS!' +cygwin) + $spitshell >>$Makefile <<'!NO!SUBS!' +cygwin.c: cygwin/cygwin.c + $(LNS) cygwin/cygwin.c -LIBPERL_NONSHR = libperl_nonshr$(LIB_EXT) -MINIPERL_NONSHR = miniperl_nonshr$(EXE_EXT) +LIBPERL_NONSHR = libperl$(LIB_EXT) $(LIBPERL_NONSHR): $(obj) $(RMS) $(LIBPERL_NONSHR) $(AR) rcu $(LIBPERL_NONSHR) $(obj) -$(MINIPERL_NONSHR): $(LIBPERL_NONSHR) miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perlmini$(OBJ_EXT) - $(CC) $(LDFLAGS) -o $(MINIPERL_NONSHR) miniperlmain$(OBJ_EXT) \ - opmini$(OBJ_EXT) perlmini$(OBJ_EXT) $(LIBPERL_NONSHR) $(LIBS) - -MINIPERLEXP = $(MINIPERL_NONSHR) - -LIBPERLEXPORT = perl.exp - -!NO!SUBS! - - ;; - *) - $spitshell >>$Makefile <<'!NO!SUBS!' -MINIPERLEXP = $(MINIPERL_EXE) - -PERLEXPORT = perl.exp - !NO!SUBS! ;; - esac +os2) $spitshell >>$Makefile <<'!NO!SUBS!' -perl.exp: $(MINIPERLEXP) makedef.pl $(CONFIGPM) $(SYM) $(SYMH) - ./$(MINIPERLEXP) makedef.pl --sort-fold PLATFORM=aix CC_FLAGS="$(OPTIMIZE)" > perl.exp - +PERLEXPORT = perl5.def +MAKEDEF_PREREQ = miniperl.map !NO!SUBS! ;; -os2) +aix) $spitshell >>$Makefile <<'!NO!SUBS!' -MINIPERLEXP = miniperl - -perl5.def: $(MINIPERLEXP) makedef.pl $(CONFIGPM) $(SYM) $(SYMH) miniperl.map - ./$(MINIPERLEXP) makedef.pl PLATFORM=os2 -DPERL_DLL=$(PERL_DLL) CC_FLAGS="$(OPTIMIZE)" > perl5.def - +PERLEXPORT = perl.exp +MAKEDEF_FLAGS = --sort-fold !NO!SUBS! ;; -cygwin) +esac + +case "$osname" in +aix|os2) $spitshell >>$Makefile <<'!NO!SUBS!' -cygwin.c: cygwin/cygwin.c - $(LNS) cygwin/cygwin.c -LIBPERL_NONSHR = libperl$(LIB_EXT) - -$(LIBPERL_NONSHR): $(obj) - $(RMS) $(LIBPERL_NONSHR) - $(AR) rcu $(LIBPERL_NONSHR) $(obj) +$(PERLEXPORT): $(MINIPERL_EXE) makedef.pl $(CONFIGPM) $(SYM) $(SYMH) $(MAKEDEF_PREREQ) + $(MINIPERL) makedef.pl $(MAKEDEF_FLAGS) -DPERL_DLL=$(PERL_DLL) CC_FLAGS="$(OPTIMIZE)" > $@ !NO!SUBS! ;; @@ -789,7 +765,7 @@ $(MINIDTRACE_O): perldtrace.d $(minindt_obj) perlmini$(OBJ_EXT) ;; esac $spitshell >>$Makefile <<'!NO!SUBS!' -$(LIBPERL): $& $(obj) $(DYNALOADER) $(LIBPERLEXPORT) +$(LIBPERL): $& $(obj) $(DYNALOADER) $(PERLEXPORT) !NO!SUBS! case "$useshrplib" in true) @@ -830,54 +806,25 @@ $(LIBPERL): $& $(obj) $(DYNALOADER) $(LIBPERLEXPORT) !NO!SUBS! case "${osname}${osvers}" in - aix*|beos*) - $spitshell >>$Makefile <<'!NO!SUBS!' -$(MINIPERL_EXE): $& $(mini_obj) - $(CC) -o $(MINIPERL_EXE) $(CLDFLAGS) $(mini_obj) $(libs) - $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest -!NO!SUBS! - ;; next4*) $spitshell >>$Makefile <<'!NO!SUBS!' -$(MINIPERL_EXE): $& $(mini_obj) - $(CC) -o $(MINIPERL_EXE) $(mini_obj) $(libs) - $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest -!NO!SUBS! - ;; - darwin*) - case "$osvers" in - [1-6].*) ;; - *) case "$ldflags" in - *"-flat_namespace"*) ;; - *) # to allow opmini.o to override stuff in libperl.dylib - $spitshell >>$Makefile <<!NO!SUBS! -NAMESPACEFLAGS = -force_flat_namespace -!NO!SUBS! - ;; - esac - ;; - esac - $spitshell >>$Makefile <<'!NO!SUBS!' -$(MINIPERL_EXE): $& $(mini_obj) - -@rm -f miniperl.xok - $(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \ - $(mini_obj) $(libs) - $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest +MINIPERL_CLDFLAGS = !NO!SUBS! ;; *) $spitshell >>$Makefile <<'!NO!SUBS!' -$(MINIPERL_EXE): $& $(mini_obj) - -@rm -f miniperl.xok - $(LDLIBPTH) $(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \ - $(mini_obj) $(libs) - $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest +MINIPERL_CLDFLAGS = $(CLDFLAGS) !NO!SUBS! ;; esac $spitshell >>$Makefile <<'!NO!SUBS!' +$(MINIPERL_EXE): $& $(mini_obj) + -@rm -f miniperl.xok + $(CC) $(MINIPERL_CLDFLAGS) -o $(MINIPERL_EXE) $(mini_obj) $(libs) + $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest + $(PERL_EXE): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT) -@rm -f miniperl.xok $(SHRPENV) $(LDLIBPTH) $(CC) -o perl$(PERL_SUFFIX) $(PERL_PROFILE_LDFLAGS) $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) @@ -1299,7 +1246,7 @@ _cleaner2: rm -f core *perl.core t/core t/*perl.core core.* t/core.* rm -f t/$(PERL_EXE) t/rantests rm -rf t/tmp* - rm -f so_locations $(LIBPERL_NONSHR) $(MINIPERL_NONSHR) + rm -f so_locations $(LIBPERL_NONSHR) rm -rf $(addedbyconf) rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old makefile.old rm -f $(private) diff --git a/makedef.pl b/makedef.pl index a52241f..71ca8fc 100644 --- a/makedef.pl +++ b/makedef.pl @@ -32,11 +32,10 @@ # perl.imp NetWare # makedef.lis VMS -BEGIN { unshift @INC, "lib" } use Config; use strict; -my %ARGS = (CCTYPE => 'MSVC', TARG_DIR => ''); +my %ARGS = (CCTYPE => 'MSVC', TARG_DIR => '', PLATFORM => $^O); my %define; -- Perl5 Master Repository
