[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: make: unlink: Operation not permitted - why?
From: |
Paul Smith |
Subject: |
Re: make: unlink: Operation not permitted - why? |
Date: |
Fri, 15 Feb 2013 13:35:59 -0500 |
On Fri, 2013-02-15 at 10:26 -0800, nollam wrote:
> Consider the following typescript:
>
> Script started on Fri Feb 15 14:21:53 2013
>
> $ ls
> makefile typescript
> $ cat makefile
> all: a.booklet
>
> %.booklet: %.common
> mkdir -p $@/a
>
> %.common:
> mkdir -p $@/b
> $ make
> mkdir -p a.common/b
> mkdir -p a.booklet/a
> rm a.commonmake: unlink: a.common: Operation not permitted
This is because a.common is considered an intermediate file; see:
http://www.gnu.org/software/make/manual/html_node/Chained-Rules.html
GNU make tries to delete intermediate files (by default). Unfortunately
it's not smart enough to realize that the file is really a directory.
You can fix this by forcing the directory to not be considered
intermediate, in various ways, such as mentioning it explicitly rather
than (or in addition to) having it implied as a pattern.
However, be aware that you will virtually never get the behavior you
want, using a directory as prerequisite. Make uses time-last-modified
to decide when to rebuild, and the update of a directory's TLM value
happens in ways that don't work well with make. Just don't do it.