-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
110 lines (101 loc) · 2.68 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
SHELL:=/bin/bash -o pipefail
MAKEFLAGS+=--always-make # This makes all targets "phony"
.DEFAULT_GOAL:=$(shell echo $${HOSTNAME,,})
APT:=$(shell command -v apt 2>/dev/null)
PRINT=$(info $(shell printf '\e[32m%-*s\e[m\n' $$(tput cols) $@ | perl -pe 's/(?<= ) /─/g'))
# Mod lists. Running `make` will install the mod list corresponding to the
# machine's hostname, thanks to the "default goal" above.
tamriel: \
7zip \
bash \
bat \
clef \
docker \
exiftool \
ffmpeg \
fx \
fzf \
gif-tools \
git \
gpg \
hyperfine \
imagemagick \
img2pdf \
json-tools \
misc-utils \
mkvtoolnix \
nano \
node \
passwordless-sudo \
python3 \
shellcheck \
sqlite3 \
starship \
sweetroll \
tree \
wsl \
yt-dlp \
oblivion: tamriel # Same, but wsl mod will configure differently
sovngarde: \
bash \
bat \
docker \
fzf \
git \
htop \
misc-utils \
mkvtoolnix \
nano \
starship \
sweetroll \
unraid \
# Create targets for each mod. Double colon targets are separate targets with
# the same name that run in series; this lets mods define additional install
# steps or depend upon other mods via their included Makefile.
$(notdir $(wildcard mods/*)):: stow
$(PRINT)
stow $@
include mods/*/Makefile
# Install stow
stow:
$(PRINT)
ifdef APT
sudo apt-get update -qq
sudo apt-get install -qy stow
else
# https://gist.github.com/maxkagamine/7e3741b883a272230eb451bdd84a8e23
# MAKEFLAGS need to be reset to prevent weird behavior in stow's Makefile
wget http://ftp.gnu.org/gnu/stow/stow-latest.tar.gz -O - | tar -xzC /tmp
cd /tmp/stow* && ./configure && MFLAGS= MAKEFLAGS= make install
rm -rf /tmp/stow*
endif
# Shellcheck (see .vscode/tasks.json)
test:
@find mods -type f -exec awk '/^#.*sh/{printf "%s\0",FILENAME}{nextfile}' {} + | \
xargs -r0 shellcheck -xf gcc
watch:
ifeq "$(shell command -v inotifywait 2>/dev/null)" ""
$(info Installing inotifywait...)
@sudo apt-get install -y inotify-tools >/dev/null
endif
@while $(MAKE) test; inotifywait -qre close_write mods; do :; done
# Unnecessary visualization
# https://github.com/lindenb/makefile2graph
graph:
ifeq "$(shell command -v make2graph 2>/dev/null)" ""
rm -rf /tmp/make2graph
git clone https://github.com/lindenb/makefile2graph.git /tmp/make2graph
make -C /tmp/make2graph
sudo make -C /tmp/make2graph install
rm -rf /tmp/make2graph
endif
ifeq "$(shell command -v dot 2>/dev/null)" ""
sudo apt-get install -y graphviz
endif
make -Bnd tamriel sovngarde | \
grep -Pv '(stow|Makefile)' | \
make2graph | \
sed 's/, color="red"//g' | \
dot -Gmargin=0.3 -Gbgcolor=transparent -Tpng -o /dev/stdout | \
magick /dev/stdin -channel RGB -negate -background '#0d1117' -alpha remove \
.github/images/graph.png