`call' function in `make'

N. Raghavendra raghu at mri.ernet.in
Wed May 26 05:28:25 PDT 2004


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 at mri.ernet.in> | See mail headers for contact
Harish-Chandra Research Institute   | and OpenPGP details.


More information about the freebsd-questions mailing list