Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 May 2004 17:55:52 +0530
From:      "N. Raghavendra" <raghu@mri.ernet.in>
To:        Matthew Seaman <m.seaman@infracaninophile.co.uk>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: `call' function in `make'
Message-ID:  <16564.36048.491667.555279@riemann.mri.ernet.in>
In-Reply-To: <20040526114157.GE26430@happy-idiot-talk.infracaninophile.co.uk>
References:  <16563.20591.846129.789297@riemann.mri.ernet.in> <20040525144451.GA49822@happy-idiot-talk.infracaninophile.co.uk> <16564.15653.674179.246862@riemann.mri.ernet.in> <20040526114157.GE26430@happy-idiot-talk.infracaninophile.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
At 2004-05-26T12:41:57+01:00, Matthew Seaman wrote:

> On Wed, May 26, 2004 at 12:15:57PM +0530, N. Raghavendra wrote:
> >   ### Makefile
> >   
> >   ## Create directory FOO if it does not exist.
> >   create_dir = if test ! -d foo ; then  rm -f foo ; mkdir foo ; fi
> >   
> >   dir1: src1
> >   	$(create_dir:S/foo/$@/g)
> >   
> >   dir2: src2
> >   	$(create_dir:foo=$@)
> >   
> >   ### Makefile ends here
> 
> Is there something wrong with the first form of the rule that means
> you can't use it?

Hi Matthew,

Thanks for the help.

I would have liked to use the second substitution mechanism (foo=$@)
because it is part of the POSIX specification of `make'
(http://www.opengroup.org/onlinepubs/009695399/utilities/make.html),
whereas the first form (S/foo/$@/g) doesn't seem to be so.

> You have got a line:
> 
>     .PHONY: dir1 dir2
> 
> to force those rules to be applied even if dir1 or dir2 are newer than
> their sources?

Yes, I had tried that too, but it doesn't make the second rule work.
The second rule does work with `gmake'.

Cheers,
Raghavendra.

-- 
N. Raghavendra <raghu@mri.ernet.in> | See mail headers for contact
Harish-Chandra Research Institute   | and OpenPGP details.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?16564.36048.491667.555279>