From 12836aa7306ab4385124d4a268fd1d4d50aae7cb Mon Sep 17 00:00:00 2001 From: Wolf Date: Wed, 26 Oct 2016 16:01:28 +0200 Subject: [PATCH] Makefile * clean didnt work for me, TARGET with "ALL" did not list files for `rm` - fixes #1 for me * added error reporting in case interpreter or script is missing * enabled adding new scripts for other interpreters later, e.g. python implementation of generator; so users do not need to install ruby --- Makefile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 9887b2f..12d09d0 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,18 @@ -TARGETS=$(patsubst dates/%.yaml, dates/%/ALL, $(wildcard dates/*.yaml)) -ALL: ${TARGETS} +GENERATOR='./generate.rb' + +MAKE_TARGETS=$(patsubst dates/%.yaml, dates/%/ALL, $(wildcard dates/*.yaml)) +CLEAN_TARGETS=$(patsubst dates/%.yaml, dates/%/*, $(wildcard dates/*.yaml)) +ALL: ${MAKE_TARGETS} clean: - rm -rf ${TARGETS} + rm -rf ${CLEAN_TARGETS} # Keep Makefiles -.SECONDARY: $(patsubst dates/%/ALL, dates/%/Makefile, $(TARGETS)) +.SECONDARY: $(patsubst dates/%/ALL, dates/%/Makefile, $(MAKE_TARGETS)) dates/%/Makefile: dates/%.yaml $(wildcard decks/*.yaml) mkdir -p $(shell dirname $@) - ./generate.rb $< $(shell dirname $@) + $(GENERATOR) $< $(shell dirname $@) || printf "\033[1;31minterpreter or script missing\033[0m\n" dates/%/ALL: dates/%/Makefile $(MAKE) -C $(shell dirname $@)