[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: inheriting makefiles
From: |
Mike Maxwell |
Subject: |
Re: inheriting makefiles |
Date: |
Tue, 24 Sep 2002 09:27:45 -0400 |
Johan Bezem wrote:
<snip>
Thanks for the ideas--I eventually decided on the following construct, which
appears at the beginning of each of my makefiles (except the topmost one,
where the recursion stops):
#Get defns from parent makefile:
ifdef THIS_DIR
THIS_DIR:=$(THIS_DIR)/..
else
THIS_DIR:=$(CURDIR)
endif
include $(THIS_DIR)/../makefile
I also include the ff. at the very beginning of a file, as in many .h files:
ifndef FOO_MAKEFILE
FOO_MAKEFILE = Languages/Spanish/Foo/makefile
(plus an 'endif' at the end of file)
--where the var name is of course different for each makefile. The value to
which this var is set is unimportant, although I use the directory
structure. (But nothing will break if I change my directory structure,
because I don't rely on the value of the var, only the fact that the var has
a value.)
It seems to me unfortunate that all this has to be manually coded; it would
seem like an inheritance hierarchy would (should) be a natural way to
organize makefiles, and perhaps a direction for future enhancement. It
would presumably require some notion of 'self', where self = the path +
filename of each makefile.
--
Mike Maxwell
Linguistic Data Consortium
maxwell@ldc.upenn.edu