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) > $@-t \
&& $(MOVE_IF_CHANGE) $@-t $@
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 \
> $@-t && mv $@-t $@

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


Reply via email to