For Programmers: Free Programming Magazines  


Home > Archive > Fortran > February 2007 > make file question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author make file question
allelopath

2007-02-16, 7:06 pm

off-topic, sorry. but this group knows makefiles well.
To specifiy an include file, I do this:

INCLUDEFILE = ${CURRENT_PATH}/${INCLUDE_DIR}/myfile1.inc

But I don't know how to specify more than one.This is not the answer:
INCLUDEFILE = ${CURRENT_PATH}/${INCLUDE_DIR}/myfile1.inc
INCLUDEFILE = ${CURRENT_PATH}/${INCLUDE_DIR}/myfile2.inc
because it just redefines INCLUDEFILE, instead of appending.
How is this done?

Thanks!

Paul van Delst

2007-02-16, 7:06 pm

allelopath wrote:
> off-topic, sorry. but this group knows makefiles well.
> To specifiy an include file, I do this:
>
> INCLUDEFILE = ${CURRENT_PATH}/${INCLUDE_DIR}/myfile1.inc
>
> But I don't know how to specify more than one.This is not the answer:
> INCLUDEFILE = ${CURRENT_PATH}/${INCLUDE_DIR}/myfile1.inc
> INCLUDEFILE = ${CURRENT_PATH}/${INCLUDE_DIR}/myfile2.inc
> because it just redefines INCLUDEFILE, instead of appending.
> How is this done?


One way,

INCLUDE_DIRROOT=${CURRENT_PATH}/${INCLUDE_DIR}
INCLUDE_FILES=$(INCLUDE_DIRROOT)/myfile1.inc \
$(INCLUDE_DIRROOT)/myfile2.inc \
$(INCLUDE_DIRROOT)/myfile3.inc \
....etc....
$(INCLUDE_DIRROOT)/myfileN.inc

cheers,

paulv

--
Paul van Delst Ride lots.
CIMSS @ NOAA/NCEP/EMC Eddy Merckx
Erik Edelmann

2007-02-18, 7:04 pm

On 2007-02-16, allelopath <jdaues@gmail.com> wrote:
> off-topic, sorry. but this group knows makefiles well.
> To specifiy an include file, I do this:
>
> INCLUDEFILE = ${CURRENT_PATH}/${INCLUDE_DIR}/myfile1.inc
>
> But I don't know how to specify more than one.This is not the answer:
> INCLUDEFILE = ${CURRENT_PATH}/${INCLUDE_DIR}/myfile1.inc
> INCLUDEFILE = ${CURRENT_PATH}/${INCLUDE_DIR}/myfile2.inc
> because it just redefines INCLUDEFILE, instead of appending.
> How is this done?


INCLUDEFILE = ${CURRENT_PATH}/${INCLUDE_DIR}/myfile1.inc
INCLUDEFILE += ${CURRENT_PATH}/${INCLUDE_DIR}/myfile2.inc

('+=' instead of '=' on the second line.)

Works in GNU Make. I have to admit that I don't remember for sure if this
is portable or a GNU specific feature, but I think it ought to work
everywhere.


Erik
Ron Shepard

2007-02-18, 7:04 pm

In article <7dZBh.166$gX3.35@read3.inet.fi>,
Erik Edelmann <foo@bar.öh> wrote:

> Works in GNU Make. I have to admit that I don't remember for sure if this
> is portable or a GNU specific feature, but I think it ought to work
> everywhere.


I'm pretty sure += is specific to GNU make. To be portable beyond
that, you should define separate macros (some of which may be empty)
for the different pieces, and then put them all together into the
single macro which is actually used. These are macros, not
variables, so you should avoid self references and the order of
definition does not matter.

If you only use GNU make, then portability may not be important and
you might justify using some of its nonportable features for
convenience. It is the same kind of tradeoff we have with all
languages.

$.02 -Ron Shepard
Steven G. Kargl

2007-02-18, 7:04 pm

In article <ron-shepard-147981.11235018022007@comcast.dca.giganews.com>,
Ron Shepard <ron-shepard@NOSPAM.comcast.net> writes:
> In article <7dZBh.166$gX3.35@read3.inet.fi>,
> Erik Edelmann <foo@bar.öh> wrote:
>
>
> I'm pretty sure += is specific to GNU make.


Its not. make on FreeBSD (sometimes called bmake)
has had += for years.

--
Steve
http://troutmask.apl.washington.edu/~kargl/
Ron Shepard

2007-02-19, 4:04 am

In article <era56c$2ns$1@gnus01.u.washington.edu>,
kargl@troutmask.apl.washington.edu (Steven G. Kargl) wrote:

> In article <ron-shepard-147981.11235018022007@comcast.dca.giganews.com>,
> Ron Shepard <ron-shepard@NOSPAM.comcast.net> writes:
>
> Its not. make on FreeBSD (sometimes called bmake)
> has had += for years.


I should have said simply that I don't think += is part of POSIX
make or consistent with most traditional make utilities.

$.02 -Ron Shepard
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com