Why are .PHONY implicit pattern rules not triggered?

You’re right, it would make more sense to define the subdir rules as PHONY. But Make does not consider implicit rules for PHONY targets, so you’ll have to rewrite that rule. I suggest the following:

SUBDIR_TARGETS = all.subdir clean.subdir
.PHONY: all clean $(SUBDIR_TARGETS) 

$(SUBDIR_TARGETS): %.subdir:
    $(MAKE) -C src $*
    $(MAKE) -C dict $*

all: all.subdir
clean: clean.subdir

Leave a Comment