[Rd] subdirs in package src dir

Albrecht Gebhardt albrecht.gebhardt@uni-klu.ac.at
Wed, 2 May 2001 22:16:50 +0200 (MET DST)


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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._