I have several directories representing subparts of a project, each with its own Makefile.
I want to create a master Makefile with targets for each of those subparts, each target satisfying the following:
- depend on a certain target from that subproject's Makefile.
This is the tricky part. - copy some resulting library/executable build by the subproject into a central directory (kind of like "make install"-ing it).
This I can already achieve using simple commands.
I could only find information about the include
directive of GNU make, but that doesn't help me much as it seems not to encapsulate the rules (and execution) of the included makefile in its own directory, but instead just #include
s them C-style (rather that thinking of them as packages with separate scopes).
INSTALLDIR := build
SRCDIR := src
TARGETS := projA projB
.PHONY: $(TARGETS)
TARGETS_PATH := $(addprefix $(SRCDIR)/, $(TARGETS))
MAKEFILES := $(addsuffix /osx.mak, $(TARGETS_PATH))
# include them somehow?
For such a setup as defined above, I now want each of $(TARGETS)
to depend on the release
target of its corresponding Makefile (something like projA: $(SRCDIR)/projA/osx.mak @ release
for projA, in my own language meaning that target projA depends on the successful execution of the release
target in that specific Makefile).
Is there any way to achieve this?
You can suggest other tools apart from GNU make, but the subproject makefiles are already written as makefiles.