tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: make: creating a file's parent directory



On Thu, Jul 16, 2015 at 08:13:20PM +0200, Edgar Fu? wrote:
> BM> I'm pretty sure that mkdir -p doesn't touch the directory if it already 
> BM> exists.  Thus, you should be able to use rules like
> BM> 
> BM> dir:
> BM> 	mkdir -p ${.TARGET}
> BM> 
> BM> dir/file: dir
> BM> 	do_stuff
> 
> That has the problem of
> EF> but that causes dir/file's rule to be re-run if you touch dir/another_file, 
> EF> thus updating dir's time stamp.
> right?

I just use:
dir/file:
	@ mkdir -p $(@D)
	do_stuff


	David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index