.PHONY = clean install offline fonts/all fonts/download-all uninstall default: install LOCAL_CACHE ?= ./build/cache LOCAL_TOOLS ?= ./build/tools LOCAL_FONTS ?= $(HOME)/.local/share/fonts FONTS_TO_INSTALL ?= FiraCode FiraMono Hack LOCAL_TOOLS_BIN ?= $(HOME)/.local/bin STOW_TARGET ?= $(HOME) STOW := $(shell command -v stow 2>/dev/null) # Compile stow if it doesn't exist ifeq ($(STOW),) STOW := $(LOCAL_TOOLS_BIN)/stow BUILD_STOW := 1 PERL5LIB := $(LOCAL_TOOLS)/stow/lib export PERL5LIB endif ## Includes include tools.mk include stowers.mk install: tools/all stowers/all fonts/all offline: tools/download-all fonts/download-all clean: tools/clean rm -rf ./build uninstall: stowers/uninstall/all clean @echo Uninstalled! $(LOCAL_CACHE) $(LOCAL_CACHE)/fonts $(LOCAL_TOOLS) $(LOCAL_TOOLS_BIN): mkdir -p $@ $(LOCAL_CACHE)/fonts/%.tar.xz: $(LOCAL_CACHE)/fonts @echo Downloading font $* curl -o $@ -L https://github.com/ryanoasis/nerd-fonts/releases/latest/download/$*.tar.xz fonts/download-all: $(foreach font,$(FONTS_TO_INSTALL),$(LOCAL_CACHE)/fonts/$(font).tar.xz) @echo Downloaded all fonts fonts/all: $(foreach font,$(FONTS_TO_INSTALL),fonts/$(font)) @echo Installed all fonts fonts/%: $(LOCAL_CACHE)/fonts/%.tar.xz @echo Installing font $* mkdir -p $(LOCAL_FONTS) mkdir -p $(LOCAL_CACHE)/fonts/$* tar -C $(LOCAL_CACHE)/fonts/$* -xJf $< find $(LOCAL_CACHE)/fonts/$* -type f \( -iname '*.otf' -o -iname '*.ttf' \) -exec mv {} $(LOCAL_FONTS)/ \; fc-cache -f