[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (yet another) Recursive make question
From: |
Johan Bezem |
Subject: |
Re: (yet another) Recursive make question |
Date: |
Mon, 06 Jun 2005 19:01:14 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) |
Hi,
Your last question first:
myself, I'm using a directory structure where the top-level directory is
defined by being the only directory in the development tree having a
subdirectory called 'make' containing a file called 'main.mk', the master
template makefile.
If the Variable YT_ROOTDIR is not defined (by the environment or within make),
a small shell script is run to determine this directory starting at the current
directory, and stripping one level at a time. This directory name is then
assigned to YT_ROOTDIR and exported, so that all subsequent recursive makes do
not need to scan again.
Now your first question: Having this YT_ROOTDIR variable available, converting
to relative paths is just replacing the part of all absolute paths matching
YT_ROOTDIR with '.' if you're starting there.
My mechanism restarts make once anyway: stepping from the source directory into
the (matching) tree where the intermediates are to be built, and there starts
at the (object-) 'root', skipping all subdirectories the user is not interested
in. See Paul's tips at his website. Building relative paths when recursing
through the tree that way is almost trivial.
If anyone is interested in more detail, let me know [responses to the list,
please]
Regards,
Johan Bezem
Darin Johnson wrote:
...
I'd like to use relative pathnames for include directoreis, so that the command
lines stay a manageable size (there may be over 100 include directories, at
least until I start figuring out which ones can be trimmed). Is there a nice
way
to either convert absolute paths to relative paths, or generate relative paths
on the fly when calling a sub-make?
Second, I'd like people to be able to type "make" from within a subdirectory
rather than having to be at the top level (which may be a few levels up).
Currently I've got a "build.mk" in each leaf directory and the "Makefile"s
are created by copying a template and updating the "TOP=..." line. It seems
to work, but it's just a bit ugly (at least it's automatic so that "make
makefiles"
isn't needed). Does anyone have a better method?
...
--
JB Enterprises - Johan Bezem Tel: +49 172 5463210
Software Architect - Project Manager Fax: +49 172 50 5463210
Realtime / Embedded Consultant Email: address@hidden
Design - Development - Test - QA Web: http://www.bezem.de