From 1ca484acee72052c3a485c2eef7bad6a98476e96 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Thu, 16 Jan 2014 07:20:28 -0300 Subject: [PATCH] Configure, Makefile.SH: Allow running generate_uudmap in the target This is a bit of a step backwards, but we want to run this in the target platform when cross-compiling to some unusual setups, like ASCII -> EBCDIC. What this branch introduces is a third "path" for generate_uudmap: * If we are doing a native build, just build it as usual and run it. * If we're cross-compiling, and either -Dhostgenerate was specified OR if it was left empty, which is the default case, then create a host generate_uudmap and run it locally * Finally, if are cross-compiling and were built with -Uhostgenerate, then build generate_uudmap for the target and run it there, bringing back the resulting headers. --- Configure | 11 ++++++++--- Makefile.SH | 39 ++++++++++++++++++++++++++++----------- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/Configure b/Configure index 597eb08..da2483d 100755 --- a/Configure +++ b/Configure @@ -2884,10 +2884,15 @@ $define|true|[yY]*) test -d $src/host || mkdir $src/host cd $src/host && rm -rf ./* $src/Configure -des -Dusedevel -Dmksymlinks - make miniperl - make generate_uudmap + $make miniperl + case "$hostgenerate" in + '') $make generate_uudmap + hostgenerate=$src/host/generate_uudmap + ;; + "$undef") hostgenerate='' + ;; + esac hostperl=$src/host/miniperl - hostgenerate=$src/host/generate_uudmap cd $before_host fi hostosname=`$hostperl -le 'print $^O'` diff --git a/Makefile.SH b/Makefile.SH index d86953a..2bf7942 100755 --- a/Makefile.SH +++ b/Makefile.SH @@ -668,27 +668,44 @@ globals$(OBJ_EXT): $(generated_headers) uudmap.h mg_data.h: bitcount.h -bitcount.h: generate_uudmap$(HOST_EXE_EXT) - ./generate_uudmap$(HOST_EXE_EXT) $(generated_headers) - generate_uudmap$(OBJ_EXT): mg_raw.h !NO!SUBS! -if test "X$hostgenerate" != X; then - $spitshell >>$Makefile <<'!NO!SUBS!' +# If hostgerenate isn't defined, then we have to build +# generate_uudmap and run it. This can potentially mean running +# it on the target system if we're cross-compiling. +# If it is defined, then we just run it locally. +case "$hostgenerate" in +'') +$spitshell >>$Makefile <>$Makefile <<'!NO!SUBS!' generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT) - -@rm generate_uudmap$(HOST_EXE_EXT) - $(LNS) $(HOST_GENERATE) generate_uudmap$(HOST_EXE_EXT) + $(CC) -o generate_uudmap$(EXE_EXT) $(LDFLAGS) generate_uudmap$(OBJ_EXT) $(libs) !NO!SUBS! -else - $spitshell >>$Makefile <<'!NO!SUBS!' +;; +*) +$spitshell >>$Makefile <<'!NO!SUBS!' +bitcount.h: generate_uudmap$(HOST_EXE_EXT) + ./generate_uudmap$(HOST_EXE_EXT) $(generated_headers) + generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT) - $(CC) -o generate_uudmap$(EXE_EXT) $(LDFLAGS) generate_uudmap$(OBJ_EXT) $(libs) + -@rm generate_uudmap$(HOST_EXE_EXT) + $(LNS) $(HOST_GENERATE) generate_uudmap$(HOST_EXE_EXT) !NO!SUBS! -fi +;; +esac + $spitshell >>$Makefile <<'!NO!SUBS!' perlmain.c: $(MINIPERL_EXE) ext/ExtUtils-Miniperl/pm_to_blib -- 2.7.4