dotfiles/Makefile

22 lines
552 B
Makefile

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