-
Notifications
You must be signed in to change notification settings - Fork 3
/
makefile
65 lines (51 loc) · 1.55 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
SHELL := /bin/bash
DOTFILES_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
OS := $(shell uname -s | tr A-Z a-z)
export STOW_DIR = $(DOTFILES_DIR)
export XDG_CONFIG_HOME = $(HOME)/.config
export XDG_CACHE_HOME = $(HOME)/.cache
export XDG_DATA_HOME = $(HOME)/.local/share
ifeq ($(OS),darwin)
export PATH := /opt/homebrew/bin:$(PATH)
SHELL := env PATH=$(PATH) /bin/bash
else
export PATH := /home/linuxbrew/.linuxbrew/bin/:$(XDG_DATA_HOME)/linuxbrew/bin/:$(PATH)
export NPM_CONFIG_PREFIX := $(HOME)/.local
endif
.PHONY: darwin linux
all: setup link crontab packages $(OS)
chmod 700 $(XDG_CONFIG_HOME)/gnupg
chmod 600 $(XDG_CONFIG_HOME)/gnupg/*
mkdir -p $(XDG_CACHE_HOME)/ssh
darwin:
linux:
[ -f $(HOME)/.hushlogin ] || touch $(HOME)/.hushlogin
setup:
cd $(DOTFILES_DIR)/$(OS) && . ./setup.sh
link:
for f in $$(ls -A $(DOTFILES_DIR)/runcom); do \
tf=$(HOME)/$${f//"dot-"/"."}; \
if [[ -e $$tf && ! -L $$tf ]]; then \
mv -v $$tf{,.bak}; \
fi \
done
mkdir -p $(XDG_CONFIG_HOME) $(HOME)/.local
stow -v --dotfiles -t $(HOME) runcom
stow -v -t $(XDG_CONFIG_HOME) config
stow -v --no-folding -t $(HOME)/.local local
unlink:
stow -v -D -t $(HOME) --dotfiles runcom
stow -v -D -t $(XDG_CONFIG_HOME) config
stow -v -D -t $(HOME)/.local local
for f in $$(ls -A $(DOTFILES_DIR)/runcom); do \
tf=$(HOME)/$${f//"dot-"/"."}; \
if [[ -f $$tf{.bak} ]]; then \
mv -v $tf{.bak,}; \
fi \
done
crontab:
crontab $(XDG_CONFIG_HOME)/crontab
packages: python-packages node-packages
python-packages:
node-packages:
npm install -g @delance/runtime