-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
20 lines (16 loc) · 687 Bytes
/
Makefile
File metadata and controls
20 lines (16 loc) · 687 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
XDG_CONFIG_HOME ?= $(HOME)/.config
BASH_CONFIG_DIR := $(XDG_CONFIG_HOME)/bash
REPO_DIR := $(shell cd "$(dir $(abspath $(lastword $(MAKEFILE_LIST))))" && pwd)
SHIM := $(HOME)/.bashrc
.PHONY: install uninstall
install:
@mkdir -p $(BASH_CONFIG_DIR)
@ln -sfn $(REPO_DIR)/.bashrc $(BASH_CONFIG_DIR)/bashrc
@printf '[[ -f "%s/bashrc" ]] && source "%s/bashrc"\n' "$(BASH_CONFIG_DIR)" "$(BASH_CONFIG_DIR)" > $(SHIM)
@echo "Installed: $(BASH_CONFIG_DIR)/bashrc -> $(REPO_DIR)/bashrc"
@echo "Created shim: $(SHIM)"
uninstall:
@rm -f $(BASH_CONFIG_DIR)/bashrc
@rm -f $(SHIM)
@rmdir $(BASH_CONFIG_DIR) 2>/dev/null || true
@echo "Removed: $(BASH_CONFIG_DIR)/bashrc and $(SHIM)"