dotfiles/Makefile
2020-03-26 09:46:11 -04:00

28 lines
753 B
Makefile

TOP_SOURCES := $(shell git ls-files | grep -vE 'README|Makefile|^config|^\.git|^\.travis' | grep -v /)
CONFIG_SOURCES := $(shell git ls-files config)
LOCAL_BIN_SOURCES := $(shell git ls-files local/bin)
TARGETS := \
$(patsubst %,$(HOME)/.%,$(TOP_SOURCES)) \
$(patsubst %,$(HOME)/.%,$(CONFIG_SOURCES)) \
$(patsubst %,$(HOME)/.%,$(LOCAL_BIN_SOURCES)) \
$(HOME)/.config/i3/config
$(HOME)/.%: %
$(RM) '$@' && mkdir -p $(dir $@) && ln -svf '$(PWD)/$^' '$@'
.PHONY: all
all: $(HOME)/.config $(HOME)/.local/bin $(TARGETS)
$(HOME)/.config:
mkdir -p $@
$(HOME)/.local/bin:
mkdir -p $@
.PHONY: echo
echo:
@echo TOP_SOURCES=$(TOP_SOURCES)
@echo CONFIG_SOURCES=$(CONFIG_SOURCES)
@echo LOCAL_BIN_SOURCES=$(LOCAL_BIN_SOURCES)
@echo TARGETS=$(TARGETS)