[m-rev.] for review: fix smart recompilation bug
Simon Taylor
stayl at cs.mu.OZ.AU
Wed Jul 4 04:36:24 AEST 2001
Estimated hours taken: 3
Use a timestamp file mechanism similar to that used for `.int' files
to avoid rechecking whether a module needs to be recompiled on each
mmake if no used interfaces have changed.
compiler/mercury_compile.m:
Touch a `.c_date', `.il_date', `.s_date' or `.pic_s_date' file
after compilation has finished.
compiler/recompilation_check.m:
Touch a `.c_date', `.il_date', `.s_date' or `.pic_s_date' file
if a module does not need to be recompiled.
compiler/modules.m:
scripts/Mmake.rules:
Set up the make dependencies for timestamp files, in a similar
manner to the `.date' files.
Remove the timestamp files in the `clean' mmake target.
scripts/Mmake.vars.in:
Set up the subdir variables for the timestamp files.
Mmakefile:
scripts/mercury_cleanup_install:
Save/restore the timestamp files and the `.used' files
across the library grade installation.
doc/user_guide.texi:
Document the new file extensions.
Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmakefile,v
retrieving revision 1.66
diff -u -u -r1.66 Mmakefile
--- Mmakefile 2001/05/31 05:59:27 1.66
+++ Mmakefile 2001/07/03 09:56:43
@@ -393,13 +393,15 @@
cd runtime && rm -rf tmp_dir && mkdir tmp_dir && \
{ mv -f *.$O *.pic_o *.$A *.so tmp_dir || true; }
cd library && rm -rf tmp_dir && mkdir tmp_dir && \
- { mv -f *.dep *.h *.c *.$O *.pic_o *.$A *.so \
- Mercury/deps/*.dep \
- Mercury/cs/*.c Mercury/os/*.$O tmp_dir || true; }
+ { mv -f *.dep *.h *.c *.c_date *.$O *.pic_o *.$A *.so *.used \
+ Mercury/useds/*.used Mercury/deps/*.dep \
+ Mercury/cs/*.c Mercury/c_dates/*.c_date \
+ Mercury/os/*.$O tmp_dir || true; }
cd browser && rm -rf tmp_dir && mkdir tmp_dir && \
- { mv -f *.dep *.h *.c *.$O *.pic_o *.$A *.so \
- Mercury/deps/*.dep \
- Mercury/cs/*.c Mercury/os/*.$O tmp_dir || true; }
+ { mv -f *.dep *.h *.c *.c_date *.$O *.pic_o *.$A *.so *.used \
+ Mercury/useds/*.used Mercury/deps/*.dep \
+ Mercury/cs/*.c Mercury/c_dates/*.c_date \
+ Mercury/os/*.$O tmp_dir || true; }
cd trace && rm -rf tmp_dir && mkdir tmp_dir && \
{ mv -f *.$O *.pic_o *.$A *.so tmp_dir || true; }
#
@@ -428,10 +430,10 @@
$(SUBDIR_MMAKE) MC=mmc GRADE=$$grade install_lib ) && \
( cd boehm_gc && rm -f *.$O *.pic_o *.$A *.so ) && \
( cd runtime && rm -f *.$O *.pic_o *.$A *.so ) && \
- ( cd library && rm -f *.dep *.h *.c *.$O *.pic_o *.$A *.so \
- Mercury/cs/*.c Mercury/os/*.$O ) && \
- ( cd browser && rm -f *.dep *.h *.c *.$O *.pic_o *.$A *.so \
- Mercury/cs/*.c Mercury/os/*.$O ) && \
+ ( cd library && rm -f *.dep *.h *.c *.c_date *.$O *.pic_o \
+ *.$A *.so Mercury/cs/*.c Mercury/os/*.$O ) && \
+ ( cd browser && rm -f *.dep *.h *.c *.c_date *.$O *.pic_o \
+ *.$A *.so Mercury/cs/*.c Mercury/os/*.$O ) && \
( cd trace && rm -f *.$O *.pic_o *.$A *.so ) && \
true \
|| { scripts/mercury_cleanup_install; exit 1; }; \
@@ -442,10 +444,18 @@
cd library && { [ -d Mercury/cs ] && mv tmp_dir/*.c Mercury/cs; \
[ -d Mercury/os ] && mv tmp_dir/*.$O Mercury/os; \
[ -d Mercury/deps ] && mv tmp_dir/*.dep Mercury/deps;\
+ [ -d Mercury/c_dates ] && \
+ mv tmp_dir/*.c_date Mercury/c_dates;\
+ [ -d Mercury/useds ] && \
+ mv tmp_dir/*.used Mercury/useds;\
mv tmp_dir/* . ; rmdir tmp_dir; true; }
cd browser && { [ -d Mercury/cs ] && mv tmp_dir/*.c Mercury/cs; \
[ -d Mercury/os ] && mv tmp_dir/*.$O Mercury/os; \
[ -d Mercury/deps ] && mv tmp_dir/*.dep Mercury/deps;\
+ [ -d Mercury/c_dates ] && \
+ mv tmp_dir/*.c_date Mercury/c_dates;\
+ [ -d Mercury/useds ] && \
+ mv tmp_dir/*.used Mercury/useds;\
mv tmp_dir/* . ; rmdir tmp_dir; true; }
cd trace && { mv tmp_dir/* . ; rmdir tmp_dir; true; }
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.207
diff -u -u -r1.207 mercury_compile.m
--- compiler/mercury_compile.m 2001/06/30 18:26:54 1.207
+++ compiler/mercury_compile.m 2001/07/02 18:26:54
@@ -621,9 +621,11 @@
globals__io_get_globals(Globals),
{ find_smart_recompilation_target_files(ModuleName,
Globals, FindTargetFiles) },
+ { find_timestamp_files(ModuleName, Globals,
+ FindTimestampFiles) },
recompilation_check__should_recompile(ModuleName,
- FindTargetFiles, ModulesToRecompile0,
- ReadModules),
+ FindTargetFiles, FindTimestampFiles,
+ ModulesToRecompile0, ReadModules),
{
ModulesToRecompile0 = some([_ | _]),
globals__get_target(Globals, asm)
@@ -681,6 +683,10 @@
{ assoc_list__keys(SubModuleList, NestedSubModules0) },
{ list__delete_all(NestedSubModules0,
ModuleName, NestedSubModules) },
+
+ globals__io_get_globals(Globals),
+ { find_timestamp_files(ModuleName, Globals,
+ FindTimestampFiles) },
(
{ any_mercury_builtin_module(ModuleName) }
->
@@ -699,7 +705,8 @@
compile_all_submodules(FileName,
ModuleName - NestedSubModules,
- MaybeTimestamp, ReadModules, SubModuleList,
+ MaybeTimestamp, ReadModules,
+ FindTimestampFiles, SubModuleList,
ModulesToLink),
globals__io_set_option(trace_stack_layout, bool(TSL)),
@@ -707,7 +714,8 @@
;
compile_all_submodules(FileName,
ModuleName - NestedSubModules,
- MaybeTimestamp, ReadModules, SubModuleList,
+ MaybeTimestamp, ReadModules,
+ FindTimestampFiles, SubModuleList,
ModulesToLink)
)
).
@@ -724,15 +732,17 @@
% i.e. compile nested modules to a single C file.
:- pred compile_all_submodules(string, pair(module_name, list(module_name)),
- maybe(timestamp), read_modules, list(pair(module_name, item_list)),
+ maybe(timestamp), read_modules, find_timestamp_file_names,
+ list(pair(module_name, item_list)),
list(string), io__state, io__state).
-:- mode compile_all_submodules(in, in, in, in, in, out, di, uo) is det.
+:- mode compile_all_submodules(in, in, in, in, in(find_timestamp_file_names),
+ in, out, di, uo) is det.
-compile_all_submodules(FileName, NestedSubModules, MaybeTimestamp,
- ReadModules, SubModuleList, ModulesToLink) -->
+compile_all_submodules(FileName, NestedSubModules, MaybeTimestamp, ReadModules,
+ FindTimestampFiles, SubModuleList, ModulesToLink) -->
list__foldl(
- compile(FileName, NestedSubModules,
- MaybeTimestamp, ReadModules),
+ compile(FileName, NestedSubModules, MaybeTimestamp,
+ ReadModules, FindTimestampFiles),
SubModuleList),
list__map_foldl(module_to_link, SubModuleList, ModulesToLink).
@@ -829,6 +839,35 @@
)
).
+:- pred find_timestamp_files(module_name, globals, find_timestamp_file_names).
+:- mode find_timestamp_files(in, in, out(find_timestamp_file_names)) is det.
+
+find_timestamp_files(TopLevelModuleName, Globals, FindTimestampFiles) :-
+ globals__lookup_bool_option(Globals, pic_reg, PicReg),
+ globals__get_target(Globals, CompilationTarget),
+ ( CompilationTarget = c, TimestampSuffix = ".c_date"
+ ; CompilationTarget = il, TimestampSuffix = ".il_date"
+ ; CompilationTarget = java, TimestampSuffix = ".java_date"
+ ; CompilationTarget = asm,
+ TimestampSuffix = (PicReg = yes -> ".pic_s_date" ; ".s_date")
+ ),
+ FindTimestampFiles =
+ (pred(ModuleName::in, TimestampFiles::out, di, uo) is det -->
+ (
+ { CompilationTarget = asm },
+ { ModuleName \= TopLevelModuleName }
+ ->
+ % With `--target asm' all the nested
+ % sub-modules are placed in the `.s' file
+ % of the top-level module.
+ { TimestampFiles = [] }
+ ;
+ module_name_to_file_name(ModuleName,
+ TimestampSuffix, no, FileName),
+ { TimestampFiles = [FileName] }
+ )
+ ).
+
%-----------------------------------------------------------------------------%
% Given a fully expanded module (i.e. a module name and a list
@@ -845,12 +884,14 @@
% so that new stages can be slotted in without too much trouble.
:- pred compile(file_name, pair(module_name, list(module_name)),
- maybe(timestamp), read_modules, pair(module_name, item_list),
- io__state, io__state).
-:- mode compile(in, in, in, in, in, di, uo) is det.
+ maybe(timestamp), read_modules, find_timestamp_file_names,
+ pair(module_name, item_list), io__state, io__state).
+:- mode compile(in, in, in, in, in(find_timestamp_file_names),
+ in, di, uo) is det.
compile(SourceFileName, RootModuleName - NestedSubModules0,
- MaybeTimestamp, ReadModules, ModuleName - Items) -->
+ MaybeTimestamp, ReadModules, FindTimestampFiles,
+ ModuleName - Items) -->
check_for_no_exports(Items, ModuleName),
grab_imported_modules(SourceFileName, ModuleName, ReadModules,
MaybeTimestamp, Items, Module, Error2),
@@ -860,16 +901,16 @@
;
NestedSubModules = []
},
- mercury_compile(Module, NestedSubModules)
+ mercury_compile(Module, NestedSubModules, FindTimestampFiles)
;
[]
).
:- pred mercury_compile(module_imports, list(module_name),
- io__state, io__state).
-:- mode mercury_compile(in, in, di, uo) is det.
+ find_timestamp_file_names, io__state, io__state).
+:- mode mercury_compile(in, in, in(find_timestamp_file_names), di, uo) is det.
-mercury_compile(Module, NestedSubModules) -->
+mercury_compile(Module, NestedSubModules, FindTimestampFiles) -->
{ module_imports_get_module_name(Module, ModuleName) },
% If we are only typechecking or error checking, then we should not
% modify any files, this includes writing to .d files.
@@ -1024,7 +1065,9 @@
MaybeRLFile, ModuleName, _CompileErrors)
),
recompilation_usage__write_usage_file(HLDS,
- NestedSubModules, MaybeTimestamps)
+ NestedSubModules, MaybeTimestamps),
+ FindTimestampFiles(ModuleName, TimestampFiles),
+ list__foldl(touch_file, TimestampFiles)
;
% If the number of errors is > 0, make sure that
% the compiler exits with a non-zero exit
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.168
diff -u -u -r1.168 modules.m
--- compiler/modules.m 2001/06/27 05:04:16 1.168
+++ compiler/modules.m 2001/07/03 09:59:17
@@ -577,6 +577,13 @@
:- pred touch_interface_datestamp(module_name, string, io__state, io__state).
:- mode touch_interface_datestamp(in, in, di, uo) is det.
+ % touch_file(FileName).
+ %
+ % Update the modification time for file `FileName'.
+
+:- pred touch_file(file_name, io__state, io__state).
+:- mode touch_file(in, di, uo) is det.
+
% update_interface(FileName)
%
% Call the shell script mercury_update_interface to update the
@@ -1299,7 +1306,9 @@
touch_interface_datestamp(ModuleName, Ext) -->
module_name_to_file_name(ModuleName, Ext, yes, OutputFileName),
+ touch_file(OutputFileName).
+touch_file(OutputFileName) -->
globals__io_lookup_bool_option(verbose, Verbose),
maybe_write_string(Verbose, "% Touching `"),
maybe_write_string(Verbose, OutputFileName),
@@ -1851,12 +1860,17 @@
},
module_name_to_file_name(ModuleName, ".optdate", no,
OptDateFileName),
- module_name_to_file_name(ModuleName, ".c", no, CFileName),
- module_name_to_file_name(ModuleName, ".s", no, AsmFileName),
- module_name_to_file_name(ModuleName, ".pic_s", no, PicAsmFileName),
+ module_name_to_file_name(ModuleName, ".c_date", no,
+ CDateFileName),
+ module_name_to_file_name(ModuleName, ".s_date", no,
+ AsmDateFileName),
+ module_name_to_file_name(ModuleName, ".pic_s_date", no,
+ PicAsmDateFileName),
module_name_to_file_name(ModuleName, ".$O", no, ObjFileName),
module_name_to_file_name(ModuleName, ".rlo", no, RLOFileName),
module_name_to_file_name(ModuleName, ".il", no, ILFileName),
+ module_name_to_file_name(ModuleName, ".il_date", no,
+ ILDateFileName),
module_name_to_file_name(ModuleName, ".pic_o", no,
PicObjFileName),
module_name_to_split_c_file_pattern(ModuleName, ".$O",
@@ -1864,9 +1878,9 @@
io__write_strings(DepStream, ["\n\n",
OptDateFileName, " ",
TransOptDateFileName, " ",
- CFileName, " ",
- AsmFileName, " ",
- PicAsmFileName, " ",
+ CDateFileName, " ",
+ AsmDateFileName, " ",
+ PicAsmDateFileName, " ",
ErrFileName, " ",
SplitObjPattern, " ",
RLOFileName, " ",
@@ -1898,7 +1912,7 @@
( { Intermod = yes; UseOptFiles = yes } ->
io__write_strings(DepStream, [
"\n\n",
- CFileName, " ",
+ CDateFileName, " ",
TransOptDateFileName, " ",
ErrFileName, " ",
SplitObjPattern, " :"
@@ -1927,7 +1941,7 @@
".opt", DepStream),
io__write_strings(DepStream, [
"\n\n",
- CFileName, " ",
+ CDateFileName, " ",
ErrFileName, " ",
SplitObjPattern, " :"
]),
@@ -1973,7 +1987,7 @@
HeaderFileName),
io__write_strings(DepStream, [
"\n\n", HeaderFileName,
- " : ", CFileName
+ " : ", CDateFileName
])
;
[]
@@ -2079,15 +2093,15 @@
TransOptDateFileName, " : ", SourceFileName,
"\n",
"\t$(MCTOI) $(ALL_MCTOIFLAGS) $<\n",
- CFileName, " : ", SourceFileName, "\n",
+ CDateFileName, " : ", SourceFileName, "\n",
"\t$(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) ",
"$< > ", ErrFileName, " 2>&1\n",
"ifeq ($(TARGET_ASM),yes)\n",
- AsmFileName, " : ", SourceFileName, "\n",
+ AsmDateFileName, " : ", SourceFileName, "\n",
"\t$(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) ",
"--target-code-only $< > ", ErrFileName,
" 2>&1\n",
- PicAsmFileName, " : ", SourceFileName, "\n",
+ PicAsmDateFileName, " : ", SourceFileName, "\n",
"\t$(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) ",
"--target-code-only --pic ",
"\\\n",
@@ -2095,7 +2109,7 @@
"$< > ", ErrFileName,
" 2>&1\n",
"endif # TARGET_ASM\n",
- ILFileName, " : ", SourceFileName, "\n",
+ ILDateFileName, " : ", SourceFileName, "\n",
"\t$(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) ",
"--il-only $< > ", ErrFileName,
" 2>&1\n",
@@ -2973,6 +2987,30 @@
io__write_string(DepStream, "\n"),
io__write_string(DepStream, MakeVarName),
+ io__write_string(DepStream, ".c_dates = "),
+ write_compact_dependencies_list(Modules, "$(c_dates_subdir)",
+ ".c_date", Basis, DepStream),
+ io__write_string(DepStream, "\n"),
+
+ io__write_string(DepStream, MakeVarName),
+ io__write_string(DepStream, ".il_dates = "),
+ write_compact_dependencies_list(Modules, "$(il_dates_subdir)",
+ ".il_date", Basis, DepStream),
+ io__write_string(DepStream, "\n"),
+
+ io__write_string(DepStream, MakeVarName),
+ io__write_string(DepStream, ".s_dates = "),
+ write_compact_dependencies_list(Modules, "$(s_dates_subdir)",
+ ".s_date", Basis, DepStream),
+ io__write_string(DepStream, "\n"),
+
+ io__write_string(DepStream, MakeVarName),
+ io__write_string(DepStream, ".pic_s_dates = "),
+ write_compact_dependencies_list(Modules, "$(pic_s_dates_subdir)",
+ ".pic_s_date", Basis, DepStream),
+ io__write_string(DepStream, "\n"),
+
+ io__write_string(DepStream, MakeVarName),
io__write_string(DepStream, ".ds = "),
write_compact_dependencies_list(Modules, "$(ds_subdir)", ".d",
Basis, DepStream),
@@ -3368,6 +3406,10 @@
"\t-rm -f $(", MakeVarName, ".os) ", InitObjFileName, "\n",
"\t-rm -f $(", MakeVarName, ".pic_os) ", InitPicObjFileName,
"\n",
+ "\t-rm -f $(", MakeVarName, ".c_dates)\n",
+ "\t-rm -f $(", MakeVarName, ".il_dates)\n",
+ "\t-rm -f $(", MakeVarName, ".s_dates)\n",
+ "\t-rm -f $(", MakeVarName, ".pic_s_dates)\n",
"\t-rm -f $(", MakeVarName, ".useds)\n",
"\t-rm -f $(", MakeVarName, ".ils)\n",
"\t-rm -f $(", MakeVarName, ".profs)\n",
Index: compiler/recompilation_check.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/recompilation_check.m,v
retrieving revision 1.1
diff -u -u -r1.1 recompilation_check.m
--- compiler/recompilation_check.m 2001/06/27 05:04:28 1.1
+++ compiler/recompilation_check.m 2001/07/02 18:30:12
@@ -25,18 +25,27 @@
:- inst find_target_file_names ==
(pred(in, out, di, uo) is det).
+:- type find_timestamp_file_names ==
+ pred(module_name, list(file_name), io__state, io__state).
+:- inst find_timestamp_file_names ==
+ (pred(in, out, di, uo) is det).
+
% recompilation_check__should_recompile(ModuleName, FindTargetFiles,
- % ModulesToRecompile, ReadModules)
+ % FindTimestampFiles, ModulesToRecompile, ReadModules)
%
% Process the `.used' files for the given module and all its
% inline sub-modules to find out which modules need to be recompiled.
% `FindTargetFiles' takes a module name and returns a list of
% file names which need to be up-to-date to avoid recompilation.
+ % `FindTimestampFiles' takes a module name and returns a list of
+ % file names which should be touched if the module does not need
+ % to be recompiled.
% `ReadModules' is the list of interface files read during
% recompilation checking, returned to avoid rereading them
% if recompilation is required.
:- pred recompilation_check__should_recompile(module_name::in,
find_target_file_names::in(find_target_file_names),
+ find_timestamp_file_names::in(find_timestamp_file_names),
modules_to_recompile::out, read_modules::out,
io__state::di, io__state::uo) is det.
@@ -56,20 +65,22 @@
:- import_module set, std_util, string, term, term_io.
recompilation_check__should_recompile(ModuleName, FindTargetFiles,
- Info ^ modules_to_recompile, Info ^ read_modules) -->
+ FindTimestampFiles, Info ^ modules_to_recompile,
+ Info ^ read_modules) -->
{ Info0 = recompilation_check_info(ModuleName, no, [], map__init,
init_item_id_set(map__init, map__init, map__init),
set__init, some([])) },
recompilation_check__should_recompile_2(no, FindTargetFiles,
- ModuleName, Info0, Info).
+ FindTimestampFiles, ModuleName, Info0, Info).
:- pred recompilation_check__should_recompile_2(bool::in,
- find_target_file_names::in(find_target_file_names), module_name::in,
- recompilation_check_info::in, recompilation_check_info::out,
- io__state::di, io__state::uo) is det.
+ find_target_file_names::in(find_target_file_names),
+ find_timestamp_file_names::in(find_timestamp_file_names),
+ module_name::in, recompilation_check_info::in,
+ recompilation_check_info::out, io__state::di, io__state::uo) is det.
recompilation_check__should_recompile_2(IsSubModule, FindTargetFiles,
- ModuleName, Info0, Info) -->
+ FindTimestampFiles, ModuleName, Info0, Info) -->
{ Info1 = (Info0 ^ module_name := ModuleName)
^ sub_modules := [] },
module_name_to_file_name(ModuleName, ".used", no, UsageFileName),
@@ -90,6 +101,8 @@
Result),
(
{ Result = succeeded(Info4) },
+ FindTimestampFiles(ModuleName, TimestampFiles),
+ list__foldl(touch_file, TimestampFiles),
write_recompilation_message(
(pred(di, uo) is det -->
io__write_string("Not recompiling module "),
@@ -124,7 +137,7 @@
{ Info5 = Info4 ^ is_inline_sub_module := yes },
list__foldl2(
recompilation_check__should_recompile_2(yes,
- FindTargetFiles),
+ FindTargetFiles, FindTimestampFiles),
Info5 ^ sub_modules, Info5, Info)
)
;
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.257
diff -u -u -r1.257 user_guide.texi
--- doc/user_guide.texi 2001/06/27 05:04:36 1.257
+++ doc/user_guide.texi 2001/07/03 17:37:07
@@ -198,6 +198,19 @@
files associated with the module are used as date stamps;
they are used when deciding whether the interface files need to be regenerated.
+ at file{.c_date}, @file{.il_date}, @file{.s_date} and @file{.pic_s_date} files
+perform a similar function for @file{.c}, @file{.il}, @file{.s} and
+ at file{.pic_s} files respectively. When smart recompilation
+(@pxref{Auxiliary output options}) works out that a module
+does not need to be recompiled, the timestamp file for the
+target file is updated, and the timestamp of the target file
+is left unchanged.
+ at findex --smart-recompilation
+
+ at file{.used} files contain dependency information for smart recompilation
+(@pxref{Auxiliary output options}).
+ at findex --smart-recompilation
+
Files ending in @file{.d} are automatically-generated Makefile fragments
which contain the dependencies for a module.
Files ending in @file{.dep} are automatically-generated Makefile fragments
Index: scripts/Mmake.rules
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.rules,v
retrieving revision 1.96
diff -u -u -r1.96 Mmake.rules
--- scripts/Mmake.rules 2001/06/27 05:04:42 1.96
+++ scripts/Mmake.rules 2001/07/03 18:25:37
@@ -171,11 +171,20 @@
ifeq ($(TARGET_ASM),yes)
# `--target asm' back-end
-$(ss_subdir)%.s : %.m
+
+# When smart recompilation finds that a module does not need to be
+# recompiled, it only touches the `.s_date' or `.pic_s_date' file.
+$(ss_subdir)%.s : $(s_dates_subdir)%.s_date
+ @:
+
+$(ss_subdir)%.pic_s : $(s_dates_subdir)%.s_date
+ @:
+
+$(s_dates_subdir)%.s_date : %.m
$(MCG) $(ALL_GRADEFLAGS) --target-code-only $(ALL_MCGFLAGS) \
$< > $*.err 2>&1
-$(ss_subdir)%.pic_s : %.m
+$(pic_s_dates_subdir)%.pic_s_date : %.m
$(MCG) $(ALL_GRADEFLAGS) --target-code-only $(ALL_MCGFLAGS) \
--pic --cflags "$(GCCFLAGS_FOR_PIC)" $< > $*.err 2>&1
@@ -195,7 +204,13 @@
endif
# C back-end
-$(cs_subdir)%.c : %.m
+
+# When smart recompilation finds that a module does not need to be
+# recompiled, it only touches the `.c_date' file.
+$(cs_subdir)%.c : $(c_dates_subdir)%.c_date
+ @:
+
+$(cs_subdir)%.c_date : %.m
$(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) $< > $*.err 2>&1
# Aditi-RL back-end
@@ -203,7 +218,13 @@
$(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) --aditi-only $< > $*.err 2>&1
# .NET back-end
-$(ils_subdir)%.il : %.m
+
+# When smart recompilation finds that a module does not need to be
+# recompiled, it only touches the `.il_date' file.
+$(os_subdir)%.il : $(il_dates_subdir)%.il_date
+ @:
+
+$(il_dates_subdir)%.il_date : %.m
$(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) --il-only $< > $*.err 2>&1
# These rules are only available in *il* backends, because we'd like to avoid
Index: scripts/Mmake.vars.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.vars.in,v
retrieving revision 1.46
diff -u -u -r1.46 Mmake.vars.in
--- scripts/Mmake.vars.in 2001/06/18 05:58:15 1.46
+++ scripts/Mmake.vars.in 2001/07/03 09:49:19
@@ -425,6 +425,10 @@
rlos_subdir=$(SUBDIR)rlos/
ils_subdir=$(SUBDIR)ils/
dirs_subdir=$(SUBDIR)dirs/
+c_dates_subdir=$(SUBDIR)c_dates/
+s_dates_subdir=$(SUBDIR)s_dates/
+pic_s_dates_subdir=$(SUBDIR)pic_s_dates/
+il_dates_subdir=$(SUBDIR)il_dates/
else
@@ -451,6 +455,10 @@
rlos_subdir=
ils_subdir=
dirs_subdir=
+c_dates_subdir=
+s_dates_subdir=
+pic_s_dates_subdir=
+il_dates_subdir=
endif
Index: scripts/mercury_cleanup_install
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/mercury_cleanup_install,v
retrieving revision 1.2
diff -u -u -r1.2 mercury_cleanup_install
--- scripts/mercury_cleanup_install 2000/05/17 12:07:19 1.2
+++ scripts/mercury_cleanup_install 2001/07/03 09:46:23
@@ -67,6 +67,8 @@
[ -d Mercury/cs ] && mv -f tmp_dir/*.c Mercury/cs
[ -d Mercury/os ] && mv -f tmp_dir/*.o tmp_dir/*.pic_o Mercury/os
[ -d Mercury/deps ] && mv -f tmp_dir/*.dep Mercury/deps
+ [ -d Mercury/c_dates ] && mv -f tmp_dir/*.c_date Mercury/c_dates
+ [ -d Mercury/useds ] && mv -f tmp_dir/*.used Mercury/useds
mv -f tmp_dir/* .
rmdir tmp_dir
)
--------------------------------------------------------------------------
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