dotfiles/Makefile
2023-02-08 11:51:12 -05:00

38 lines
1.1 KiB
Makefile

SUDO ?= sudo
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 \
/etc/udev/rules.d/90-trackman-marble.rules \
/usr/local/bin/handle-trackman-marble
$(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 $@
/etc/udev/rules.d/90-trackman-marble.rules: udev/rules.d/90-trackman-marble.rules
$(SUDO) install -m 0644 -v udev/rules.d/90-trackman-marble.rules $@
/usr/local/bin/handle-trackman-marble: udev/handle-trackman-marble
$(SUDO) install -m 0644 -v udev/handle-trackman-marble $@
.PHONY: echo
echo:
@echo TOP_SOURCES=$(TOP_SOURCES)
@echo CONFIG_SOURCES=$(CONFIG_SOURCES)
@echo LOCAL_BIN_SOURCES=$(LOCAL_BIN_SOURCES)
@echo TARGETS=$(TARGETS)