[m-rev.] for prelim review: "Recursive make considered harmful" support
Peter Ross
pro at missioncriticalit.com
Thu Nov 10 08:40:40 AEDT 2005
Implement support for writing Mmakefile in the style of
"Recursive make considered harmful".
This consists of two parts, giving mmake the optional ability to ignore
the .d files in the current directory. The second part is adding
support to the compiler to write out just the .d file.
We may need to ignore the .d files in the current directory because we
may have included that file from another directory and we don't want to
define rules twice.
scripts/mmake.in:
scripts/Mmake.vars.in:
If the mmake variable MMAKE_AUTO_INCLUDE_DS is set to no then
don't include the rules defined in the .d files in the current
directory.
compiler/mercury_compile.m:
Add support for the --generate-dependency-file flag which just
writes out the .d file for a module and then stops.
compiler/options.m:
Add the generate_dependency_file option.
compiler/mercury_compile.m:
compiler/add_type.m:
compiler/handle_options.m:
Make sure that generate_dependency_file implies that we don't
need to build/link anything.
doc/user_guide.texi:
Document the --generate-dependency-file flag.
diff -u scripts/mmake.in scripts/mmake.in
--- scripts/mmake.in 8 Nov 2005 21:58:50 -0000
+++ scripts/mmake.in 9 Nov 2005 21:20:25 -0000
@@ -341,11 +341,6 @@
deps=
fi
-use_ds=${MMAKE_USE_DS=yes}
-if [ "$use_ds" = "no" ] ; then
- ds=
-fi
-
if $verbose; then
echo MMAKE=$MMAKE
echo export MMAKE
@@ -359,7 +354,7 @@
echo export MERCURY_DEFAULT_GRADE
echo MMAKEFILE=$MMAKEFILE
echo export MMAKEFILE
- echo cat ${MMAKE_VARS} $dvs $ds $include_makefile $MMAKEFILE $deps \
+ echo cat ${MMAKE_VARS} $include_makefile $MMAKEFILE $ds $dvs $deps \
${MMAKE_RULES}">>" $tmp
echo ${MMAKE_MAKE} ${MMAKE_MAKE_OPTS} -f $tmp -r ${set_target_asm} "$@"
fi
@@ -377,8 +372,12 @@
# `modules.m'.
{
cat ${MMAKE_VARS}
-echo $dvs $ds | xargs cat
-cat $include_makefile $MMAKEFILE $deps ${MMAKE_RULES}
+cat $include_makefile $MMAKEFILE
+echo 'ifneq ($(MMAKE_AUTO_INCLUDE_DS),no)'
+echo $ds | xargs cat
+echo 'endif'
+echo $dvs | xargs cat
+cat $deps ${MMAKE_RULES}
} > $tmp
case $# in
# Note that we can't use `exec' here, because if we did that,
diff -u compiler/options.m compiler/options.m
--- compiler/options.m 8 Nov 2005 21:58:53 -0000
+++ compiler/options.m 9 Nov 2005 21:20:21 -0000
@@ -2910,6 +2910,9 @@
"-M, --generate-dependencies",
"\tOutput `Make'-style dependencies for the module",
"\tand all of its dependencies to `<module>.dep'.",
+ "--generate-dependency-file",
+ "\tOutput `Make'-style dependencies for the module",
+ "\tto `<module>.d'.",
"--generate-module-order",
"\tOutput the strongly connected components of the module",
"\tdependency graph in top-down order to `<module>.order'.",
only in patch2:
unchanged:
--- doc/user_guide.texi 2 Nov 2005 14:02:08 -0000 1.458
+++ doc/user_guide.texi 9 Nov 2005 21:20:24 -0000
@@ -5480,6 +5480,10 @@
dependencies to @file{@var{module}.dep}, @file{@var{module}.dv} and the
relevant @samp{.d} files.
+ at itemx --generate-dependency-file
+ at findex --generate-dependency-file
+Output `Make'-style dependencies for the module to @file{@var{module}.d}'.
+
@item --generate-module-order
Output the strongly connected components of the module
dependency graph in top-down order to @file{@var{module}.order}.
only in patch2:
unchanged:
--- scripts/Mmake.vars.in 25 Oct 2005 10:17:28 -0000 1.97
+++ scripts/Mmake.vars.in 9 Nov 2005 21:20:25 -0000
@@ -785,3 +785,9 @@
ERR_REDIRECT = > $(*F).err 2>&1
#-----------------------------------------------------------------------------#
+
+# If this variable is set to no, then mmake doesn't automatically include
+# the ".d" files in the current directory in the Mmakefile.
+MMAKE_AUTO_INCLUDE_DS=yes
+
+#-----------------------------------------------------------------------------#
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list