[Top][All Lists]

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

$(srcdir)/foo is not generated because $(srcdir)/$(srcdir)/foo exists

From: Peter Johansson
Subject: $(srcdir)/foo is not generated because $(srcdir)/$(srcdir)/foo exists
Date: Sat, 12 Feb 2011 15:56:41 -0500
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv: Gecko/20101207 Thunderbird/3.1.7


I got bitten by how VPATH builds work and wondered if there is a good way to avoid getting bitten again.

I have an Automake snippet (see below) that creates a file, `.revision', with current revision number and from this is a C header file `revision.h' created. Then to test that things work as I'd like I have target similar to distcheck that essentially does

svn export $(srcdir) _exported
cd _exported
mkdir _build
cd _build
make check

When doing that here I get the following error:

revision=$(cat ../.revision) \
&& sed "s|@SVN_REVISION@|$revision|g" < ../ \
> svn_revision.h-t && mv svn_revision.h-t svn_revision.h
cat: ../.revision: No such file or directory

and when I look into why there is no `../.revision' and I try

make `../.revision' I get
make: `../../.revision' is up to date.

That is make finds the file in my original working copy and not in my current structure. Is there a good way to avoid this to happen?


HAVE_SVN_WC is false in this case when building from an svn export.

--- ---

EXTRA_DIST = .revision
BUILT_SOURCES = $(srcdir)/.revision $(builddir)/svn_revision.h

$(srcdir)/.revision: YAT_SVN_REVISION_FORCE
    @$(SVNVERSION) $(srcdir) > address@hidden \
&& $(MOVE_IF_CHANGE) address@hidden $@
## this is needed in 'svn export' build
    echo "" > $@

$(builddir)/svn_revision.h: $(srcdir)/ $(srcdir)/.revision
    revision=$$(cat $(srcdir)/.revision) \
&& sed "s|@SVN_REVISION@|$$revision|g" < $(srcdir)/ \
> address@hidden && mv address@hidden $@


reply via email to

[Prev in Thread] Current Thread [Next in Thread]