X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/421103b701656c13a87cdd74db15dd4e0d2223c2..289ce9ccf71a0b3a1f849f181c591ff860ad74ed:/Makefile.SH diff --git a/Makefile.SH b/Makefile.SH index cafc94c..d877c72 100755 --- a/Makefile.SH +++ b/Makefile.SH @@ -5,7 +5,7 @@ quote() { case "$1" in '') echo "''" ;; - *) echo "$1" | sed 's/\([^a-zA-Z0-9.:_\-\/]\)/\\\1/g' ;; + *) echo "$1" | sed 's/\([^a-zA-Z0-9.:_/-]\)/\\\1/g' ;; esac } @@ -20,17 +20,17 @@ case $PERL_CONFIG_SH in ;; esac -case $CROSS_NAME in -'') - Makefile=Makefile +case "$osname" in +amigaos) + devtty=CONSOLE: ;; *) - # if cross-compilation, the Makefile named accordingly - Makefile=Makefile-cross-$CROSS_NAME - . Cross/config-${CROSS_NAME}.sh + devtty=/dev/tty ;; esac +Makefile=Makefile + : 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 @@ -234,10 +234,13 @@ dtrace_o='' minidtrace_o='' case "$usedtrace" in define|true) - dtrace_h='perldtrace.h' - $dtrace -G -s perldtrace.d -o perldtrace.tmp >/dev/null 2>&1 \ - && rm -f perldtrace.tmp && dtrace_o='perldtrace$(OBJ_EXT)' \ - && minidtrace_o='miniperldtrace$(OBJ_EXT)' + dtrace_h='perldtrace.h' + case "$dtraceobject" in + define) + dtrace_o='perldtrace$(OBJ_EXT)' + minidtrace_o='miniperldtrace$(OBJ_EXT)' + ;; + esac ;; esac @@ -257,8 +260,6 @@ CLDFLAGS = $ldflags mallocsrc = $mallocsrc mallocobj = $mallocobj -madlysrc = $madlysrc -madlyobj = $madlyobj LNS = $lns # NOTE: some systems don't grok "cp -f". XXX Configure test needed? CPS = $cp @@ -322,6 +323,9 @@ PATH_SEP = $p_ MINIPERL_EXE = miniperl\$(EXE_EXT) MINIPERL = \$(LDLIBPTH) ./miniperl\$(EXE_EXT) -Ilib +# Macros to invoke sort the MANIFEST during build +MANIFEST_SRT = MANIFEST.srt + !GROK!THIS! case "$usecrosscompile$perl" in @@ -354,10 +358,13 @@ DYNALOADER = DynaLoader\$(OBJ_EXT) libs = $perllibs $cryptlib -public = \$(PERL_EXE) utilities translators +public = \$(PERL_EXE) utilities shellflags = $shellflags +# The /dev/tty or the moral equivalent. +devtty = $devtty + # This is set to MAKE=$make if your $make command doesn't # do it for you. $make_set_make @@ -425,8 +432,6 @@ EOF ;; esac -case $CROSS_NAME in -'') ## In the following dollars and backticks do not need the extra backslash. $spitshell >>$Makefile <<'!NO!SUBS!' @@ -441,34 +446,12 @@ CONFIGPOD = lib/Config.pod CONFIGH = config.h !NO!SUBS! - ;; -*) - # if cross-compilation -$spitshell >>$Makefile < $*.i @`$(CCCMDSRC)` -E $*.c > $*.i -.c.s: +.c.s: perl.h config.h @echo `$(CCCMDSRC)` -S $*.c @`$(CCCMDSRC)` -S $*.c -all: $(FIRSTMAKEFILE) $(MINIPERL_EXE) $(generated_pods) $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make +all: $(FIRSTMAKEFILE) $(MINIPERL_EXE) $(generated_pods) $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make $(MANIFEST_SRT) @echo " "; @echo " Everything is up to date. Type '$(MAKE) test' to run test suite." -.PHONY: all translators utilities +$(MANIFEST_SRT): MANIFEST $(PERL_EXE) + @$(RUN_PERL) Porting/manisort -q || (echo "WARNING: re-sorting MANIFEST"; \ + $(RUN_PERL) Porting/manisort -q -o MANIFEST; sh -c true) + @touch $(MANIFEST_SRT) + +.PHONY: all utilities # Both git_version.h and lib/Config_git.pl are built # by make_patchnum.pl. @@ -616,36 +604,21 @@ perl$(OBJ_EXT): git_version.h !NO!SUBS! -# Making utilities and translators require Cwd. If we have dynamic +# Making utilities requires Cwd. If we have dynamic # loading, we only need miniperl and Cwd.$dlext. If we have static # loading, we need to build perl first. case "$usedl$static_cwd" in defineundef) util_deps='$(MINIPERL_EXE) $(CONFIGPM) lib/auto/Cwd/Cwd$(DLSUFFIX) FORCE' - x2p_deps="\$(MINIPERL_EXE) \$(CONFIGPM) \$(dynamic_ext) x2p/$firstmakefile FORCE" ;; definedefine) util_deps='$(PERL_EXE) $(CONFIGPM) FORCE' - x2p_deps="\$(PERL_EXE) \$(CONFIGPM) \$(dynamic_ext) x2p/$firstmakefile FORCE" ;; *) util_deps='$(PERL_EXE) $(CONFIGPM) FORCE' - x2p_deps="\$(PERL_EXE) \$(CONFIGPM) x2p/$firstmakefile FORCE" ;; esac $spitshell >>$Makefile <>$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 +''|'undef') +$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 +case "$osname" in +amigaos*) +$spitshell >>$Makefile <<'!NO!SUBS!' +perlmain.c: $(MINIPERL_EXE) ext/ExtUtils-Miniperl/pm_to_blib + $(MINIPERL) -Ilib -MExtUtils::Miniperl -e 'writemain(\\"perlmain.c", @ARGV)' DynaLoader $(static_ext) + +# The file ext.libs is a list of libraries that must be linked in +# for static extensions, e.g. -lm -lgdbm, etc. The individual +# static extension Makefile's add to it. +ext.libs: $(static_ext) + -@test -f ext.libs || touch ext.libs + +!NO!SUBS! +;; +*) $spitshell >>$Makefile <<'!NO!SUBS!' perlmain.c: $(MINIPERL_EXE) ext/ExtUtils-Miniperl/pm_to_blib $(MINIPERL) -Ilib -MExtUtils::Miniperl -e 'writemain(\"perlmain.c", @ARGV)' DynaLoader $(static_ext) @@ -734,6 +738,8 @@ ext.libs: $(static_ext) -@test -f ext.libs || touch ext.libs !NO!SUBS! +;; +esac # How to build libperl. This is still rather convoluted. # Load up custom Makefile.SH fragment for shared loading and executables: @@ -762,7 +768,7 @@ MINIPERL_NONSHR = miniperl_nonshr$(EXE_EXT) $(LIBPERL_NONSHR): $(obj) $(RMS) $(LIBPERL_NONSHR) - $(AR) rcu $(LIBPERL_NONSHR) $(obj) + $(AR) rc $(LIBPERL_NONSHR) $(obj) $(MINIPERL_NONSHR): $(LIBPERL_NONSHR) miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perlmini$(OBJ_EXT) $(CC) $(LDFLAGS) -o $(MINIPERL_NONSHR) miniperlmain$(OBJ_EXT) \ @@ -808,7 +814,7 @@ LIBPERL_NONSHR = libperl$(LIB_EXT) $(LIBPERL_NONSHR): $(obj) $(RMS) $(LIBPERL_NONSHR) - $(AR) rcu $(LIBPERL_NONSHR) $(obj) + $(AR) rc $(LIBPERL_NONSHR) $(obj) !NO!SUBS! ;; @@ -869,7 +875,7 @@ $(LIBPERL): $& $(obj) $(DYNALOADER) $(LIBPERLEXPORT) *) $spitshell >>$Makefile <<'!NO!SUBS!' rm -f $(LIBPERL) - $(AR) rcu $(LIBPERL) $(obj) $(DYNALOADER) + $(AR) rc $(LIBPERL) $(obj) $(DYNALOADER) @$(ranlib) $(LIBPERL) !NO!SUBS! ;; @@ -890,7 +896,7 @@ $(LIBPERL): $& $(obj) $(DYNALOADER) $(LIBPERLEXPORT) # lib/buildcustomize.pl despite the reality that lib/buildcustomize.pl needs # miniperl to exist first permits us to # a) have one rule generate both miniperl and lib/buildcustomize.pl -# (so that lib/buildcustomise.pl is always available. This simplifies things) +# (so that lib/buildcustomize.pl is always available. This simplifies things) # b) have the rest of the Makefile depend on the more obvious $(MINIPERL_EXE) $(MINIPERL_EXE): lib/buildcustomize.pl @@ -898,6 +904,16 @@ $(MINIPERL_EXE): lib/buildcustomize.pl !NO!SUBS! case "${osname}${osvers}" in + amigaos*) + $spitshell >>$Makefile <<'!NO!SUBS!' +lib/buildcustomize.pl: $& $(mini_obj) write_buildcustomize.pl + -@rm -f miniperl.xok + $(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \ + $(mini_obj) $(libs) +# $(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1' + $(MINIPERL) -f write_buildcustomize.pl +!NO!SUBS! + ;; aix*) $spitshell >>$Makefile <<'!NO!SUBS!' lib/buildcustomize.pl: $& $(mini_obj) @@ -963,7 +979,26 @@ lib/buildcustomize.pl: $& $(mini_obj) write_buildcustomize.pl $(PERL_EXE): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT) write_buildcustomize.pl -@rm -f miniperl.xok +!NO!SUBS! + + case $osname in + # In AmigaOS the Perl executable needs to be linked with -ldl, + # but none of the other executables should be. + amigaos) $spitshell >>$Makefile <<'!NO!SUBS!' + $(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(LLIBPERL) $(static_ext) `cat ext.libs` $(libs) -ldl +!NO!SUBS! + ;; + os390) $spitshell >>$Makefile <<'!NO!SUBS!' + $(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(LLIBPERL) $(static_ext) `cat ext.libs` $(libs) +!NO!SUBS! + ;; + *) $spitshell >>$Makefile <<'!NO!SUBS!' $(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) +!NO!SUBS! + ;; + esac + + $spitshell >>$Makefile <<'!NO!SUBS!' # Microperl. This is just a convenience thing if one happens to # build also the full Perl and therefore the real big Makefile: @@ -1032,9 +1067,9 @@ pod/perlintern.pod: $(MINIPERL_EXE) autodoc.pl embed.fnc pod/perlmodlib.pod: $(MINIPERL_EXE) pod/perlmodlib.PL MANIFEST $(MINIPERL) pod/perlmodlib.PL -q -pod/perl5199delta.pod: pod/perldelta.pod - $(RMS) pod/perl5199delta.pod - $(LNS) perldelta.pod pod/perl5199delta.pod +pod/perl5239delta.pod: pod/perldelta.pod + $(RMS) pod/perl5239delta.pod + $(LNS) perldelta.pod pod/perl5239delta.pod extra.pods: $(MINIPERL_EXE) -@test ! -f extra.pods || rm -f `cat extra.pods` @@ -1068,19 +1103,20 @@ install: install-all for name in all notify silent strip verbose; do flags="--$name"; + flags=`echo $flags | sed -e 's/--all//'` if test "X$hostperl" != X; then $spitshell >>$Makefile <>$Makefile <>$Makefile <>$Makefile <<'!NO!SUBS!' .PHONY: depend -depend: makedepend - sh ./makedepend MAKE=$(MAKE) cflags +depend: makedepend $(DTRACE_H) $(generated_headers) + sh ./makedepend MAKE="$(MAKE)" cflags .PHONY: test check test_prep test_prep_nodll test_prep_pre \ test_prep_reonly test_tty test-tty test_notty test-notty \ @@ -1425,15 +1462,14 @@ test_prep_pre: preplibrary utilities $(nonxs_ext) case "$targethost" in '') $spitshell >>$Makefile <<'!NO!SUBS!' test_prep test-prep: test_prep_pre $(MINIPERL_EXE) $(unidatafiles) $(PERL_EXE) \ - $(dynamic_ext) $(TEST_PERL_DLL) runtests x2p/s2p x2p/find2perl \ - $(generated_pods) + $(dynamic_ext) $(TEST_PERL_DLL) runtests $(generated_pods) cd t && (rm -f $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE)) !NO!SUBS! ;; *) $spitshell >>$Makefile <>$Makefile <<'!NO!SUBS!' test_prep_reonly: $(MINIPERL_EXE) $(PERL_EXE) $(dynamic_ext_re) $(TEST_PERL_DLL) - $(MINIPERL) make_ext.pl $(dynamic_ext_re) MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic + $(MINIPERL) make_ext.pl $(dynamic_ext_re) MAKE="$(MAKE)" LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic cd t && (rm -f $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE)) +!NO!SUBS! + +case "$targethost" in +'') $spitshell >>$Makefile <<'!NO!SUBS!' test check: test_prep $(RUN_TESTS) choose +!NO!SUBS! +;; +*) $spitshell >>$Makefile <>$Makefile <<'!NO!SUBS!' test_tty test-tty: test_prep $(RUN_TESTS) tty @@ -1508,23 +1563,30 @@ test.valgrind check.valgrind: test_prep @grep "^usemymalloc='n'" config.sh >/dev/null || exit 1 @echo "And of course you have to have valgrind..." $(VALGRIND) $(VG_TEST) || exit 1 - PERL_VALGRIND=1 VALGRIND='$(VALGRIND)' $(RUN_TESTS) choose + PERL_VALGRIND=1 VALGRIND='$(VALGRIND)' TESTFILE=harness $(RUN_TESTS) choose !NO!SUBS! ;; esac $spitshell >>$Makefile <<'!NO!SUBS!' -# Can't depend on lib/Config.pm because that might be where miniperl +# minitest can't depend on lib/Config.pm because that might be where miniperl # is crashing. -minitest: $(MINIPERL_EXE) +minitest_prep: -@test -f lib/Config.pm || $(MAKE) lib/Config.pm $(unidatafiles) @echo " " @echo "You may see some irrelevant test failures if you have been unable" @echo "to build lib/Config.pm, or the Unicode data files." @echo " " - - cd t && (rm -f $(PERL_EXE); $(LNS) ../$(MINIPERL_EXE) $(PERL_EXE)) \ - && $(RUN_PERL) TEST base/*.t comp/*.t cmd/*.t run/*.t io/*.t re/*.t opbasic/*.t op/*.t uni/*.t &2 case "$osname" in os390|posix-bc) - if cd x2p - then - rm -f y.tab.c y.tab.h - case "$osname" in - posix-bc) - # we are using two different yaccs in BS2000 Posix! - byacc a2p.y >/dev/null 2>&1 - ;; - *) # e.g. os390 - yacc a2p.y >/dev/null 2>&1 - ;; - esac - if cmp -s y.tab.c a2p.c - then - rm -f y.tab.c - else - echo "a2p.y -> a2p.c" >&2 - mv -f y.tab.c a2p.c - chmod u+w a2p.c - sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \ - -e 's|^static void __YY_YACC_MAIN.*BS2000.*|/*static main deleted*/|' \ - -e 's/y\.tab/a2p/g' a2p.c >a2p.tmp && mv a2p.tmp a2p.c - xxx="$xxx a2p.c" - fi - # In case somebody yacc -d:ed the a2p.y. - if test -f y.tab.h - then - if cmp -s y.tab.h a2p.h - then - rm -f y.tab.h - else - echo "a2p.h -> a2p.h" >&2 - mv -f y.tab.h a2p.h - xxx="$xxx a2p.h" - fi - fi - cd .. - fi ;; *) echo "'$osname' is an EBCDIC system I don't know that well." >&4