summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2013-05-15 20:57:37 +0200
committerNicholas Clark <nick@ccl4.org>2013-05-20 21:50:45 +0200
commit9719c95bf27185afc59c14150d4f052f92217540 (patch)
treecf5f154c527a7ba02b54e3d02a5a503b18e3e606
parentfc40bd89f80e1d94b62f08a3ab57f39ea3333029 (diff)
downloadperl-9719c95bf27185afc59c14150d4f052f92217540.tar.gz
Programmatically generate dependencies for all *.SH files.
Previously dependencies for Makefile, config.h and makedepend were explicitly coded into verbatim sections of Makefile.SH, with most of the others being generated by makedepend.SH
-rwxr-xr-xMakefile.SH27
-rwxr-xr-xmakedepend.SH29
2 files changed, 17 insertions, 39 deletions
diff --git a/Makefile.SH b/Makefile.SH
index ee9ea47600..5c9904766a 100755
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -443,9 +443,12 @@ xconfig.h: config_h.SH Cross/config-\$(CROSS_NAME).sh
;;
esac
-SH='Makefile.SH cflags.SH config_h.SH makedepend.SH myconfig.SH runtests.SH pod/Makefile.SH'
-shextract=`echo $SH | sed -e s/\\\.SH//g -e s/_/./g`
+SH_to_target() {
+ echo $@ | sed -e s/\\\.SH//g -e s/_/./g
+}
+SH='Makefile.SH cflags.SH config_h.SH makedepend.SH myconfig.SH runtests.SH pod/Makefile.SH'
+shextract=`SH_to_target $SH`
## In the following dollars and backticks do not need the extra backslash.
$spitshell >>$Makefile <<!GROK!THIS!
@@ -1400,18 +1403,23 @@ MAKEDEPEND = Makefile makedepend
$(FIRSTMAKEFILE): README $(MAKEDEPEND)
$(MAKE) depend MAKEDEPEND=
+!NO!SUBS!
+
+for f in $SH; do
+ file=`SH_to_target $f`
+ $spitshell >>$Makefile <<!GROK!THIS!
-config.h: config_h.SH config.sh
- $(SHELL) config_h.SH
+$file: $f config.sh
+ \$(SHELL) $f
+!GROK!THIS!
+done
+
+$spitshell >>$Makefile <<'!NO!SUBS!'
.PHONY: depend
depend: makedepend
sh ./makedepend MAKE=$(MAKE) cflags
-# Cannot postpone this until $firstmakefile is ready ;-)
-makedepend: makedepend.SH config.sh
- sh ./makedepend.SH
-
.PHONY: test check test_prep test_prep_nodll test_prep_pre \
test_prep_reonly test_tty test-tty test_notty test-notty \
utest ucheck test.utf8 check.utf8 test.torture torturetest \
@@ -1594,9 +1602,6 @@ hlist: $(h)
shlist: $(sh)
echo $(sh) | tr ' ' $(TRNL) >.shlist
-Makefile: Makefile.SH ./config.sh
- $(SHELL) Makefile.SH
-
.PHONY: distcheck
distcheck: FORCE
perl '-MExtUtils::Manifest=&fullcheck' -e 'fullcheck()'
diff --git a/makedepend.SH b/makedepend.SH
index 3ea3a3e5e7..f992af3f10 100755
--- a/makedepend.SH
+++ b/makedepend.SH
@@ -211,30 +211,7 @@ done
$sed <$mf >$mf.new -e '1,/^# AUTOMATICALLY/!d'
-$MAKE shlist || ($echo "Searching for .SH files..."; \
- $echo *.SH | $tr ' ' $trnl | $egrep -v '\*' >.shlist)
-
-# Now extract the dependencies on makedepend.SH and Makefile.SH
-# (they should reside in the main Makefile):
-rm -f .shlist.old
-mv .shlist .shlist.old
-$egrep -v '^makedepend\.SH' <.shlist.old >.shlist
-rm -f .shlist.old
-mv .shlist .shlist.old
-$egrep -v '^Makefile\.SH' <.shlist.old >.shlist
-rm -f .shlist.old
-mv .shlist .shlist.old
-$egrep -v '^perl_exp\.SH' <.shlist.old >.shlist
-rm -f .shlist.old
-mv .shlist .shlist.old
-$egrep -v '^config_h\.SH' <.shlist.old >.shlist
-rm .shlist.old
-
if $test -s .deptmp; then
- for file in `cat .shlist`; do
- $echo `$expr X$file : 'X\(.*\).SH'`: $file $TOP/config.sh \; \
- $sh $file >> .deptmp
- done
$echo "Updating $mf..."
$echo "# If this runs make out of memory, delete /usr/include lines." \
>> $mf.new
@@ -262,10 +239,6 @@ else
$sed -f .hsed >> $mf.new
<.deptmp $sed -n 's|h:#include "\(.*\)".*$|h: \1|p' | \
$sed -f .hsed >> $mf.new
- for file in `$cat .shlist`; do
- $echo `$expr X$file : 'X\(.*\).SH'`: $file $TOP/config.sh \; \
- $sh $file >> $mf.new
- done
fi
$rm -f $mf.old
$cp $mf $mf.old
@@ -273,7 +246,7 @@ $rm -f $mf
$cp $mf.new $mf
$rm $mf.new
$echo "# WARNING: Put nothing here or make depend will gobble it up!" >> $mf
-$rm -rf .deptmp UU .shlist .clist .hlist .hsed .cout .cerr
+$rm -rf .deptmp UU .clist .hlist .hsed .cout .cerr
rmdir .depending
!NO!SUBS!