-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
46 lines (37 loc) · 1.11 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
DOTFILES_DIR = ~/.dotfiles
DOTFILES_CONFIG_DIR = ~/.dotfiles/.config
CONFIG_DIR = ~/.config
BACKUP_DIR = ~/.config-bkp
TITLE=\033[1;34m==>\033[0m
ENTRY_OK=\033[32m[✔]\033[0m
MAC_CONFIG_FOLDERS := fish
LINUX_CONFIG_FOLDERS := fish kitty hypr
UNAME := $(shell uname)
all: backup install
backup:
@echo "Backing up $(CONFIG_DIR) to $(BACKUP_DIR)..."
@if [ -d $(BACKUP_DIR) ]; then \
echo "The backup directory already exists. Deleting..."; \
rm -rf $(BACKUP_DIR); \
fi; \
mv $(CONFIG_DIR) $(BACKUP_DIR); \
mkdir -p $(CONFIG_DIR); \
echo "Backup done."
install:
@echo "$(TITLE) $(UNAME) Setup"
@if [ "$(UNAME)" = "Darwin" ]; then \
CONFIG_FOLDERS="$(MAC_CONFIG_FOLDERS)"; \
else \
CONFIG_FOLDERS="$(LINUX_CONFIG_FOLDERS)"; \
fi; \
echo "Installing symlinks for:"; \
for folder in $$CONFIG_FOLDERS; do \
$(MAKE) create_config_symlink folder=$$folder; \
done
create_config_symlink:
@echo "$(ENTRY_OK) $(folder)"
@ln -nsf $(DOTFILES_CONFIG_DIR)/$(folder) $(CONFIG_DIR)/$(folder)
create_symlink:
@echo "$(ENTRY_OK) $(folder)"
@ln -nsf $(DOTFILES_DIR)/$(folder) $(CONFIG_DIR)/$(folder)
.PHONY: backup install