# The question is whether %.intermediate2 should be marked as # an intermediate target automatically without adding it as a # prerequisite of .INTERMEDIATE. # # Since %.intermediate1 is marked as intermediate and since # pattern rules with multiple targets are defined as generating # all targets after execution, I believe that %.intermediate2 # should receive the same treatment as %.intermediate1 and be # marked as intermediate. # # To see the basic behavior, simply run make with this file # named as "Makefile". # # Run 'make set-intermediate=t' to see the behavior I expect # to see by default: both %.intermediate1 and %.intermediate2 # are deleted by make. name := test all: $(name).final %.final: %.intermediate1 %.intermediate2 cat $^ > $@ $(if $(set-intermediate),$(eval .INTERMEDIATE: $(name).intermediate2)) %.intermediate1 %.intermediate2: %.source head $< > $*.intermediate1 tail $< > $*.intermediate2 %.source: Makefile cp $< $@ .PHONY: clean clean: rm -f $(name).*