-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
111 lines (83 loc) · 2.61 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
111
.SUFFIXES:
dotfiles = ~/dotfiles
footer = END PUBLIC FILE
privtag = PRIV
allfiles = \
$(addprefix home/,.bash_personal .bash_profile .bashrc .gitconfig \
.gitignore .vimrc .fonts.conf .minttyrc .XCompose .tmux.conf) \
$(addprefix local/,.bashrc_Cygwin .bashrc_GNU_Linux) \
$(addprefix reg/,bog.runasinvoker.reg gio.makebak.reg gio.toggledisabled.reg) \
$(addprefix scripts/,jqt shlex j2 servicewatch.sh) \
$(addprefix support/,gum_polyfill.sh .bash_colors .bash_completion logging.sh hyperloop.sh certutils.sh) \
$(addprefix .emacs.d/,init.el init-extra.el) \
$(addprefix .config/,ruff.toml)
# .githooks/prepare-commit-msg
.PHONY: all
all: allfiles
.PHONY: allfiles
allfiles: $(allfiles) Makefile
.SECONDEXPANSION:
.SUFFIXES:
.PHONY: check
check:
@-diff -r ./home/ ../home/ -q
@-diff -r ./local/ ../local/ -q
@-diff -r ./reg/ ../reg/ -q
@-diff -r ./scripts/ ../scripts/ -q
@-diff -r ./support/ ../support/ -q
@-diff -r ./.emacs.d/ ../.emacs.d/ -q
define compile_cmd
@mkdir -p "`dirname $@`"
@grep -E '$(ICOM) ?$(footer)' $< > /dev/null # ensure footer exists
sed -n -r '/$(ICOM) $(footer)/q;p' $< | perl -pe "s/(\n|^ *)(.+?)$(ICOM) ?$(privtag)//g" > $@
endef
define copy_cmd
@mkdir -p "`dirname $@`"
cp $< $@
endef
home/.%: ICOM = \#
home/.% :: $(dotfiles)/home/.%
$(call compile_cmd,ICOM)
% :: $(dotfiles)/$$@
$(call copy_cmd)
home/.vimrc :: $(dotfiles)/home/.vimrc
$(call copy_cmd)
home/.minttyrc :: $(dotfiles)/home/.minttyrc
$(call copy_cmd)
home/.XCompose :: $(dotfiles)/home/.XCompose
$(call copy_cmd)
home/%.conf :: $(dotfiles)/home/%.conf
$(call copy_cmd)
reg/%.reg :: $(dotfiles)/reg/%.reg
$(call copy_cmd)
.emacs.d/%.el: ICOM = \;
.emacs.d/%.el :: $(dotfiles)/.emacs.d/%.el
$(call compile_cmd,ICOM)
.emacs.d/%.sh: ICOM = \#
.emacs.d/%.sh :: $(dotfiles)/.emacs.d/%.sh
$(call compile_cmd,ICOM)
.emacs.d/%.patch :: $(dotfiles)/.emacs.d/%.patch
$(call copy_cmd)
local/%: ICOM = \#
local/% :: $(dotfiles)/local/%
$(call compile_cmd,ICOM)
.githooks/%: $(dotfiles)/.githooks/%
$(call copy_cmd)
scripts/% :: $(dotfiles)/scripts/%
$(call copy_cmd)
support/% :: $(dotfiles)/support/%
$(call copy_cmd)
.ssh/config.j2: ICOM = \#
.ssh/config.j2 :: ~/.ssh/config.j2
$(call compile_cmd,ICOM)
.config/gtk-3.0/settings.ini :: ~/.config/gtk-3.0/settings.ini
$(call copy_cmd)
.chef/knife.rb :: ~/.chef/knife.rb
$(call copy_cmd)
compareroots = config home reg scripts local service support .config
tell_me_what_all_cool_stuff_isnt_in_the_makefile_yet:
mkdir -p $(compareroots)
bash -c 'diff <(find $(compareroots) | sort -u) <(cd ../; find $(compareroots) | sort -u)'
.PHONY: clean
clean:
-rm -r $(allfiles)