Makefile: check if ruby is installed

* 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
This commit is contained in:
Wolf 2016-10-28 16:40:04 +02:00 committed by Jörg Thalheim
parent 169e8795f8
commit 8b5c8dabf0
1 changed files with 10 additions and 5 deletions

View File

@ -1,15 +1,20 @@
TARGETS=$(patsubst dates/%.yaml, dates/%/ALL, $(wildcard dates/*.yaml))
ALL: ${TARGETS}
INTERPRETER := ruby
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 $@)
command -v $(INTERPRETER) || (printf "Could not find '%s' Please install or add it to PATH!\n" $(INTERPRETER); exit 1)
$(INTERPRETER) $(GENERATOR) $< $(shell dirname $@)
dates/%/ALL: dates/%/Makefile
$(MAKE) -C $(shell dirname $@)