[Mono-dev] Referring to libraries on the command line

Jonathan Pryor jonpryor at vt.edu
Wed Jul 14 10:37:12 EDT 2010

On Wed, 2010-07-14 at 07:16 +0100, Russell Wallace wrote:
> I'm trying to compile a program with gmcs, which wants references to
> all libraries in the current directory. Normally one would specify
> this with *.dll, but because gmcs wants a prefix of -r: in each case,
> this breaks. Is there any way to obtain this effect, e.g. some way to
> expand a wild card and then prepend a prefix to each expanded name?
> (Ubuntu Linux, make under bash, if it matters.)

make(1) has Substitution References (§6.3.1 in the `info make` page),
which allows:

        REFS = Foo.dll Bar.dll Baz.dll
        SOURCES = yourapp.cs
        yourapp.exe : $(SOURCES) $(REFS)
        	gmcs -out:$@ $(REFS:%=-r:%) $(SOURCES)

Here, we're using $(REFS:%=-r:%) to prefix every token within $(REFS)
with `-r:`, thus resulting in `-r:Foo.dll -r:Bar.dll -r:Baz.dll`.

 - Jon

More information about the Mono-devel-list mailing list