Make: a hierarchical make file
(disclaimer: I'm used to Brazilians ... I'm somewhat inexperienced in making)
Context: I am using Eclipse CDT which generates makefiles.
Let's say I have a project directory 'lib' and 2 build configurations 'Debug' and 'Release'. Eclipse CDT gracefully creates a makefile for each build configuration. The mentioned makefile is in the Debug and Vacation folders.
Now I want to make a makefile in the lib folder that calls the makefiles 'Debug / makefile' and 'Release / makefile'.
How to do it?
I want to run "make" in the "lib" folder and both config will be called with the specified targets.
Solution Based on all the big inputs collected here, I worked out the following:
MAKE=make
BUILDS=Release Debug
TARGETS=all clean
$(TARGETS):
@for b in $(BUILDS) ; do $(MAKE) -C $$b $@ ; done
$(BUILDS):
@for t in $(TARGETS) ; do $(MAKE) -C $@ $$t ; done
%:
@for b in $(BUILDS) ; do $(MAKE) -C $$b $@ ; done
source to share
depends on what the "calls" are. Do you want either
include $(BUILD)/Makefile
or
$(MAKE) -C $(BUILD) $@
or some of them. I think you need the last one. Maybe something like
release debug:
$(MAKE) -C $@
You get the idea.
Other examples:
BUILDS=release debug
TARGETS=all clean
$(TARGETS):
for b in $(BUILDS) ; do $(MAKE) -C $$b $@ ; done
$(BUILDS):
for t in $(TARGETS) ; do $(MAKE) -C $@ $$t ; done
source to share