[m-dev.] Requesting feedback on modifying dependency files for GRADE=il make

Eric Taucher gluon at earthlink.net
Tue Aug 7 05:54:53 AEST 2007


> -----Original Message-----
> From: owner-mercury-developers at csse.unimelb.edu.au [mailto:owner-mercury-
> developers at csse.unimelb.edu.au] On Behalf Of Petr Ross
> Sent: Thursday, August 02, 2007 7:23 PM
> To: mercury-developers at csse.unimelb.edu.au
> Subject: Re: [m-dev.] Requesting feedback on modifying dependency files for
> GRADE=il make
> 
> On 7/30/07, Eric Taucher <gluon at earthlink.net> wrote:
> > To simplify creating mercury.dll for GRADE=il, removing the intermediate
> > targets from the .d files, when GRADE=il, seems to be advantageous. Doing so
> > allows the process to go directly from Mercury source files to Intermediate
> > Language and C# code, and then into mercury.dll as one file.
> >
> >
> >
> > While I am aware that the .d files were created to allow compilation to
> > succeed with C source, the Microsoft compilers are capable of generating
> > code without the need for the dependencies. This may also apply to Java, but
> > I haven't tested it yet.
> >
> >
> >
> > Since this is such a major departure from the normal process, are there any
> > things I might be breaking by these changes?
> >
> >
> Can you sketch in more detail what your changes would be.
> 
> Say I have the files a.m b.m and c.m what would be the build process?

Here is the main part of a Makefile that makes mercury.dll as a Microsoft .NET
version 2.0 DLL. I tested it today based on code from rotd-2007-08-01. 

To create mercury.dll just "make library".

# Note: change_meta.sh changes the metadata of il files.
# This script is for demonstration purposes only.
# The compiler needs to be modified to emit the new metadata in the il file.

library_dlls := $(patsubst %.m,%.dll,$(wildcard *.m))
library_csharp_pragma_dlls := $(patsubst %.m,%__csharp_code.dll,$(wildcard *.m))

# *.d and *.il_date are deleted to show that they are not used.
# No problems exist if they remain.

%.dll: %.m
	mmc --grade il --il-only --allow-stubs --no-warn-stubs $<
	rm $*.d
	rm $*.il_date
	../scripts/change_meta.sh $* ../metadata/library_metadata.il DLL
	ilasm /dll /quiet /OUT=$@ $*.il

mercury_dotnet.dll: 
	cp ../runtime/mercury_dotnet.cs .
	csc  /out:mercury_dotnet.dll /target:library mercury_dotnet.cs

mercury_il.dll: 
	cp ../runtime/mercury_il.il .
	../scripts/change_meta.sh mercury_il ../metadata/runtime_metadata.il DLL
	ilasm /dll /quiet /OUT=mercury_il.dll mercury_il.il

reference1.dll: $(library_dlls) mercury_il.dll mercury_dotnet.dll
	rm -rf illinktempdir
	illink /out:reference1.dll $^

%__csharp_code.dll: %__csharp_code.cs reference1.dll 
	csc /out:$@ /reference:reference1.dll /target:library $<

mercury.dll: $(library_dlls) $(library_csharp_pragma_dlls) mercury_il.dll
mercury_dotnet.dll 
	rm -rf illinktempdir
	illink /out:mercury.dll $^

library: mercury.dll

This file did not use any of the *.d files created by Mercury to build the
library. To confirm that *.d are not needed, the files are deliberately deleted
just after they are created by the compiler. I would have disabled them with the
compiler, but didn't see an option to do so.


> --------------------------------------------------------------------------
> mercury-developers mailing list
> Post messages to:       mercury-developers at csse.unimelb.edu.au
> Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
> Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
> --------------------------------------------------------------------------

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list