[m-rev.] diff: add extra Mmake rule for executables on Windows
Simon Taylor
stayl at cs.mu.OZ.AU
Wed Jan 29 01:53:15 AEDT 2003
Estimated hours taken: 0.5
Branches: main
If $(EXT_FOR_EXE) is not empty, add a phony target
`main_module' which depends on `main_module'$(EXT_FOR_EXE)
With this change, the command used to build an executable
is consistent across platforms.
compiler/make.m:
Assume that a target on the command line which doesn't match
any other file type is an executable, even if $(EXT_FOR_EXE)
is not empty.
compiler/modules.m:
Add the rule.
scripts/Mmake.vars.in:
Add the name of each of the $(MERCURY_MAIN_MODULES) to
the list of targets which should be made by `mmc --make'
if mmake was invoked wih `--use-mmc-make'.
Index: compiler/make.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make.m,v
retrieving revision 1.14
diff -u -u -r1.14 make.m
--- compiler/make.m 20 Dec 2002 09:46:18 -0000 1.14
+++ compiler/make.m 28 Jan 2003 02:50:05 -0000
@@ -264,18 +264,8 @@
%
% Classify the remaining targets.
%
- { list__filter_map(classify_target(Globals), NonDependTargets,
- ClassifiedTargets, InvalidTargets) },
-
- %
- % Report errors for unknown targets.
- %
- list__foldl(
- (pred(InvalidTarget::in, di, uo) is det -->
- io__write_string("** Unknown target: "),
- io__write_string(InvalidTarget),
- io__write_string(".\n")
- ), InvalidTargets),
+ { list__map(classify_target(Globals), NonDependTargets,
+ ClassifiedTargets) },
{ ShouldRebuildDeps = yes },
{ MakeInfo0 = make_info(map__init, map__init,
@@ -289,8 +279,7 @@
% Build the targets, stopping on any errors if
% `--keep-going' was not set.
%
- ( { InvalidTargets = [] ; KeepGoing = yes } ->
- foldl2_maybe_stop_at_error(KeepGoing,
+ foldl2_maybe_stop_at_error(KeepGoing,
(pred(Target::in, Success0::out, Info0::in, Info::out,
di, uo) is det -->
{ Target = ModuleName - TargetType },
@@ -309,12 +298,9 @@
make_misc_target(ModuleName - MiscTargetType,
Success0, Info0, Info)
)
- ), ClassifiedTargets, Success, MakeInfo0, _MakeInfo)
- ;
- { Success = no }
- ),
+ ), ClassifiedTargets, Success, MakeInfo0, _MakeInfo),
- ( { InvalidTargets \= [] ; Success = no } ->
+ ( { Success = no } ->
io__set_exit_status(1)
;
[]
@@ -330,7 +316,7 @@
.
:- pred classify_target(globals::in, string::in,
- pair(module_name, target_type)::out) is semidet.
+ pair(module_name, target_type)::out) is det.
classify_target(Globals, FileName, ModuleName - TargetType) :-
(
@@ -413,12 +399,8 @@
TargetType = misc_target(build_library),
file_name_to_module_name(ModuleNameStr, ModuleName)
;
- globals__lookup_string_option(Globals, executable_file_extension, "")
- ->
TargetType = linked_target(executable),
file_name_to_module_name(FileName, ModuleName)
- ;
- fail
).
:- pred search_backwards_for_dot(string::in, int::in, int::out) is semidet.
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.261
diff -u -u -r1.261 modules.m
--- compiler/modules.m 23 Jan 2003 04:25:46 -0000 1.261
+++ compiler/modules.m 24 Jan 2003 11:01:55 -0000
@@ -4231,13 +4231,22 @@
ExeFileName, ".exe : ", "$(", MakeVarName, ".dlls) ",
"$(", MakeVarName, ".foreign_dlls)\n"] },
{ Else = ["else\n"] },
+
+ io__write_strings(DepStream, [
+ "ifneq ($(EXT_FOR_EXE),)\n",
+ ".PHONY ", ExeFileName, "\n",
+ ExeFileName, " : ", ExeFileName, "$(EXT_FOR_EXE)\n",
+ "endif\n"
+ ]),
+
{ MainRule =
- [ExeFileName, " : $(", MakeVarName, ".cs_or_ss) ",
+ [ExeFileName, "$(EXT_FOR_EXE) : $(", MakeVarName, ".cs_or_ss) ",
"$(", MakeVarName, ".os) ",
InitObjFileName, " ", All_MLObjsString, " ",
All_MLLibsDepString, "\n",
"\t$(ML) $(ALL_GRADEFLAGS) $(ALL_MLFLAGS) -- $(ALL_LDFLAGS) ",
- "-o ", ExeFileName, " ", InitObjFileName, " \\\n",
+ "-o ", ExeFileName, "$(EXT_FOR_EXE) ",
+ InitObjFileName, " \\\n",
"\t $(", MakeVarName, ".os) ", All_MLObjsString,
" $(ALL_MLLIBS)\n"]
},
Index: scripts/Mmake.vars.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.vars.in,v
retrieving revision 1.86
diff -u -u -r1.86 Mmake.vars.in
--- scripts/Mmake.vars.in 24 Jan 2003 07:17:12 -0000 1.86
+++ scripts/Mmake.vars.in 24 Jan 2003 10:56:01 -0000
@@ -74,7 +74,8 @@
# Files which should be built using `mmc --make' rather than `make'
# when `--use-mmc-make' is passed on the mmake command line.
#
-ALL_MC_BUILD_FILES = $(MERCURY_MAIN_MODULES:%=%$(EXT_FOR_EXE)) \
+ALL_MC_BUILD_FILES = $(MERCURY_MAIN_MODULES) \
+ $(MERCURY_MAIN_MODULES:%=%$(EXT_FOR_EXE)) \
$(MERCURY_MAIN_MODULES:%=lib%.$A) \
$(MERCURY_MAIN_MODULES:%=lib%.so) \
$(MERCURY_MAIN_MODULES:%=%.clean) \
--------------------------------------------------------------------------
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