# Makefile to drive tests.  You don't need this if you just want to
# use pyzipper yourself.

SRC := $(wildcard demo[0-9])
BIN := $(addsuffix .zip,${SRC})

all: ${BIN}

%.zip: pyzipper Makefile
	${PYTHON} ./pyzipper $(if $(PYTHON),-e $(PYTHON)) -o $@ $*
	./$@

clean:
	git clean -dfx

.PHONY: all clean

GIT_LS_TREE := $(shell git ls-tree --name-only -r HEAD)

define DEPENDENCIES
$(1).zip : $$(filter $(1)/%,$${GIT_LS_TREE})
endef

$(foreach S,${SRC},$(eval $(call DEPENDENCIES,$(S))))