From simon.urbanek at r-project.org  Thu Dec 20 23:11:23 2007
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Thu, 20 Dec 2007 17:11:23 -0500
Subject: [Rd] SHLIB steps on a Makefile
In-Reply-To: <dba1e14b0712201349t552a9409mb96b1007b3b6a483@mail.gmail.com>
References: <dba1e14b0712201349t552a9409mb96b1007b3b6a483@mail.gmail.com>
Message-ID: <44D02A38-CAC5-4A74-8D71-2D7EFFB286B7@r-project.org>

Iago,

On Dec 20, 2007, at 4:49 PM, Iago Mosqueira wrote:

> I need to create a Makefile.win for a given package so as to fiddle  
> slightly with the compilation process. My Makefile works fine in  
> Linux but I am having trouble creating Makefile.win for MinGW. I  
> first looked at the commands that Rcmd SHLIB appeared to be running  
> and copied those onto the Makefile. But one step seems to be  
> missing, the creation of the _res.rc file needed by windres
>
> 	g++-sjlj -I$(RHOME)/include -I../inst/include/ -O2 -Wall -c pkg.cpp  
> -o pkg.o
> 	windres --preprocessor="gcc-sjlj -E -xc -DRC_INVOKED"
> -I$(RHOME)/include -I../inst/include -i pkg_res.rc -o pkg_res.o
> 	g++-sjlj -shared -s -o pkg.dll pkg.def pkg.o FL pkg_res.o -L$ 
> (RHOME)/bin -lR
>
> This might be fairly obvious, but it is my first attempt at  
> compiling with MinGW and my search has been fruitless.
>
> What is it that I need to add to replicate what Rcmd SHLIB does?
>

If that is the only step you're missing then you have probably missed  
the res.rc rule from MakeDll when creating your Makefile:

$(DLLNAME)_res.rc:
         @PERL5LIB=$(RHOME)/share/perl $(PERL) $(RHOME)/src/gnuwin32/ 
makeDllRes.pl $(DLLNAME) > $@

Cheers,
Simon

PS: Given that you can override any rule, it is usually easier to just  
write your modifications in Makevars[.win] when fiddling with the  
compilation than to replicate the whole process.



[Rd] SHLIB steps on a Makefile
Simon Urbanek