Browse Source

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
pull/3/head
Wolf 6 years ago committed by Jörg Thalheim
parent
commit
8b5c8dabf0
  1. 15
      Makefile

15
Makefile

@ -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 $@)

Loading…
Cancel
Save