SRCDIR:= img DSTDIR:= build SOURCES := $(wildcard $(SRCDIR)/*) FILES := $(patsubst $(SRCDIR)/%,$(DSTDIR)/%,$(SOURCES)) palette.out: palette.in node palette-gen.js < palette.in > palette.out builddir: @mkdir -p build build/%.jpg: builddir palette.out img/%.jpg repalette $@ build/$@ -p $(cat palette.out) --dither $(DITHER) build/%.png: builddir palette.out img/%.png repalette $@ build/$@ -p $(cat palette.out) --dither $(DITHER) all: $(FILES) @echo $(SOURCES) @echo $(FILES)