FONTARTS := $(sort \ $(patsubst %.otf,%,\ $(patsubst %.woff,%,\ $(patsubst %.woff2,%,\ $(wildcard *.woff2 *.woff *.otf)\ )))) OTFS := $(patsubst %,%.otf,$(FONTARTS)) WOFFS := $(patsubst %,%.woff,$(FONTARTS)) WOFF2S := $(patsubst %,%.woff2,$(FONTARTS)) FONTS := $(OTFS) $(WOFFS) $(WOFF2S) CACHES := $(patsubst %,%.fc,$(FONTS)) all: fonts caches .PHONY: all install: mkdir -p $(D)/share/{doc/$(name),fonts/{opentype,truetype,WOFF,WOFF2}{,/.fc}} find . -name \*.otf -exec cp {} $(D)/share/fonts/opentype \; find . -name \*.ttf -exec cp {} $(D)/share/fonts/truetype \; find . -name \*.woff -exec cp {} $(D)/share/fonts/WOFF \; find . -name \*.woff2 -exec cp {} $(D)/share/fonts/WOFF2 \; find . -name \*.otf.fc -exec cp {} $(D)/share/fonts/opentype/.fc \; find . -name \*.ttf.fc -exec cp {} $(D)/share/fonts/truetype/.fc \; find . -name \*.woff.fc -exec cp {} $(D)/share/fonts/WOFF/.fc \; find . -name \*.woff2.fc -exec cp {} $(D)/share/fonts/WOFF2/.fc \; find "$(S)" -name \*.txt -exec cp {} $(D)/share/doc/$(name) \; find "$(S)" -name \*.md -exec cp {} $(D)/share/doc/$(name) \; find "$(S)" -name \*.adoc -exec cp {} $(D)/share/doc/$(name) \; find "$(S)" -name \*.html -exec cp {} $(D)/share/doc/$(name) \; find "$(S)" -name \*.css -exec cp {} $(D)/share/doc/$(name) \; .PHONY: install fonts: $(FONTS) .PHONY: fonts caches: $(CACHES) .PHONY: caches %.woff: %.otf sfnt2woff-zopfli "$<" %.woff2: %.otf woff2_compress "$<" %.otf.fc: %.otf fc.format > "$@" LANG=C LC_NUMERIC=C fc-scan --format "$$(cat fc.format)" "$<" %.woff.fc: %.woff fc.format > "$@" LANG=C LC_NUMERIC=C fc-scan --format "$$(cat fc.format)" "$<" %.woff2.fc: %.woff.fc cp "$<" "$@"