From ripley at stats.ox.ac.uk  Wed Mar 23 22:59:00 2005
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed Mar 23 22:59:12 2005
Subject: [Rd] forcing R CMD COMPILE
In-Reply-To: <Pine.LNX.4.58L0.0503231621450.8500@est.ufpr.br>
References: <Pine.LNX.4.58L0.0503230041170.31558@est.ufpr.br>
	<Pine.LNX.4.61.0503230744450.29643@gannet.stats>
	<Pine.LNX.4.58L0.0503231341420.32487@est.ufpr.br>
	<Pine.LNX.4.61.0503231703450.30989@gannet.stats>
	<Pine.LNX.4.58L0.0503231621450.8500@est.ufpr.br>
Message-ID: <Pine.LNX.4.61.0503232156010.1947@gannet.stats>

On Wed, 23 Mar 2005, Pedro Ribeiro de Andrade Neto wrote:

> Let me tell an example.
>
> I found the bayesSurv package in CRAN. It has some .cpp and .h files, and
> doesn't have a makefile. I did the following steps:
>
> 1. compile the package (R CMD INSTALL)
> 2. write something in /src/List.cpp (only add an empty line)
> 3. recompile package (INSTALL)
>   it works, OK.
> 4. write something in /src/List.h
> 5. recompile
>   it does nothing. List.cpp was not changed and so R says List.o is up
>   to date, right?
>
> Is there any way to tell R that List.o depends on List.h???
>
> I think it is not an R problem, because Makefiles can check it. My
> question is: I know that List.o is not up to dated, because I changed
> List.h, and my Makefile recognizes it. But if I tell R to compile List.cpp
> again using COMPILE, it will say that the file is up to date, and won't
> compile it. So, the only way to check dependencies, as I can see, is using a
> Makefile, and compiling .cpp files without any R help. Is it true?

As I said before, COMPILE is not the correct tool.  Please don't expect me 
to keep repeating myself.

BTW, R CMD INSTALL under Windows does build dependencies, and you have not 
specified your platform here.

> On Wed, 23 Mar 2005, Prof Brian Ripley wrote:
>
>> On Wed, 23 Mar 2005, Pedro Ribeiro de Andrade Neto wrote:
>>
>>>
>>> On Wed, 23 Mar 2005, Prof Brian Ripley wrote:
>>>
>>>> On Wed, 23 Mar 2005, Pedro Ribeiro de Andrade Neto wrote:
>>>>
>>>>> I am developing a package with a lot of C++ code, and I have a question
>>>>> about R CMD COMPILE. As I can see, when the package's Makefile calls
>>>>>
>>>>> R CMD COMPILE foo.cpp
>>>>
>>>> Why does your package have a Makefile?  And why is it calling COMPILE and
>>>> not SHLIB?
>>>>
>>>
>>> My package has a Makefile because I need to compile 16 .cpp files. After
>>> it, I call R CMD SHLIB.
>>
>> R CMD SHLIB would do that for you.  Many packages using multiple .cpp
>> files have no Makefile.  Please study the many examples on CRAN.
>>
>> --
>> Brian D. Ripley,                  ripley@stats.ox.ac.uk
>> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
>> University of Oxford,             Tel:  +44 1865 272861 (self)
>> 1 South Parks Road,                     +44 1865 272866 (PA)
>> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>>
>>
>
>

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


[Rd] forcing R CMD COMPILE
Prof Brian Ripley