Skip to content

Problems with R CMD COMPILE within Makefile (PR#885)

1 message · Peter Holzer

#
Dear R-developpers

This concerns a problem I posted about half a year ago on the R-help list
and to which I got some answer by Duncan Temple Lang (see below), but the
basic problem still continues. Even though I managed a workaround which is
sufficient for me Martin Maechler asked me to send a toy example of the
problem to R-bugs. So that's what I try here.

The following Makefile will not work:
----------------------------------------
.PHONY: tst.o

tst.o: tst.c
	R CMD COMPILE tst.c
----------------------------------------

It results in:
----------------------------------------
cd /u/holzer/CurrentWork/algen/C/temp/
make 
R CMD COMPILE tst.c
make[1]: Entering directory `/users/u1/staff/holzer/CurrentWork/algen/C/temp'
R CMD COMPILE tst.c
make[2]: Entering directory `/users/u1/staff/holzer/CurrentWork/algen/C/temp'
make[2]: *** No rule to make target `w'.  Stop.
make[2]: Leaving directory `/users/u1/staff/holzer/CurrentWork/algen/C/temp'
make[1]: *** [tst.o] Error 2
make[1]: Leaving directory `/users/u1/staff/holzer/CurrentWork/algen/C/temp'
make: *** [tst.o] Error 2

Compilation exited abnormally with code 2 at Mon Mar 26 15:10:07
----------------------------------------

The following alternative ends in an infinite loop:
----------------------------------------
.PHONY: tst.o

tst.o: tst.c
	MAKEFLAGS="CFLAGS=" R CMD COMPILE tst.c
----------------------------------------

----------------------------------------
cd /u/holzer/CurrentWork/algen/C/temp/
make 
MAKEFLAGS="CFLAGS=" R CMD COMPILE tst.c
make[1]: Entering directory `/users/u1/staff/holzer/CurrentWork/algen/C/temp'
MAKEFLAGS="CFLAGS=" R CMD COMPILE tst.c
make[2]: Entering directory `/users/u1/staff/holzer/CurrentWork/algen/C/temp'
MAKEFLAGS="CFLAGS=" R CMD COMPILE tst.c
make[3]: Entering directory `/users/u1/staff/holzer/CurrentWork/algen/C/temp'
MAKEFLAGS="CFLAGS=" R CMD COMPILE tst.c
make[4]: Entering directory `/users/u1/staff/holzer/CurrentWork/algen/C/temp'
...
----------------------------------------


(My workaround consists in using R SHLIB instead of R COMPILE (which works
perfectly) and removing the files that disturb or that I don't need.)

I work under Linux. tst.c consists just of one line:

int  x() {return(1);}

platform i686-pc-linux-gnu
arch     i686             
os       linux-gnu        
system   i686, linux-gnu  
status                    
major    1                
minor    2.2              
year     2001             
month    02               
day      26               
language R                


Here is Duncan's answer:
Peter

____________________________________________________________

Peter Holzer                      phone: + 41 1 632 46 34
Seminar fuer Statistik, LEO C14   fax:   + 41 1 632 12 28
(Leonhardstr. 27)                  <holzer@stat.math.ethz.ch>
ETH (Federal Inst. Technology)
8092 Zurich                       http://stat.ethz.ch/~holzer/

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._