-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (60 loc) · 1.66 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
66
67
68
69
70
71
.PHONY: help all remove test scripts aliases services script_notice service_notice
scripts := $(subst scripts/,,$(wildcard scripts/*))
aliases := $(subst aliases/,,$(wildcard aliases/*))
services := $(subst services/,,$(wildcard services/*))
help:
@tput setaf 2
@tput bold
@echo "Available targets:"
@echo
@tput setaf 3
@echo all $(scripts) $(aliases) $(services) | tr ' ' '\n' | nl | tr -s ' ' | tr '\t' ' ' | column
@tput sgr0
@echo
@tput setaf 6
@tput bold
@echo "make <target>"
@tput sgr0
@echo
all: $(scripts) $(aliases) $(services) script_notice alias_notice
$(scripts): script_notice
mkdir --parents $(HOME)/.local/bin
cp scripts/$@ $(HOME)/.local/bin
services: $(services)
$(services): service_notice
sudo cp services/$@ /usr/local/bin
sudo cp systemd/$@.timer /usr/lib/systemd/system/
sudo cp systemd/$@.service /usr/lib/systemd/system/
$(aliases): alias_notice
mkdir --parents $(HOME)/.bash_tools
cp aliases/$@ $(HOME)/.bash_tools
script_notice:
@tput setaf 3
@tput bold
@echo 'Use `include_path` utility to add `$$HOME/.local/bin` to your PATH:'
@echo
@tput setaf 6
@echo 'include_path $$HOME/.local/bin'
@tput sgr0
@echo
alias_notice:
@tput setaf 3
@tput bold
@echo 'Add following line in your `$$HOME/.bashrc` file:'
@echo
@tput setaf 6
@echo 'for tool in $$HOME/.bash_tools/*; do source $$tool; done'
@tput sgr0
@echo
service_notice:
@tput setaf 3
@tput bold
@echo 'Reload systemd configuration and enable your services:'
@echo
@tput setaf 6
@echo 'sudo systemctl daemon-reload'
@echo 'sudo systemctl enable --now <service>'
@tput sgr0
@echo
test:
shellcheck $(wildcard scripts/*) $(wildcard aliases/*) $(wildcard services/*)