RIVET         := /usr/lib64/rivet0.5.0/cgi-bin/rivet.cgi

ACTION_LIST   := build tests
STATUS_LIST   := pass fail
PLATFORM_LIST := x86_64-linux x86_64-macos x86_64-freebsd arm-android

ICONS = $(shell for action in $(ACTION_LIST); do for status in $(STATUS_LIST); do for platform in $(PLATFORM_LIST); do echo "static/icon-$${action}-$${status}-$${platform}.svg"; done; done; done)

all: $(ICONS)

static/%.svg: $(RIVET) status-icons.rvt $(shell find os status action -type f -name '*.svg')
	@if ! test -d static; then mkdir static; fi
	QUERY_STRING='action=$(shell echo '$@' | cut -f 2 -d -)&status=$(shell echo '$@' | cut -f 3 -d -)&os=$(shell echo '$@' | cut -f 5 -d - | cut -f 1 -d .)' PATH_TRANSLATED='$(shell pwd)/status-icons.rvt' '$(RIVET)' ./status-icons.rvt | tail -n +5 > '$@'

static/%.png: static/%.svg
	echo TODO Add support for making '$@' from '$^'
	exit 1

clean:
	rm -rf static

distclean: clean

.PHONY: all clean distclean
