[m-rev.] for review: IL backend: improve mmake support

Peter Ross peter.ross at miscrit.be
Tue Jul 17 18:55:49 AEST 2001


On Tue, Jul 17, 2001 at 02:31:48AM +1000, Fergus Henderson wrote:
> On 16-Jul-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> > Improve the mmake support for the IL backend.
> 
> That looks good, thanks.
> This things that you've fixed had been bugging me.
> 
> There's just one problem:
> 
> > Index: compiler/modules.m
> ...
> > @@ -3269,13 +3275,18 @@
> >  
> >  	module_name_to_file_name(SourceModuleName, "", no, ExeFileName),
> >  	io__write_strings(DepStream, [
> > +		"ifeq ($(findstring il,$(GRADE)),il)\n",
> > +		ExeFileName, " : ", ExeFileName, ".exe ",
> > +			"$(", MakeVarName, ".dlls)\n",
> > +		"else\n",
> >  		ExeFileName, " : $(", MakeVarName, ".cs_or_ss) ",
> >  			"$(", MakeVarName, ".os) ",
> >  			InitObjFileName, " $(MLOBJS) ", All_MLLibsDepString,
> >  			"\n",
> >  		"\t$(ML) $(ALL_GRADEFLAGS) $(ALL_MLFLAGS) -o ",
> >  			ExeFileName, " ", InitObjFileName, " \\\n",
> > -		"\t	$(", MakeVarName, ".os) $(MLOBJS) $(ALL_MLLIBS)\n\n"
> > +		"\t	$(", MakeVarName, ".os) $(MLOBJS) $(ALL_MLLIBS)\n",
> > +		"endif\n\n"
> 
> The `.dep' Makefile fragment generated there uses GNU Make extensions,
> which will break --no-assume-gmake.
> 
> Possible solutions:
> 
> 	(a) test for `Target = il' in compiler/modules.m,
> 	    rather than inserting the test in the generated .dep file.
> 
> 	(b) do as you currently do, unless --no-assume-gmake is passed,
> 	    in which case do (a)
> 
> 	(c) drop support for the --no-assume-gmake option.
> 
> My preference is for (a) or (b).
> 

diff -u compiler/modules.m compiler/modules.m
--- compiler/modules.m
+++ compiler/modules.m
@@ -3274,20 +3274,32 @@
 	%
 
 	module_name_to_file_name(SourceModuleName, "", no, ExeFileName),
-	io__write_strings(DepStream, [
-		"ifeq ($(findstring il,$(GRADE)),il)\n",
-		ExeFileName, " : ", ExeFileName, ".exe ",
-			"$(", MakeVarName, ".dlls)\n",
-		"else\n",
-		ExeFileName, " : $(", MakeVarName, ".cs_or_ss) ",
+
+	{ If = ["ifeq ($(findstring il,$(GRADE)),il)\n"] },
+	{ ILMainRule = [ExeFileName, " : ", ExeFileName, ".exe ",
+			"$(", MakeVarName, ".dlls)\n"] },
+	{ Else = ["else\n"] },
+	{ MainRule =
+		[ExeFileName, " : $(", MakeVarName, ".cs_or_ss) ",
 			"$(", MakeVarName, ".os) ",
 			InitObjFileName, " $(MLOBJS) ", All_MLLibsDepString,
 			"\n",
 		"\t$(ML) $(ALL_GRADEFLAGS) $(ALL_MLFLAGS) -o ",
 			ExeFileName, " ", InitObjFileName, " \\\n",
-		"\t	$(", MakeVarName, ".os) $(MLOBJS) $(ALL_MLLIBS)\n",
-		"endif\n\n"
-	]),
+		"\t	$(", MakeVarName, ".os) $(MLOBJS) $(ALL_MLLIBS)\n"] },
+	{ EndIf = ["endif\n"] },
+
+	globals__io_get_target(Target),
+	{ Gmake = yes,
+		Rules = If ++ ILMainRule ++ Else ++ MainRule ++ EndIf
+	; Gmake = no,
+		( Target = il ->
+			Rules = ILMainRule
+		;
+			Rules = MainRule
+		)
+	},
+	io__write_strings(DepStream, Rules),
 
 	module_name_to_file_name(SourceModuleName, ".split", yes,
 				SplitExeFileName),
@@ -3419,7 +3431,6 @@
 	module_name_to_lib_file_name("lib", ModuleName, ".install_hdrs", no,
 				LibInstallHdrsTargetName),
 	globals__io_lookup_bool_option(highlevel_code, HighLevelCode),
-	globals__io_get_target(Target),
 	( { HighLevelCode = yes, ( Target = c ; Target = asm ) } ->
 		%
 		% XXX  Note that we install the header files in two places:
--------------------------------------------------------------------------
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