Alternative for wildcard gnu extension in Makevars

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Alternative for wildcard gnu extension in Makevars

Jan van der LAan-2

I have some cpp-files from another library (boost) in a subdirectory  
in my src directory (src/boost_src). I include these using the  
following two lines in my Makevars:

SOURCES = $(wildcard *.cpp boost_src/*.cpp)
OBJECTS = $(SOURCES:.cpp=.o)

However, R CMD check complains about my use of 'wildcard'. How do I  
handle this without any gnu extensions?

Thanks.
Jan

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Alternative for wildcard gnu extension in Makevars

Dirk Eddelbuettel

On 13 May 2015 at 17:27, Jan van der Laan wrote:
|
| I have some cpp-files from another library (boost) in a subdirectory  
| in my src directory (src/boost_src). I include these using the  
| following two lines in my Makevars:
|
| SOURCES = $(wildcard *.cpp boost_src/*.cpp)
| OBJECTS = $(SOURCES:.cpp=.o)
|
| However, R CMD check complains about my use of 'wildcard'. How do I  
| handle this without any gnu extensions?

I looked into this a few weeks (months?) ago, and it would appear that you
cannot.

I would recommend the alternative offered in Writing R Extensions: renamed it
GNUmakefile or add a SystemRequirements: GNU make.

Dirk

--
http://dirk.eddelbuettel.com | @eddelbuettel | [hidden email]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Alternative for wildcard gnu extension in Makevars

Jan van der LAan-2

Dirk Eddelbuettel <[hidden email]> schreef:

> On 13 May 2015 at 17:27, Jan van der Laan wrote:
> |
> | I have some cpp-files from another library (boost) in a subdirectory
> | in my src directory (src/boost_src). I include these using the
> | following two lines in my Makevars:
> |
> | SOURCES = $(wildcard *.cpp boost_src/*.cpp)
> | OBJECTS = $(SOURCES:.cpp=.o)
> |
> | However, R CMD check complains about my use of 'wildcard'. How do I
> | handle this without any gnu extensions?
>
> I looked into this a few weeks (months?) ago, and it would appear that you
> cannot.
>
> I would recommend the alternative offered in Writing R Extensions: renamed it
> GNUmakefile or add a SystemRequirements: GNU make.

Too bad. Since it is only a handful of files, I will probably move  
them directly into the src directory and prefix them. It would have  
been nice to have been able to keep them separate.

Thanks!
Jan

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Alternative for wildcard gnu extension in Makevars

Gábor Csárdi
On Wed, May 13, 2015 at 12:05 PM, Jan van der Laan <[hidden email]>
wrote:
[...]

> Too bad. Since it is only a handful of files, I will probably move them
> directly into the src directory and prefix them. It would have been nice to
> have been able to keep them separate.
>

If it is a couple of files, then you can also just list them in SOURCES (or
even just OBJECTS, with a .o suffix), and leave them where they are.

Gabor

[...]

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Alternative for wildcard gnu extension in Makevars

Kevin Ushey
One other solution that's only a little crazy: you could have a R
function within your package that generates the appropriate (portable)
Makevars, and within the package `configure` script call that
function. For example"

    R --vanilla --slave -e "source('R/makevars.R'); makevars()"

And that 'makevars()' function could generate portable
'Makevars(.win)' files for your package.

Kevin

On Wed, May 13, 2015 at 9:08 AM, Gábor Csárdi <[hidden email]> wrote:

> On Wed, May 13, 2015 at 12:05 PM, Jan van der Laan <[hidden email]>
> wrote:
> [...]
>
>> Too bad. Since it is only a handful of files, I will probably move them
>> directly into the src directory and prefix them. It would have been nice to
>> have been able to keep them separate.
>>
>
> If it is a couple of files, then you can also just list them in SOURCES (or
> even just OBJECTS, with a .o suffix), and leave them where they are.
>
> Gabor
>
> [...]
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Alternative for wildcard gnu extension in Makevars

Dirk Eddelbuettel

On 13 May 2015 at 10:10, Kevin Ushey wrote:
| One other solution that's only a little crazy: you could have a R
| function within your package that generates the appropriate (portable)
| Makevars, and within the package `configure` script call that
| function. For example"
|
|     R --vanilla --slave -e "source('R/makevars.R'); makevars()"
|
| And that 'makevars()' function could generate portable
| 'Makevars(.win)' files for your package.

Seconded.  I do exactly that in another recent package where I needed another
"verboten" idiom available only in the widespread and feature-rich GNU make
but not the so-much-more constrained basic make: if statements.

See https://github.com/eddelbuettel/Rblpapi/blob/master/configure where I
need to encode 32 or 64 in the name of shared library.  By relying on Rscript
I code around the constraint of not having GNU make.   [ That is still a
non-CRAN package but for an unrelated, different reason. ]

Dirk

--
http://dirk.eddelbuettel.com | @eddelbuettel | [hidden email]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Alternative for wildcard gnu extension in Makevars

Jan van der LAan-2
In reply to this post by Gábor Csárdi


On 13-05-15 18:08, Gábor Csárdi wrote:

> On Wed, May 13, 2015 at 12:05 PM, Jan van der Laan <[hidden email]
> <mailto:[hidden email]>> wrote:
> [...]
>
>     Too bad. Since it is only a handful of files, I will probably move
>     them directly into the src directory and prefix them. It would have
>     been nice to have been able to keep them separate.
>
>
> If it is a couple of files, then you can also just list them in SOURCES
> (or even just OBJECTS, with a .o suffix), and leave them where they are.
>


That would be a nice solution, but it is a couple (~10) files in the
src/boost_src directory. Directly under the src directory there are much
more files, and the names and number of these will frequently change so
I don't want to keep maintaining this list. Although I could add the
generation of Makevars to my build script.

Thanks for the suggestion.

Jan

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Alternative for wildcard gnu extension in Makevars

Henrik Bengtsson-4
In reply to this post by Kevin Ushey
While at it:  'Makevars' is an R invention (i.e. documentation of it
is only available through the R docs), correct?  /Henrik

On Wed, May 13, 2015 at 10:10 AM, Kevin Ushey <[hidden email]> wrote:

> One other solution that's only a little crazy: you could have a R
> function within your package that generates the appropriate (portable)
> Makevars, and within the package `configure` script call that
> function. For example"
>
>     R --vanilla --slave -e "source('R/makevars.R'); makevars()"
>
> And that 'makevars()' function could generate portable
> 'Makevars(.win)' files for your package.
>
> Kevin
>
> On Wed, May 13, 2015 at 9:08 AM, Gábor Csárdi <[hidden email]> wrote:
>> On Wed, May 13, 2015 at 12:05 PM, Jan van der Laan <[hidden email]>
>> wrote:
>> [...]
>>
>>> Too bad. Since it is only a handful of files, I will probably move them
>>> directly into the src directory and prefix them. It would have been nice to
>>> have been able to keep them separate.
>>>
>>
>> If it is a couple of files, then you can also just list them in SOURCES (or
>> even just OBJECTS, with a .o suffix), and leave them where they are.
>>
>> Gabor
>>
>> [...]
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Alternative for wildcard gnu extension in Makevars

Simon Urbanek
On May 13, 2015, at 2:28 PM, Henrik Bengtsson <[hidden email]> wrote:

> While at it:  'Makevars' is an R invention (i.e. documentation of it
> is only available through the R docs), correct?  /Henrik
>

Well, it's just a Makefile fragment that gets included along with the rest of the Makefiles, so for all practical purposes it's just a Makefile which implicitly includes R's makefile on top so you don't have to do that by hand.

Cheers,
Simon



> On Wed, May 13, 2015 at 10:10 AM, Kevin Ushey <[hidden email]> wrote:
>> One other solution that's only a little crazy: you could have a R
>> function within your package that generates the appropriate (portable)
>> Makevars, and within the package `configure` script call that
>> function. For example"
>>
>>    R --vanilla --slave -e "source('R/makevars.R'); makevars()"
>>
>> And that 'makevars()' function could generate portable
>> 'Makevars(.win)' files for your package.
>>
>> Kevin
>>
>> On Wed, May 13, 2015 at 9:08 AM, Gábor Csárdi <[hidden email]> wrote:
>>> On Wed, May 13, 2015 at 12:05 PM, Jan van der Laan <[hidden email]>
>>> wrote:
>>> [...]
>>>
>>>> Too bad. Since it is only a handful of files, I will probably move them
>>>> directly into the src directory and prefix them. It would have been nice to
>>>> have been able to keep them separate.
>>>>
>>>
>>> If it is a couple of files, then you can also just list them in SOURCES (or
>>> even just OBJECTS, with a .o suffix), and leave them where they are.
>>>
>>> Gabor
>>>
>>> [...]
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> [hidden email] mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Alternative for wildcard gnu extension in Makevars

Henrik Bengtsson-4
On Fri, May 15, 2015 at 8:01 AM, Simon Urbanek
<[hidden email]> wrote:
> On May 13, 2015, at 2:28 PM, Henrik Bengtsson <[hidden email]> wrote:
>
>> While at it:  'Makevars' is an R invention (i.e. documentation of it
>> is only available through the R docs), correct?  /Henrik
>>
>
> Well, it's just a Makefile fragment that gets included along with the rest of the Makefiles, so for all practical purposes it's just a Makefile which implicitly includes R's makefile on top so you don't have to do that by hand.

Thanks for confirming.

/Henrik

>
> Cheers,
> Simon
>
>
>
>> On Wed, May 13, 2015 at 10:10 AM, Kevin Ushey <[hidden email]> wrote:
>>> One other solution that's only a little crazy: you could have a R
>>> function within your package that generates the appropriate (portable)
>>> Makevars, and within the package `configure` script call that
>>> function. For example"
>>>
>>>    R --vanilla --slave -e "source('R/makevars.R'); makevars()"
>>>
>>> And that 'makevars()' function could generate portable
>>> 'Makevars(.win)' files for your package.
>>>
>>> Kevin
>>>
>>> On Wed, May 13, 2015 at 9:08 AM, Gábor Csárdi <[hidden email]> wrote:
>>>> On Wed, May 13, 2015 at 12:05 PM, Jan van der Laan <[hidden email]>
>>>> wrote:
>>>> [...]
>>>>
>>>>> Too bad. Since it is only a handful of files, I will probably move them
>>>>> directly into the src directory and prefix them. It would have been nice to
>>>>> have been able to keep them separate.
>>>>>
>>>>
>>>> If it is a couple of files, then you can also just list them in SOURCES (or
>>>> even just OBJECTS, with a .o suffix), and leave them where they are.
>>>>
>>>> Gabor
>>>>
>>>> [...]
>>>>
>>>>        [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> [hidden email] mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>
>>> ______________________________________________
>>> [hidden email] mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Alternative for wildcard gnu extension in Makevars

Jan van der LAan-2
In reply to this post by Dirk Eddelbuettel


On 13-05-15 19:45, Dirk Eddelbuettel wrote:

> On 13 May 2015 at 10:10, Kevin Ushey wrote:
> | One other solution that's only a little crazy: you could have a R
> | function within your package that generates the appropriate (portable)
> | Makevars, and within the package `configure` script call that
> | function. For example"
> |
> |     R --vanilla --slave -e "source('R/makevars.R'); makevars()"
> |
> | And that 'makevars()' function could generate portable
> | 'Makevars(.win)' files for your package.
>
> Seconded.  I do exactly that in another recent package where I needed another
> "verboten" idiom available only in the widespread and feature-rich GNU make
> but not the so-much-more constrained basic make: if statements.
>
> See https://github.com/eddelbuettel/Rblpapi/blob/master/configure where I
> need to encode 32 or 64 in the name of shared library.  By relying on Rscript
> I code around the constraint of not having GNU make.   [ That is still a
> non-CRAN package but for an unrelated, different reason. ]
>

Kevin, Dirk,

I finally opted for this solution. Thanks!

Jan

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel