[Rd] Problem with Makefile.win and environment variable

Prof Brian Ripley
Fri, 21 Mar 2008 14:20:33 -0000

On Fri, 21 Mar 2008, cstrato wrote:

>
> Dear all,
>
> When porting my package to WinXP I have the following problem:
> I need to create an environment variable "MYVAR=c:\mypath" which
I have
> saved in the control panel "System->My Computer" (under the
`Advanced' tab).
>
> I have two files which need to access MYVAR: config.win, Makefile.win
>
> While "config.win" does recognize MYVAR correctly,
"Makefile.win" is not
> able to recognize MYVAR, when I do:
> "R CMD INSTALL mypkg".
> I need to add the line "MYVAR=C:\\mypath" to
"Makefile.win" for "R CMD
> INSTALL" to work.
>
> Interestingly, when I "cd ./src" and call from the DOS command
line:
> "NMAKE /f "Makefile.win" CFG="Release"
> then "Makefile.win" does recognize MYVAR correctly.
>
> Do you know what I need to do so that "Makefile.win" recognizes
MYVAR?

Well, how are you asking it to recognize it?  (We do expect you to provide
enough details to avoid such questions.)  $(MYVAR) is a make variable, and
${MYVAR} is an environment variable.  Quite possibly

MYVAR=${MYVAR}

is all you need to add.

BTW, there are dozens of examples in the packages on CRAN -- RGtk2 is one.
And we strongly discourage the use of Makefile.win: Makevars.win suffices
for all but expert developers.


--
Brian D. Ripley,                  ripley at 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