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/git_version.py > ./lalapps/src/lalapps/git_version.sed > > Why are these files remaining and how should I ensure they are removed > correctly after distclean? [...] > BUILT_SOURCES = \ > LALAppsVCSInfo.h \ > git_version.py \ > git_version.sed > > LALAppsVCSInfo.h: LALAppsVCSInfo.h.in git_version.sed > $(AM_V_GEN)sed -f git_version.sed $(srcdir)/LALAppsVCSInfo.h.in > > LALAppsVCSInfo.h > > git_version.py: git_version.py.in git_version.sed > $(AM_V_GEN)sed -f git_version.sed $(srcdir)/git_version.py.in > > git_version.py > > git_version.sed: $(srcdir)/generate_vcs_info.py > @$(PYTHON) $(srcdir)/generate_vcs_info.py LALApps $(srcdir) $$PWD
Probably all you need to do is add these generated files to CLEANFILES, e.g., CLEANFILES = git_version.py 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.py: git_version.py.in git_version.sed > $(AM_V_GEN)sed -f git_version.sed $(srcdir)/git_version.py.in > > git_version.py 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.py: git_version.py.in git_version.sed $(AM_V_GEN)sed -f git_version.sed $(srcdir)/git_version.py.in > $@.tmp $(AM_V_at)mv -f $@.tmp $@ which avoids updating the target file unless the first command succeeded. Hope that helps, -- Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)