Sometimes I find it useful to put C or Fortran sources under subdirs of
"mypackage/src", especially to distinguish between my own files and
e.g. lapack or blas sources. To get this working I would need a Makefile
in my package which contains the appropriate dependencies to these sources
in subdirs.
But I don't want to add a complete Makefile, I want only a Makevars file
containing e.g. "OBJS=myfunc.o lapack/somefunc.o ...", currently this
would not work, because nobody looks into Makevars for an OBJS
variable. The following patch adds this functionality to the INSTALL
script, allowing to add an OBJS (or SRCS) variable to Makeconf. I tested
it with R 1.2.1, 1.2.2. and 1.2.3 on Linux, FreeBSD, Tru64 and Solaris.
But of course it is only a suggestion.
(I hope the TABs in the Makefile snippets below are not mangled by my mail
program)
--- ./etc/Makefile.in.objs-patch Sat Dec 2 11:25:28 2000
+++ ./etc/Makefile.in Sat Mar 3 17:53:20 2001
@@ -10,7 +10,7 @@
include $(top_builddir)/Makeconf
-SOURCES = Makeconf.in Makeconf-tests.in Renviron.in
+SOURCES = Makeconf.in Makeconf-tests.in Renviron.in Makefrag.in
OBJECTS = $(SOURCES:.in=)
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
DISTFILES = \
--- ./etc/Makefrag.in.objs-patch Sat Mar 3 17:53:20 2001
+++ ./etc/Makefrag.in Sat Mar 3 17:53:20 2001
@@ -0,0 +1,5 @@
+echoobjs:
+ @echo $(OBJS)
+
+echosrcs:
+ @echo $(SRCS)
--- ./src/scripts/INSTALL.in.objs-patch Tue Feb 20 22:37:53 2001
+++ ./src/scripts/INSTALL.in Sat Mar 3 17:56:05 2001
@@ -243,7 +243,18 @@
cd ..
else
cd src;
- srcs=`ls *.[cfC] *.cc *.cpp 2>/dev/null`
+ srcs=""
+ objs=""
+ if [ -r Makevars ]; then
+ srcs=`make -s -f Makevars -f ${R_HOME}/etc/Makefrag echosrcs`
+ if [ -z "${srcs}" ]; then
+ objs=`make -s -f Makevars -f ${R_HOME}/etc/Makefrag echoobjs`
+ srcs=${objs}
+ fi
+ fi
+ if [ -z "${srcs}" ]; then
+ srcs=`ls *.[cfC] *.cc *.cpp 2>/dev/null`
+ fi
if test -n "${srcs}"; then
sh ${R_HOME}/bin/SHLIB -o ${pkg}.@SHLIB_EXT@ ${srcs} \
&& cp *.@SHLIB_EXT@ ${lib}/${pkg}/libs \
Albrecht
// Albrecht Gebhardt Tel.: (++43 463) 2700/3118
// Institut fuer Mathematik Fax : (++43 463) 2700/3198
// Universitaet Klagenfurt mailto:albrecht.gebhardt@uni-klu.ac.at
// Universitaetsstr. 65 http://www-stat.uni-klu.ac.at/~agebhard
// A-9020 Klagenfurt, Austria
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
subdirs in package src dir
5 messages · Albrecht Gebhardt, Brian Ripley
On Wed, 2 May 2001, Albrecht Gebhardt wrote:
Sometimes I find it useful to put C or Fortran sources under subdirs of "mypackage/src", especially to distinguish between my own files and e.g. lapack or blas sources. To get this working I would need a Makefile in my package which contains the appropriate dependencies to these sources in subdirs. But I don't want to add a complete Makefile, I want only a Makevars file containing e.g. "OBJS=myfunc.o lapack/somefunc.o ...", currently this would not work, because nobody looks into Makevars for an OBJS variable.
Err... that's not how I read the following section in SHLIB.in
makeobjs="OBJS=\"${objs}\""
if test -r Makevars; then
makefiles="-f Makevars ${makefiles}"
if grep '^ *OBJS *=' Makevars >/dev/null; then
makeobjs=
fi
fi
The intention seems to be that OBJS is looked for in Makevars, and if
it does not work for you it needs fixing in SHLIB, not INSTALL.
It *did* work for me when I tried it:
auk% cat foo/src/Makevars
OBJS=foo1.o
auk% Rdev INSTALL foo
Installing source package `foo' ...
libs
gcc -I/opt/R/R-devel/include -I/usr/local/include -fPIC -O2 -g -Wall
-pedantic -c foo1.c -o foo1.o
gcc -G -o foo.so foo1.o -L/usr/local/lib
...
auk% ls foo/src
Makevars foo.so* foo1.c foo1.o foo2.c
[...]
--- ./etc/Makefrag.in.objs-patch Sat Mar 3 17:53:20 2001 +++ ./etc/Makefrag.in Sat Mar 3 17:53:20 2001 @@ -0,0 +1,5 @@ +echoobjs: + @echo $(OBJS) + +echosrcs: + @echo $(SRCS)
There is no such file in the current R sources that I can find: are you working on the latest version?
Brian D. Ripley, ripley@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 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Thu, 3 May 2001, Prof Brian D Ripley wrote:
On Wed, 2 May 2001, Albrecht Gebhardt wrote:
...
The intention seems to be that OBJS is looked for in Makevars, and if it does not work for you it needs fixing in SHLIB, not INSTALL. It *did* work for me when I tried it: ...
ok, if it is working in R-devel I'm completely happy. I was working with 1.2.x, and it doesn't work there for me (at least until 1.2.2, I didn't try an unmodified 1.2.3)
[...]
--- ./etc/Makefrag.in.objs-patch Sat Mar 3 17:53:20 2001
... There is no such file in the current R sources that I can find: are you working on the latest version?
see above. Makefrag was only part of my workaround for 1.2.x. I will check it once more, also with R-devel and come back with the results later. Thanks, Albrecht // Albrecht Gebhardt Tel.: (++43 463) 2700/3118 // Institut fuer Mathematik Fax : (++43 463) 2700/3198 // Universitaet Klagenfurt mailto:albrecht.gebhardt@uni-klu.ac.at // Universitaetsstr. 65 http://www-stat.uni-klu.ac.at/~agebhard // A-9020 Klagenfurt, Austria -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Thu, 3 May 2001, Albrecht Gebhardt wrote:
On Thu, 3 May 2001, Prof Brian D Ripley wrote:
On Wed, 2 May 2001, Albrecht Gebhardt wrote:
...
The intention seems to be that OBJS is looked for in Makevars, and if it does not work for you it needs fixing in SHLIB, not INSTALL. It *did* work for me when I tried it: ...
ok, if it is working in R-devel I'm completely happy. I was working with 1.2.x, and it doesn't work there for me (at least until 1.2.2, I didn't try an unmodified 1.2.3)
It worked for me in 1.2.3 as well as R-devel, and also specifying files in a subdirectory. I don't have any earlier versions up at present, but I can't see any recent changes on this.
Brian D. Ripley, ripley@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 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Thu, 3 May 2001, Prof Brian Ripley wrote:
On Thu, 3 May 2001, Albrecht Gebhardt wrote: ...
ok, if it is working in R-devel I'm completely happy. I was working with 1.2.x, and it doesn't work there for me (at least until 1.2.2, I didn't try an unmodified 1.2.3)
It worked for me in 1.2.3 as well as R-devel, and also specifying files in a subdirectory. I don't have any earlier versions up at present, but I can't see any recent changes on this.
Ok I found it, I had "SRCS=myfunc.c subdir/myfunc.f" in my Makevars file, now it works using OBJS=... (I thought I did use OBJS but I did not recognize that I used a SRCS variable instead, sorry) Albrecht // Albrecht Gebhardt Tel.: (++43 463) 2700/3118 // Institut fuer Mathematik Fax : (++43 463) 2700/3198 // Universitaet Klagenfurt mailto:albrecht.gebhardt@uni-klu.ac.at // Universitaetsstr. 65 http://www-stat.uni-klu.ac.at/~agebhard // A-9020 Klagenfurt, Austria -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._