out := _out
export GNUTERM = svg font "Liberation Sans" background "white"

changelogs := $(patsubst %.changelog, $(out)/%.changelog, $(wildcard *.changelog))
svg := $(patsubst %.gp, $(out)/%.svg, $(wildcard *.gp))

all:  $(svg)

archive: ../debian-cve.tar.xz
../debian-cve.tar.xz:
	git archive HEAD -o $(basename $@)
	xz $(basename $@)

$(out)/%.text.svg: %.gp $(changelogs)
	gnuplot < $< > $@

$(out)/%.svg: $(out)/%.text.svg
	inkscape -lT $< -o $@

$(out)/%.changelog: %.changelog
	$(mkdir)
	./cve-extractor.rb < $< | awk '{cve[$$1]++}; END{ for(k in cve) { print k, cve[k]} }' | sort > $@

mkdir = @mkdir -p $(dir $@)
