From duncan at research.bell-labs.com  Sun Mar 16 14:10:02 2003
From: duncan at research.bell-labs.com (Duncan Temple Lang)
Date: Sun Mar 16 20:10:24 2003
Subject: [Rd] R CMD SHLIB uses foo.c instead of foo.cc if both are present
	(PR#2644)
In-Reply-To: <200303161847.h2GIlvn9022829@pubhealth.ku.dk>;
	from faheem@email.unc.edu on Sun, Mar 16, 2003 at 07:47:57PM +0100
References: <200303161847.h2GIlvn9022829@pubhealth.ku.dk>
Message-ID: <20030316141002.A26681@jessie.research.bell-labs.com>

The "fix" is relatively simple. One can change the order of the
suffixes listed in $R_HOME/etc/Makeconf (i.e. the Makeconf.in version)
to alter the precedence. If one changes the line

 .SUFFIXES: .c .cc .cpp .C .d .f .lo .o

to place the '.c' after the '.cc', your example will work as you want it.

While the behavior is not desirable since you specified foo.cc on the
command line for R CMD SHLIB, I don't think it is a good idea to be
using files named x.c and x.cc in the same directory.  I would think
that this will lead to confusions with other tools and I can't think
of a context in which it is necessary.

 D.


faheem@email.unc.edu wrote:
> Full_Name: Faheem Mitha
> Version: 1.6.2
> OS: Debian GNU/Linux
> Submission from: (NULL) (209.42.199.193)
> 
> 
> Suppose you are making a shared library using
> 
> R CMD SHLIB foo.cc
> 
> If there is a file called foo.c in the same directory, then it will be used
> instead.
> 
> faheem ~/scratch/r-base>R CMD SHLIB foo.cc
> gcc-3.0 -I/usr/lib/R/include   -D__NO_MATH_INLINES -mieee-fp  -fPIC  -g -O2
> -c foo.c -o foo.o
> g++-3.0 -shared  -o foo.so foo.o   -L/usr/lib/R/bin -lR
> 
> This has been rather annoying for me, because I sometimes write C and C++
> versions of the same program side by side and so the files have the same
> name except for the extensions. It should be possible to fix it, though I
> don't understand the relevant scripts enough to suggest a patch.
> 
> Note this bug has also been reported by me as Debian bug #184969. You can access
> 
> this report via the web at
> http://bugs.debian.org/cgi-bin/bugreport.cgi?archive=no&bug=184969
> 
>                                                Faheem.
> 
> ______________________________________________
> R-devel@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel

-- 
_______________________________________________________________

Duncan Temple Lang                duncan@research.bell-labs.com
Bell Labs, Lucent Technologies    office: (908)582-3217
700 Mountain Avenue, Room 2C-259  fax:    (908)582-3340
Murray Hill, NJ  07974-2070       
         http://cm.bell-labs.com/stat/duncan


[Rd] R CMD SHLIB uses foo.c instead of foo.cc if both are present (PR#2644)
Duncan Temple Lang