Reputation: 1618
Hey, I have a simple "master" Makefile who simply calls other makefiles. I'm trying to do the following in order to build components in the right order:
LIB_A = folder_a
LIB_B = folder_b
LIB_C = folder_c
MY_TARGETS = $(LIB_A) $(LIB_B) $(LIB_C)
.PHONY: $(LIB_A)
$(LIB_A):
@$(MAKE) -C $@;
.PHONY: $(LIB_B)
$(LIB_B):
@$(MAKE) -C $@;
.PHONY: $(LIB_C)
$(LIB_C): $(LIB_A) $(LIB_B)
@$(MAKE) -C $@;
.PHONY: all
all: $(MY_TARGETS)
However, when I make, only LIB_A gets built.
(I don't even get a folder_b up-to-date message or whatever).
Any hint ?
Upvotes: 7
Views: 8765
Reputation:
You need to make all
the default. You can do this in either of these ways:
.DEFAULT_GOAL := all
Alternatively, you could run make all
instead of just make
.
Upvotes: 8
Reputation: 99172
Neil Butterworth solved the problem, but you can also make this makefile a little more concise:
LIB_A = folder_a
LIB_B = folder_b
LIB_C = folder_c
MY_TARGETS = $(LIB_A) $(LIB_B) $(LIB_C)
.PHONY: all $(MY_TARGETS)
all: $(MY_TARGETS)
$(MY_TARGETS):
@$(MAKE) -C $@;
$(LIB_C): $(LIB_A) $(LIB_B)
Upvotes: 8