automake
[Top][All Lists]
Advanced

[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:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7

Hello;

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
./bootstrap
mkdir _build
cd _build
../configure
make
make check

When doing that here I get the following error:

revision=$(cat ../.revision) \
&& sed "s|@SVN_REVISION@|$revision|g" < ../svn_revision.h.in \
> 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?

Thanks,
Peter

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

--- Makefile.am ---

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

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

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

---8<------------




reply via email to

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