[Top][All Lists]

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

Re: files left in build directory after distclean

From: Nick Bowler
Subject: Re: files left in build directory after distclean
Date: Tue, 22 May 2012 13:06:51 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

Hello Adam,

On 2012-05-22 11:10 -0500, Adam Mercer wrote:
> Hi
> For one of my projects I'm running into an error where distcheck fails
> with the error:
> ERROR: files left in build directory after distclean:
> ./lalapps/src/lalapps/
> ./lalapps/src/lalapps/git_version.sed
> Why are these files remaining and how should I ensure they are removed
> correctly after distclean?
>       LALAppsVCSInfo.h \
> \
>       git_version.sed
> LALAppsVCSInfo.h: git_version.sed
>       $(AM_V_GEN)sed -f git_version.sed $(srcdir)/ >
> LALAppsVCSInfo.h
> git_version.sed
>       $(AM_V_GEN)sed -f git_version.sed $(srcdir)/ > 
> git_version.sed: $(srcdir)/
>       @$(PYTHON) $(srcdir)/ LALApps $(srcdir) $$PWD

Probably all you need to do is add these generated files to CLEANFILES,

  CLEANFILES = git_version.sed

so that "make clean" deletes them.

One unrelated comment.  Makefile rules like what you have above, one of
which is reproduced here:

> git_version.sed
>       $(AM_V_GEN)sed -f git_version.sed $(srcdir)/ > 

can be problematic because it creates the target file before running the
command to update it.  If the command fails for any reason, you will be
left with the target in your tree, and a subsequent "make" will not
attempt to recreate it (and will nevertheless proceed to use the bogus
file).  This is especially bad if "make clean" doesn't delete the file,
which distcheck is helpfully warning you about.  Therefore, such rules
are generally better written using a pattern similar to the following
(untested): git_version.sed
        $(AM_V_GEN)sed -f git_version.sed $(srcdir)/ > 
        $(AM_V_at)mv -f address@hidden $@

which avoids updating the target file unless the first command succeeded.

Hope that helps,
Nick Bowler, Elliptic Technologies (

reply via email to

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