Makefile question...
Matt Graham
danceswithcrows at usa.net
Tue Oct 27 10:42:24 MST 2009
From: "kitepilot at kitepilot.com"
> I have a C++ application scattered over several directories.
> Each leaf directory has its own Makefile. I want to write a
> top-level Makefile that traverses the tree and builds the
> application.
> Makefile(s) are not one of my talents, and I can't remember how
> to traverse the tree and fire up the nested Makefile(s).
From the apache Makefile, made a tad less verbose:
SUBDIRS = srclib os server modules support
all:
list=' $(SUBDIRS) '; \
for i in $$list; do \
if test -d "$$i"; then \
echo "Making all in $$i"; \
(cd $$i && $(MAKE) ) || exit 1; \
fi; \
done;
if test -z '$(TARGETS)'; then \
made_local=yes; \
fi; \
if test "$$made_local" != "yes"; then \
$(MAKE) "finish-this-build"; \
fi
...this should be reasonably obvious. There's another dependency
that you'll have to fill in, here called finish-this-build, that
does all the rest of it (linking, whatever.)
--
Matt G / Dances With Crows
The Crow202 Blog: http://crow202.org/wordpress/
There is no Darkness in Eternity/But only Light too dim for us to see
More information about the PLUG-discuss
mailing list