> make[3]: Leaving directory `/home/tibbs/fvwm/doc'
> cp ./index.html index.html
> cp: `./index.html' and `index.html' are the same file
> make[2]: *** [index.html] Error 1

I need some help. I can't work out how to get make to do what I want.

I want to support both in-tree & out-of-tree builds.

In my case, for an in-tree build nothing needs to be done. For an
out-of-tree build, a file has to be copied to the build directory.

I used to use this:

all:
        @for f in $(doc_DATA) ; do \
                [ ! -f $$f ] && cp -p $(srcdir)/$$f $$f; \
        done ; true

This had the desired effect except (in out-of-tree builds) make wouldn't
update the out-of-tree file(s) whenever the source file changed. So I
changed it to this (doc_DATA is just a bunch of .html files, by the way):

all: $(doc_DATA)

%.html: $(srcdir)/$@
        @ cp $(srcdir)/$@ $@

This works perfectly on my system, but (as the failed snapshot build
last night indicates) it's obviously not portable.

Any pointers would be muchly appreciated.

Scott.

Reply via email to