--- Makefile.SH.orig 2013-02-23 12:44:25.420587388 +0100 +++ Makefile.SH 2013-02-23 12:51:32.923426243 +0100 @@ -302,10 +302,12 @@ LIB_EXT = $_a OBJ_EXT = $_o PATH_SEP = $p_ +ifeq (,\$(CROSS_PERL)) # Macros to invoke a copy of miniperl during the build. Targets which # are built using these macros should depend on \$(MINIPERL_EXE) MINIPERL_EXE = miniperl\$(EXE_EXT) MINIPERL = \$(LDLIBPTH) \$(RUN) ./miniperl\$(EXE_EXT) -Ilib +HOST_MINIPERL = $(MINIPERL_EXE) # Macros to invoke a copy of our fully operational perl during the build. PERL_EXE = perl\$(EXE_EXT) @@ -314,6 +316,23 @@ RUN_PERL = \$(LDLIBPTH) \$(RUN) ./perl\$ # Macros to run our tests RUN_TESTS = \$(LDLIBPTH) ./runtests +else # CROSS_PERL + +# Macros to invoke a copy of miniperl during the build. Targets which +# are built using these macros should depend on \$(MINIPERL_EXE) +MINIPERL_EXE = miniperl\$(EXE_EXT) +MINIPERL = \$(CROSS_PERL) +HOST_MINIPERL = \$(CROSS_PERL) + +# Macros to invoke a copy of our fully operational perl during the build. +PERL_EXE = perl\$(EXE_EXT) +RUN_PERL = \$(CROSS_PERL) + +# Macros to run our tests +RUN_TESTS = echo "Not running tests" + +endif # CROSS_PERL + dynamic_ext = $dynamic_list dynamic_ext_re = $dynamic_ext_re static_ext = $static_list @@ -559,6 +578,9 @@ all: $(FIRSTMAKEFILE) $(MINIPERL_EXE) $( @echo " "; @echo " Everything is up to date. Type '$(MAKE) test' to run test suite." +# Cross building requires a separate target to allow manipulation of the build tree +extensions: $(dynamic_ext) $(nonxs_ext) + .PHONY: all translators utilities # Both git_version.h and lib/Config_git.pl are built @@ -649,6 +671,9 @@ $spitshell >>$Makefile <<'!NO!SUBS!' globals$(OBJ_EXT): $(generated_headers) +ifeq (,$(CROSS_PERL)) +# If we're cross-building, we should have uudmap.h and bitcount.h +# provided already uudmap.h mg_data.h: bitcount.h bitcount.h: generate_uudmap$(HOST_EXE_EXT) @@ -658,6 +683,7 @@ generate_uudmap$(OBJ_EXT): mg_raw.h generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT) $(CC) -o generate_uudmap$(EXE_EXT) $(LDFLAGS) generate_uudmap$(OBJ_EXT) $(libs) +endif miniperlmain$(OBJ_EXT): miniperlmain.c patchlevel.h $(CCCMD) $(PLDLFLAGS) $*.c @@ -869,9 +895,15 @@ $(MINIPERL_EXE): $& $(mini_obj) $spitshell >>$Makefile <<'!NO!SUBS!' $(MINIPERL_EXE): $& $(mini_obj) -@rm -f miniperl.xok +ifeq (,$(CROSS_PERL)) $(LDLIBPTH) $(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \ $(mini_obj) $(libs) $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '' || $(MAKE) minitest +else + -rm $(MINIPERL_EXE) + ln -s $(HOST_MINIPERL) $(MINIPERL_EXE) +endif + !NO!SUBS! ;; esac