Dear all,
I am trying to design a nice way for a Makefile to include
sub-makefiles.
For the moment I have written code like this:
define INCLUDE
curdir := $(1)
include $(1)/Makefile
unset curdir
endef
# List of subdirectories containing a Makefile that should be included
subdirectories :
On Tue, 2017-03-21 at 13:18 +0100, Sébastien Hinderer wrote:
> define INCLUDE
> curdir := $(1)
> include $(1)/Makefile
> unset curdir
> endef
>
> # List of subdirectories containing a Makefile that should be included
>
> subdirectories := foo bar baz
>
> # Include all the specified sub-mak
Dear Paul,
Many thanks for your so prompt and helpful response!
Paul Smith (2017/03/21 08:31 -0400):
> On Tue, 2017-03-21 at 13:18 +0100, Sébastien Hinderer wrote:
> > define INCLUDE
> > curdir := $(1)
> > include $(1)/Makefile
> > unset curdir
(That should have been undefine, by the way)
Let me just throw in a couple of tangential points:
1. I see no reason to specify or derive the current directory; make
provides it as $(CURDIR) and this is guaranteed to be a correct absolute
path (unless you deliberately assign to it) since make has no way of
changing its own current directory.
Dear David,
Many thanks for your comments. Being a beginner in designing good build
systems I am very interested in every answer, especially the answers to
the questions I don't even think to ask because I don't realise
there is something to learn there.
David Boyce (2017/03/21 07:14 -0700):
> Le