[Rd] R_SHARE_DIR not defined for use in tests/Makefile running under Windows

Tony Plate tplate at acm.org
Fri Apr 11 21:33:21 CEST 2008


Ok, thanks for the info.

The reason I'm asking about this is that I'm trying to eliminate reasons for having a Makefile.win to accompany a Makefile in the tests directory of a package.  I guess I can have <pkg>/tests/Makefile conditionally set R_SHARE_DIR to $(R_HOME)/share if it is undefined.  (aside: where can ${R_SHARE_DIR-${R_HOME}/share} be used? -- I couldn't get that syntax to do anything useful in gnu make v 3.79 from the R toolset for Windows.)

It still seem that src/gnuwin32/front-ends/rcmdfn.c:rcmdfn() is not completing the tasks spelled out in the comments at the top of the function:
>>     /* tasks:
>>        find R_HOME, set as env variable
>>        set R_SHARE_DIR as env variable

Further down in rcmdfn() there is the code:
	/* currently used by Rd2dvi and by perl Vars.pm (with default) */
	strcpy(RSHARE, "R_START_DIR=");
	strcat(RSHARE, RHome); strcat(RSHARE, "/share");
	putenv(RSHARE);

However, neither $R_HOME/src/scripts/Rd2dvi nor $R_HOME/share/perl/R/Vars.pm refer to the env var R_START_DIR, though they do use R_SHARE_DIR (and no other files in the entire R source tree apart from rcmdfn.c contain the string R_START_DIR, AFAICS).  So, is this just a simple typo of having R_START_DIR instead of R_SHARE_DIR in src/gnuwin32/front-ends/rcmdfn.c?

On the topic of make variables vs environment variables, don't variables in the environment become make variables?  This is what the gnu make documentation says: (http://www.gnu.org/software/make/manual/make.html#Environment)
6.9 Variables from the Environment
... Every environment variable that make sees when it starts up is transformed into a make variable with the same name and value...

So, is there any difference between $(X) and ${X} (parenthesis vs braces) in variable references in makefiles? I see in a different thread that Prof Brian Ripley states (in the context of makefiles) "$(MYVAR) is a make variable, and ${MYVAR} is an environment variable" ("Problem with Makefile.win and environment variable", 2008/03/21), but AFAICS, the gnu make documentation suggests these can be used interchangeably (http://www.gnu.org/software/make/manual/make.html#Reference).  And, is it ok to assume that the 'make' used for running tests will be a "gnu make", or is that a dangerous assumption (and the answer to my question above)?

-- Tony Plate



Prof Brian Ripley wrote:
> You seem to be confusing environment and make variables.  I think 
> '$(R_SHARE_DIR)' is never set by R makefiles (except when building R), 
> but may be set by make from an environment variable.
> 
> On all (recentish) systems where the share dir is not ${R_HOME}/share, 
> ${R_SHARE_DIR} is set by the 'R' shell script.  There are such systems 
> -- but not under Windows.
> 
> So ${R_SHARE_DIR-${R_HOME}/share} is the environment variable you want 
> to look at.
> 
> 
> On Mon, 7 Apr 2008, Tony Plate wrote:
> 
>> The make variable $(R_SHARE_DIR) seems to be available for use in
>> tests/Makefile when running under Linux, but not Windows (R-2.6.2, 
>> R-2.6.1,
>> R-2.7.0 alpha 2008-04-06, under Windows XP 64 bit, built locally for 
>> 32 bit).
>>
>> Is this intentional, or an oversight?  Is it OK to use $(R_HOME)/share
>> instead (seems to work OK)?
>>
>> I notice the following in /src/gnuwin32/front-ends/rcmdfn.c (from R-alpha
>> 2008-04-06), which would suggest that the intention was that R_SHARE_DIR
>> should be defined... (and I assume it would propagate to to be 
>> available in
>> a Makefile.)
>>
>> int rcmdfn (int cmdarg, int argc, char **argv)
>> {
>>     /* tasks:
>>        find R_HOME, set as env variable
>>        set R_SHARE_DIR as env variable
>>        set PATH to include R_HOME\bin
>>        set PERL5LIB to %R_SHARE_DIR%/perl;%Perl5LIB%
>>        set TEXINPUTS to %R_SHARE_DIR%/texmf;%TEXINPUTS%
>>        set HOME if unset
>>        launch %R_HOME%\bin\$*
>>      */
>>
>> -- Tony Plate
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>



More information about the R-devel mailing list