.h files

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
21 Jan 1998 21:47:50 +0100


Paul Gilbert <pgilbert@bank-banque-canada.ca> writes:

> 
> PG>> gcc -g -fpic -I/home/res8/gilp/R-versions/R-0.61.1/include  -c  putpadi.c
> PG>> putpadi.c:29: padi.h: No such file or directory
> PG>> putpadi.c:34: padiutil.h: No such file or directory
> 
> PD>Hum. If line 29 really reads #include "padi.h" (not <padi.h>) and
> PD>padi.h really is in the same directory as putpadi.c, then I don't
> PD>understand a word of it...
> 
> Well, it is <padi.h> and not "padi.h" and changing this fixes this problem in
> the sense that I copied the .h files to the local directory and with "" it no
> longer matters if I append to -I.
> 
> However, the .h files really should not be in the local directory as they are
> used by other programs and it is important that they all stay in sync, so I
> really would prefer to append to CFLAGS. 

There's always #include "../include/padi.h", etc. ...

When I use CFLAGS += -I. in my Makefile
> it is ignored, unless I edit R/etc/INSTALL  and change to CFLAGS+= thus:
> 
> (cd ${src}; make CC="gcc" CFLAGS+="-g -fpic -I${RHOME}/include"
> 
> But then the "-g -fpic -I${RHOME}/include" is ignored and only my setting is
> used! This does not make sense to me and I would certainly appreciate any
> suggestions.

You don't want to mess with etc/INSTALL anyway since it's different
between platforms and gets autogenerated by configure. You're right,
an explicit CFLAGS on the make command line overrides any assignment
inside the makefile. To wit:

$ cat Makefile
CFLAGS+=-I.
$ make x.o
cc -I.   -c x.c -o x.o
$ rm x.o
$ make x.o CFLAGS=-Ibip
cc -Ibip   -c x.c -o x.o

However, using += isn't any different here:

$ rm x.o
$ make x.o CFLAGS+=-Ibip
cc -Ibip   -c x.c -o x.o

Curiously, the override does not apply if one sets CFLAG as an
environment variable

$ rm x.o
$ CFLAGS=-Ibip make x.o             
cc -Ibip -I.   -c x.c -o x.o

I suppose we could just fix etc/INSTALL.in to use that technique.
Anyone have objections? On the other hand explicit relative paths in
#include "..." might be good enough already.
 
-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907

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