[m-dev.] For review: Split auto-generated dependencies
Warwick Harvey
wharvey at cs.monash.edu.au
Thu Jul 15 14:40:26 AEST 1999
Estimated hours taken: 15
Split the automatically generated `.dep' file into two files. The new `.dv'
file contains all the variable definitions which used to be in the `.dep'
file, which now contains just the rules. With mmake including the `.dv'
files before the user's Mmakefile and the `.dep' files after, this allows
user-defined Mmakefiles to refer to the automatically-generated variables
and automatically-generated rules to refer to variables defined in the
user's Mmakefile. This was possible before to a limited extend, but in
particular dependency lists for automatically-generated rules could not
refer to user-defined variables.
Also introduced `C2INITARGS' as part of an illustration of how this change
is useful (though probably this should be a separate change). `C2INITARGS'
should be used to specify extra files to be passed to `c2init', rather than
the currently-used `C2INITFLAGS' (which should only be used for option
flags). The `_init.c' target should depend on these extra arguments, but it
was not possible to do this automatically prior to this change (at least,
not if one wanted to support per-program specification of `C2INITARGS').
compiler/modules.m:
Generate the new `.dv' files and revised `.dep' files.
Update the `change_clean' and `real_clean' targets to delete the
`.dv' files.
Update the `_init.c' rule to refer to `$(ALL_C2INITARGS)' as well as
`$(ALL_C2INITFLAGS)', and add a dependency on `$(ALL_C2INITARGS)'.
scripts/Mmake.rules:
Add appropriate rules and dependencies for `.dv' files.
scripts/Mmake.vars:
Add definitions for implementing `C2INITARGS'.
scripts/mmake.in:
Add code for using `.dv' files (while maintaining backward
compatibility for when they don't exist).
doc/user_guide.texi:
Document the new `.dv' files.
../clpr/Mmakefile:
../clpr/samples/Mmakefile:
extras/complex_numbers/samples/Mmakefile:
extras/complex_numbers/tests/Mmakefile:
extras/graphics/mercury_opengl/Mmakefile:
extras/references/samples/Mmakefile:
extras/references/tests/Mmakefile:
extras/trailed_update/samples/Mmakefile:
extras/trailed_update/tests/Mmakefile:
Update to use `C2INITARGS' instead of `C2INITFLAGS', where
appropriate, and remove any now-obsolete `%_init.c' dependencies
(which wouldn't have worked anyway since GNU Make ignores pattern
dependencies with no commands).
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.100
diff -u -r1.100 modules.m
--- modules.m 1999/07/12 14:09:12 1.100
+++ modules.m 1999/07/15 04:36:18
@@ -1869,8 +1869,10 @@
;
{ module_imports_get_source_file_name(ModuleImports,
SourceFileName) },
- generate_dependencies_write_dep_file(SourceFileName, ModuleName,
- DepsMap),
+ generate_dependencies_write_dv_file(SourceFileName,
+ ModuleName, DepsMap),
+ generate_dependencies_write_dep_file(SourceFileName,
+ ModuleName, DepsMap),
%
% compute the interface deps relation and
@@ -2176,6 +2178,31 @@
%-----------------------------------------------------------------------------%
+ % Write out the `.dv' file, using the information collected in the
+ % deps_map data structure.
+:- pred generate_dependencies_write_dv_file(file_name::in, module_name::in,
+ deps_map::in, io__state::di, io__state::uo) is det.
+generate_dependencies_write_dv_file(SourceFileName, ModuleName, DepsMap) -->
+ globals__io_lookup_bool_option(verbose, Verbose),
+ module_name_to_file_name(ModuleName, ".dv", yes, DvFileName),
+ maybe_write_string(Verbose, "% Creating auto-dependency file `"),
+ maybe_write_string(Verbose, DvFileName),
+ maybe_write_string(Verbose, "'...\n"),
+ io__open_output(DvFileName, DvResult),
+ ( { DvResult = ok(DvStream) },
+ generate_dv_file(SourceFileName, ModuleName, DepsMap,
+ DvStream),
+ io__close_output(DvStream),
+ maybe_write_string(Verbose, "% done.\n")
+ ; { DvResult = error(IOError) },
+ maybe_write_string(Verbose, " failed.\n"),
+ maybe_flush_output(Verbose),
+ { io__error_message(IOError, IOErrorMessage) },
+ { string__append_list(["error opening file `", DvFileName,
+ "' for output: ", IOErrorMessage], DvMessage) },
+ report_error(DvMessage)
+ ).
+
% Write out the `.dep' file, using the information collected in the
% deps_map data structure.
:- pred generate_dependencies_write_dep_file(file_name::in, module_name::in,
@@ -2202,25 +2229,13 @@
).
-:- pred generate_dep_file(file_name, module_name, deps_map, io__output_stream,
+:- pred generate_dv_file(file_name, module_name, deps_map, io__output_stream,
io__state, io__state).
-:- mode generate_dep_file(in, in, in, in, di, uo) is det.
+:- mode generate_dv_file(in, in, in, in, di, uo) is det.
-generate_dep_file(SourceFileName, ModuleName, DepsMap, DepStream) -->
- %
- % Some of the targets are based on the source file name
- % rather than on the module name.
- %
- {
- string__remove_suffix(SourceFileName, ".m", SourceFileBase)
- ->
- file_name_to_module_name(SourceFileBase, SourceModuleName)
- ;
- error("modules.m: source file name doesn't end in `.m'")
- },
-
+generate_dv_file(SourceFileName, ModuleName, DepsMap, DepStream) -->
io__write_string(DepStream,
- "# Automatically generated dependencies for module `"),
+ "# Automatically generated dependency variables for module `"),
{ prog_out__sym_name_to_string(ModuleName, ModuleNameString) },
io__write_string(DepStream, ModuleNameString),
io__write_string(DepStream, "'\n"),
@@ -2419,8 +2434,47 @@
io__write_string(DepStream, ".profs = "),
write_compact_dependencies_list(Modules, "", ".prof",
Basis, DepStream),
- io__write_string(DepStream, "\n\n"),
+ io__write_string(DepStream, "\n\n").
+
+
+:- pred generate_dep_file(file_name, module_name, deps_map, io__output_stream,
+ io__state, io__state).
+:- mode generate_dep_file(in, in, in, in, di, uo) is det.
+generate_dep_file(SourceFileName, ModuleName, DepsMap, DepStream) -->
+ %
+ % Some of the targets are based on the source file name
+ % rather than on the module name.
+ %
+ {
+ string__remove_suffix(SourceFileName, ".m", SourceFileBase)
+ ->
+ file_name_to_module_name(SourceFileBase, SourceModuleName)
+ ;
+ error("modules.m: source file name doesn't end in `.m'")
+ },
+
+ io__write_string(DepStream,
+ "# Automatically generated dependencies for module `"),
+ { prog_out__sym_name_to_string(ModuleName, ModuleNameString) },
+ io__write_string(DepStream, ModuleNameString),
+ io__write_string(DepStream, "'\n"),
+ io__write_string(DepStream,
+ "# generated from source file `"),
+ io__write_string(DepStream, SourceFileName),
+ io__write_string(DepStream, "'\n"),
+
+ { library__version(Version) },
+ io__write_string(DepStream,
+ "# Generated by the Mercury compiler, version "),
+ io__write_string(DepStream, Version),
+ io__write_string(DepStream, ".\n\n"),
+
+ { map__keys(DepsMap, Modules0) },
+ { select_ok_modules(Modules0, DepsMap, Modules) },
+
+ { module_name_to_make_var_name(ModuleName, MakeVarName) },
+
module_name_to_file_name(ModuleName, ".init", yes, InitFileName),
module_name_to_file_name(ModuleName, "_init.c", yes, InitCFileName),
module_name_to_file_name(ModuleName, "_init.s", no, InitAsmFileName),
@@ -2496,6 +2550,7 @@
]),
module_name_to_file_name(ModuleName, ".dep", no, DepFileName),
+ module_name_to_file_name(ModuleName, ".dv", no, DvFileName),
io__write_strings(DepStream, [
InitFileName, " : ", DepFileName, "\n",
"\techo > ", InitFileName, "\n"
@@ -2503,10 +2558,16 @@
list__foldl(append_to_init_list(DepStream, InitFileName), Modules),
io__write_string(DepStream, "\n"),
- io__write_strings(DepStream, [
- InitCFileName, " : ", DepFileName, "\n",
+ % Note we have to do some ``interesting'' hacks to get
+ % `$(ALL_C2INITARGS)' to work in the dependency list (and not
+ % complain about undefined variables).
+ io__write_strings(DepStream, [
+ InitCFileName, " : ", DepFileName, " ", DvFileName,
+ " $(foreach @,undefined,$(foreach *,", MakeVarName,
+ ",$(ALL_C2INITARGS)))\n",
"\t$(C2INIT) $(ALL_GRADEFLAGS) $(ALL_C2INITFLAGS) $(",
- MakeVarName, ".init_cs) > ", InitCFileName, "\n\n"
+ MakeVarName, ".init_cs) $(ALL_C2INITARGS) > ",
+ InitCFileName, "\n\n"
]),
module_name_to_file_name(SourceModuleName, ".nu", yes, NU_ExeFileName),
@@ -2606,7 +2667,8 @@
InitFileName, " ",
LibFileName, " ",
SharedLibFileName, " ",
- DepFileName, "\n\n"
+ DepFileName, " ",
+ DvFileName, "\n\n"
]),
module_name_to_file_name(SourceModuleName, ".realclean", no,
@@ -2647,7 +2709,8 @@
NU_DebugSaveExeFileName, " ",
SicstusExeFileName, " ",
SicstusDebugExeFileName, " ",
- DepFileName, "\n\n"
+ DepFileName, " ",
+ DvFileName, "\n\n"
]),
module_name_to_file_name(SourceModuleName, ".clean_nu", no,
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.179
diff -u -r1.179 user_guide.texi
--- user_guide.texi 1999/07/08 04:56:34 1.179
+++ user_guide.texi 1999/07/15 04:36:19
@@ -158,6 +158,8 @@
which contain the dependencies for a module.
Files ending in @file{.dep} are automatically-generated Makefile fragments
which contain the rules for an entire program.
+Files ending in @file{.dv} are automatically-generated Makefile fragments
+which contain variable definitions for an entire program.
As usual, @file{.c} files are C source code,
@file{.h} files are C header files,
@@ -360,16 +362,16 @@
Most of the dependencies are stored in @file{.d} files that are
automatically recomputed every time you recompile,
so they are never out-of-date.
-A little bit of the dependency information is stored in @file{.dep} files
-which are more expensive to recompute.
-The @samp{mmake @var{main-module}.depend} command
-which recreates the @file{@var{main-module}.dep} file
-needs to be repeated only when you add or remove a module from your program,
-and there is no danger of getting an inconsistent executable
-if you forget this step --- instead you will get a compile or link error.
+A little bit of the dependency information is stored in @file{.dep}
+and @file{.dv} files which are more expensive to recompute.
+The @samp{mmake @var{main-module}.depend} command which recreates the
+ at file{@var{main-module}.dep} and @file{@var{main-module}.dv} files needs
+to be repeated only when you add or remove a module from your program,
+and there is no danger of getting an inconsistent executable if you forget
+this step --- instead you will get a compile or link error.
@samp{mmake} allows you to build more than one program in the same directory.
-Each program must have its own @file{.dep} file,
+Each program must have its own @file{.dep} and @file{.dv} files,
and therefore you must run @samp{mmake @var{program}.depend}
for each program.
@@ -384,12 +386,14 @@
@file{@var{prefix}/lib/mercury/mmake/Mmake.rules}
(where @var{prefix} is @file{/usr/local/mercury- at var{version}} by default,
and @var{version} is the version number, e.g. @samp{0.6}),
-as well as the rules in the automatically-generated @file{.dep} files.
+as well as the rules and variables in the automatically-generated
+ at file{.dep} and @file{.dv} files.
These rules define the following targets:
@table @file
@item @var{main-module}.depend
-Creates the file @file{@var{main-module}.dep} from @file{@var{main-module}.m}
+Creates the files @file{@var{main-module}.dep} and
+ at file{@var{main-module}.dv} from @file{@var{main-module}.m}
and the modules it imports.
This step must be performed first.
@@ -434,8 +438,8 @@
(@pxref{Compilation model options}) or
when enabling inter-module optimization.
Specifically, this will remove all the @samp{.c}, @samp{.s}, @samp{.o},
- at samp{.dep} and executable files belonging to the named @var{main-module}
-or its imported modules.
+ at samp{.dep}, @samp{.dv} and executable files belonging to the named
+ at var{main-module} or its imported modules.
@item @var{main-module}.realclean
Removes all the automatically generated files.
@@ -447,7 +451,8 @@
@ifset aditi
@samp{.rlo},
@end ifset
- at samp{.d}, and @samp{.dep} belonging to one of the modules of the program,
+ at samp{.d}, @samp{.dep} and @samp{.dv}
+belonging to one of the modules of the program,
and also the various possible executables for the program ---
@samp{@var{main-module}},
@samp{@var{main-module}.nu},
@@ -2436,8 +2441,9 @@
@table @code
@item -M
@itemx --generate-dependencies
-Output ``Make''-style dependencies for the module
-and all of its dependencies to @file{@var{module}.dep}.
+Output ``Make''-style dependencies for the module and all of its
+dependencies to @file{@var{module}.dep}, @file{@var{module}.dv} and the
+relevant @samp{.d} files.
@item --generate-module-order
Output the strongly connected components of the module
@@ -2544,10 +2550,10 @@
@section Auxiliary output options
@table @code
@item --no-assume-gmake
-When generating @file{.dep} files, generate Makefile
+When generating @file{.d} and @file{.dv} files, generate Makefile
fragments that use only the features of standard make;
do not assume the availability of GNU Make extensions.
-This makes these files significantly larger.
+This can make these files significantly larger.
@item --trace-level @var{level}
Generate code that includes the specified level of execution tracing.
Index: extras/clpr/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/clpr/Mmakefile,v
retrieving revision 1.16
diff -u -r1.16 Mmakefile
--- Mmakefile 1999/03/14 06:24:39 1.16
+++ Mmakefile 1999/07/15 04:36:19
@@ -33,8 +33,7 @@
MLLIBS = -lclpr $(EXTRA_MLLIBS)
# We need to make sure that the CLP(R) library gets initialized
-C2INITFLAGS = cfloat.c
-%_init.c: cfloat.c
+C2INITARGS = cfloat.c
# We need this to use shared libraries on Linux
ML = ml --mercury-libs shared
Index: extras/clpr/samples/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/clpr/samples/Mmakefile,v
retrieving revision 1.8
diff -u -r1.8 Mmakefile
--- Mmakefile 1998/03/03 00:54:50 1.8
+++ Mmakefile 1999/07/15 04:36:19
@@ -18,8 +18,7 @@
MLFLAGS += -R`pwd`/.. -R`pwd`/../clpr -L.. -L../clpr
MLLIBS = -lcfloat_lib -lclpr
VPATH = ..:$(MMAKE_VPATH)
-C2INITFLAGS = ../cfloat_lib.init ../cfloat.c
-%_init.c: $(C2INITFLAGS)
+C2INITARGS = ../cfloat_lib.init ../cfloat.c
# The following is needed so that we can use shared libraries on Linux
MGNUCFLAGS += -DPIC_REG
Index: extras/complex_numbers/samples/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/complex_numbers/samples/Mmakefile,v
retrieving revision 1.2
diff -u -r1.2 Mmakefile
--- Mmakefile 1998/05/29 09:08:38 1.2
+++ Mmakefile 1999/07/15 04:36:19
@@ -7,7 +7,7 @@
MCFLAGS = -I$(COMPLEX_NUMBERS_DIR)
MLFLAGS = -R$(COMPLEX_NUMBERS_DIR) -L$(COMPLEX_NUMBERS_DIR)
MLLIBS = -lcomplex_numbers
-C2INITFLAGS = $(COMPLEX_NUMBERS_DIR)/complex_numbers.init
+C2INITARGS = $(COMPLEX_NUMBERS_DIR)/complex_numbers.init
MAIN_TARGET = fft
depend : fft.depend
Index: extras/complex_numbers/tests/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/complex_numbers/tests/Mmakefile,v
retrieving revision 1.2
diff -u -r1.2 Mmakefile
--- Mmakefile 1998/05/29 09:08:42 1.2
+++ Mmakefile 1999/07/15 04:36:19
@@ -7,7 +7,7 @@
MCFLAGS = -I$(COMPLEX_NUMBERS_DIR) $(EXTRA_MCFLAGS)
MLFLAGS = -R$(COMPLEX_NUMBERS_DIR) -L$(COMPLEX_NUMBERS_DIR) $(EXTRA_MLFLAGS)
MLLIBS = -lcomplex_numbers $(EXTRA_MLLIBS)
-C2INITFLAGS = $(COMPLEX_NUMBERS_DIR)/complex_numbers.init
+C2INITARGS = $(COMPLEX_NUMBERS_DIR)/complex_numbers.init
MAIN_TARGET = complex_test.res
Index: extras/graphics/mercury_opengl/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/graphics/mercury_opengl/Mmakefile,v
retrieving revision 1.1
diff -u -r1.1 Mmakefile
--- Mmakefile 1998/03/10 06:31:33 1.1
+++ Mmakefile 1999/07/15 04:36:19
@@ -14,7 +14,7 @@
MLFLAGS = -R$(MERCURY_TCLTK_DIR) $(EXTRA_MLFLAGS) \
-L$(MERCURY_TCLTK_DIR)
MLLIBS = $(EXTRA_MLLIBS)
-C2INITFLAGS = $(MERCURY_TCLTK_DIR)/mercury_tcltk.init
+C2INITARGS = $(MERCURY_TCLTK_DIR)/mercury_tcltk.init
# We need to also access mtcltk.h
MGNUCFLAGS = -I$(MERCURY_TCLTK_DIR)
Index: extras/references/samples/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/references/samples/Mmakefile,v
retrieving revision 1.1
diff -u -r1.1 Mmakefile
--- Mmakefile 1998/06/18 04:30:30 1.1
+++ Mmakefile 1999/07/15 04:36:19
@@ -16,8 +16,7 @@
MLFLAGS += -R`pwd`/.. -L.. $(EXTRA_MLFLAGS)
MLLIBS = -lglobal $(EXTRA_MLLIBS)
VPATH = ..:$(MMAKE_VPATH)
-C2INITFLAGS = ../global.init
-%_init.c: $(C2INITFLAGS)
+C2INITARGS = ../global.init
# We need the following to use shared libraries on Linux
#MGNUCFLAGS += -DPIC_REG
Index: extras/references/tests/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/references/tests/Mmakefile,v
retrieving revision 1.1
diff -u -r1.1 Mmakefile
--- Mmakefile 1998/06/18 04:30:36 1.1
+++ Mmakefile 1999/07/15 04:36:19
@@ -16,8 +16,7 @@
MLFLAGS += -R`pwd`/.. -L.. $(EXTRA_MLFLAGS)
MLLIBS = -lglobal $(EXTRA_MLLIBS)
VPATH = ..:$(MMAKE_VPATH)
-C2INITFLAGS = ../global.init
-%_init.c: $(C2INITFLAGS)
+C2INITARGS = ../global.init
# We need the following to use shared libraries on Linux
#MGNUCFLAGS += -DPIC_REG
Index: extras/trailed_update/samples/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/trailed_update/samples/Mmakefile,v
retrieving revision 1.9
diff -u -r1.9 Mmakefile
--- Mmakefile 1998/06/03 00:43:47 1.9
+++ Mmakefile 1999/07/15 04:36:19
@@ -20,8 +20,7 @@
MLFLAGS += -R`pwd`/.. -L.. $(EXTRA_MLFLAGS)
MLLIBS = -ltrailed_update $(EXTRA_MLLIBS)
VPATH = ..:$(MMAKE_VPATH)
-C2INITFLAGS = ../trailed_update.init
-%_init.c: $(C2INITFLAGS)
+C2INITARGS = ../trailed_update.init
# We need the following to use shared libraries on Linux
#MGNUCFLAGS += -DPIC_REG
Index: extras/trailed_update/tests/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/trailed_update/tests/Mmakefile,v
retrieving revision 1.2
diff -u -r1.2 Mmakefile
--- Mmakefile 1998/06/03 00:43:49 1.2
+++ Mmakefile 1999/07/15 04:36:20
@@ -20,8 +20,7 @@
MLFLAGS += -R`pwd`/.. -L.. $(EXTRA_MLFLAGS)
MLLIBS = -ltrailed_update $(EXTRA_MLLIBS)
VPATH = ..:$(MMAKE_VPATH)
-C2INITFLAGS = ../trailed_update.init
-%_init.c: $(C2INITFLAGS)
+C2INITARGS = ../trailed_update.init
# We need the following to use shared libraries on Linux
#MGNUCFLAGS += -DPIC_REG
Index: scripts/Mmake.rules
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.rules,v
retrieving revision 1.69
diff -u -r1.69 Mmake.rules
--- Mmake.rules 1999/07/14 07:17:51 1.69
+++ Mmake.rules 1999/07/15 04:36:20
@@ -16,7 +16,7 @@
# Beware that the order of suffixes is significant.
.SUFFIXES: .m .nl .no .err \
.int0 .int .int2 .int3 .opt .trans_opt \
- .dep .depend .doit .ugly \
+ .dep .depend .dv .doit .ugly \
.date0 .date .date3 .optdate .trans_opt_date \
.c .nu .o .pic_o \
.i .s .pic_s \
@@ -81,8 +81,8 @@
# I have sent off a bug report to the GNU Make maintainers (19 March 1998).
# -fjh.
-# beware the code for `%.depend' and `%.dep' is duplicated
-$(deps_subdir)%.dep:
+# beware the code for `%.depend' and `%.dep'/`%.dv' is duplicated
+$(deps_subdir)%.dep $(deps_subdir)%.dv:
$(MCD) $(ALL_MCDFLAGS) $*
ifeq ($(MMAKE_USE_SUBDIRS),yes)
# the following mkdirs work around a bug in GNU Make
@@ -92,7 +92,7 @@
-[ -d Mercury/optdates ] || mkdir Mercury/optdates
endif
-# beware the code for `%.depend' and `%.dep' is duplicated
+# beware the code for `%.depend' and `%.dep'/`%.dv' is duplicated
.PHONY: %.depend
%.depend :
$(MCD) $(ALL_MCDFLAGS) $*
@@ -106,7 +106,7 @@
# The `.doit' files are helpful when using Prolog.
-%.doit : $(deps_subdir)%.dep
+%.doit : $(deps_subdir)%.dep $(deps_subdir)%.dv
sed -e ':a' -e '/\\/N' -e 's/\\\n //' -e 't a' $< | \
grep '\.ms *=' | \
sed -e 's/.*=/:-[ '\''nu_library.doit'\'', /' \
Index: scripts/Mmake.vars.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.vars.in,v
retrieving revision 1.25
diff -u -r1.25 Mmake.vars.in
--- Mmake.vars.in 1999/07/01 11:01:15 1.25
+++ Mmake.vars.in 1999/07/15 04:36:20
@@ -78,6 +78,10 @@
C2INITFLAGS =
EXTRA_C2INITFLAGS =
+ALL_C2INITARGS = $(C2INITARGS) $(EXTRA_C2INITARGS) $(TARGET_C2INITARGS)
+C2INITARGS =
+EXTRA_C2INITARGS =
+
MGNUC = mgnuc
ALL_MGNUCFLAGS = $(MGNUCFLAGS) $(EXTRA_MGNUCFLAGS) $(TARGET_MGNUCFLAGS) \
$(ALL_CFLAGS)
@@ -203,6 +207,16 @@
$(origin C2INITFLAGS-$(patsubst %_init.c,%,$@))))
maybe-target-C2INITFLAGS- = $(C2INITFLAGS-$(patsubst %_init.c,%,$@))
maybe-target-C2INITFLAGS-undefined =
+
+TARGET_C2INITARGS = \
+ $(maybe-base-C2INITARGS-$(findstring undefined,\
+ $(origin C2INITARGS-$*))) \
+ $(maybe-target-C2INITARGS-$(findstring undefined,\
+ $(origin C2INITARGS-$(patsubst %_init.c,%,$@))))
+maybe-base-C2INITARGS- = $(C2INITARGS-$*)
+maybe-base-C2INITARGS-undefined =
+maybe-target-C2INITARGS- = $(C2INITARGS-$(patsubst %_init.c,%,$@))
+maybe-target-C2INITARGS-undefined =
TARGET_MGNUCFLAGS = \
$(maybe-base-MGNUCFLAGS-$(findstring undefined,$(origin MGNUCFLAGS-$*)))
Index: scripts/mmake.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/mmake.in,v
retrieving revision 1.27
diff -u -r1.27 mmake.in
--- mmake.in 1998/08/04 14:06:07 1.27
+++ mmake.in 1999/07/15 04:36:20
@@ -40,8 +40,8 @@
Print this usage message.
Targets:
<module>.depend:
- Make the file \`<module>.dep'. This step is required
- in preparation for the targets below.
+ Make the files \`<module>.dep' and \`<module>.dv'. This
+ step is required in preparation for the targets below.
<module>:
Compile and link a Mercury program with main module
\`<module>.m' to produce an executable.
@@ -144,6 +144,10 @@
case $use_subdirs in
no)
+ dvs="`echo *.dv`"
+ if [ "$dvs" = "*.dv" ]; then
+ dvs=""
+ fi
deps="`echo *.dep`"
if [ "$deps" = "*.dep" ]; then
deps=""
@@ -154,6 +158,10 @@
fi
;;
yes)
+ dvs="`echo Mercury/deps/*.dv`"
+ if [ "$dvs" = "Mercury/deps/*.dv" ]; then
+ dvs=""
+ fi
deps="`echo Mercury/deps/*.dep`"
if [ "$deps" = "Mercury/deps/*.dep" ]; then
deps=""
@@ -213,6 +221,13 @@
;;
esac
+# For backwards compatibility/bootstrapping:
+# If no `.dv' files exist, use the `.dep' files instead.
+if [ "$dvs" = "" ] ; then
+ dvs=$deps
+ deps=
+fi
+
if $verbose; then
echo MMAKE=$MMAKE
echo export MMAKE
@@ -224,7 +239,7 @@
echo export MERCURY_INT_DIR
echo MERCURY_DEFAULT_GRADE=$MERCURY_DEFAULT_GRADE
echo export MERCURY_DEFAULT_GRADE
- echo cat ${MMAKE_VARS} $deps $ds $mmake ${MMAKE_RULES} ">>" $tmp
+ echo cat ${MMAKE_VARS} $dvs $ds $mmake $deps ${MMAKE_RULES} ">>" $tmp
echo ${MMAKE_MAKE} ${MMAKE_MAKE_OPTS} -f $tmp -r "$@"
fi
export MMAKE
@@ -232,10 +247,10 @@
export MMAKE_USE_SUBDIRS
export MERCURY_INT_DIR
export MERCURY_DEFAULT_GRADE
-cat ${MMAKE_VARS} $deps $ds $mmake ${MMAKE_RULES} > $tmp
+cat ${MMAKE_VARS} $dvs $ds $mmake $deps ${MMAKE_RULES} > $tmp
case $# in
# Note that we can't use `exec' here, because if we did that,
# that `trap' code which removes $tmp would never get executed.
- 0) ${MMAKE_MAKE} -f $tmp -r ;;
+ 0) ${MMAKE_MAKE} ${MMAKE_MAKE_OPTS} -f $tmp -r ;;
*) ${MMAKE_MAKE} ${MMAKE_MAKE_OPTS} -f $tmp -r "$@" ;;
esac
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list