[ET Trac] [Einstein Toolkit] #1522: Improve determining make dependencies
Einstein Toolkit
trac-noreply at einsteintoolkit.org
Thu Jan 16 08:19:37 CST 2014
#1522: Improve determining make dependencies
-------------------------+--------------------------------------------------
Reporter: eschnett | Owner:
Type: enhancement | Status: new
Priority: major | Milestone:
Component: Cactus | Version: development version
Keywords: |
-------------------------+--------------------------------------------------
Cactus automatically determines the dependencies between source files and
their include files. This mechanism doesn't quite work in all cases; e.g.
when a source file (or header file?) is removed, the build aborts, and the
auto-generated dependencies have to be deleted automatically.
I have recently come across a mechanism that works reliably. Here is the
relevant Makefile fragment, applied to building C++ files:
{{{
# Taken from <http://mad-scientist.net/make/autodep.html> as written
# by Paul D. Smith <psmith at gnu.org>, originally developed by Tom
# Tromey <tromey at cygnus.com>
PROCESS_DEPENDENCIES = \
sed -e 's/$@.tmp/$@/g' < $*.o.d > $*.d && \
sed -e 's/\#.*//' \
-e 's/^[^:]*: *//' \
-e 's/ *\\$$//' \
-e '/^$$/ d' \
-e 's/$$/ :/' < $*.o.d >> $*.d && \
rm -f $*.o.d
%.o: %.cc
${CXX} -MD ${CPPFLAGS} ${CXXFLAGS} -o $@.tmp -c $*.cc
@${PROCESS_DEPENDENCIES}
@mv $@.tmp $@
-include ${DEPS}
}}}
--
Ticket URL: <https://trac.einsteintoolkit.org/ticket/1522>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit
More information about the Trac
mailing list