diff --git a/Makefile b/Makefile index 59e56b8..f07a95d 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,15 @@ -TARGETS=$(patsubst dates/%.yaml, dates/%, $(wildcard dates/*.yaml)) +TARGETS=$(patsubst dates/%.yaml, dates/%/ALL, $(wildcard dates/*.yaml)) ALL: ${TARGETS} clean: rm -rf ${TARGETS} -dates/%: - mkdir -p $@ - ./generate.rb $@.yaml $@ - $(MAKE) -C $@ +# Keep Makefiles +.SECONDARY: $(patsubst dates/%/ALL, dates/%/Makefile, $(TARGETS)) + +dates/%/Makefile: dates/%.yaml $(wildcard decks/*.yaml) + mkdir -p $(shell dirname $@) + ./generate.rb $< $(shell dirname $@) + +dates/%/ALL: dates/%/Makefile + $(MAKE) -C $(shell dirname $@) $(shell basename $@)