Skip to content

Commit 403b645

Browse files
committed
replace installation script with a Makefile
Both Bash and GNU Make are not really fit for purpose here, but it turns out Make sucks marginally less. It would be preferable to use something like Python (or even Chef/Puppet/Ansible if we were really serious about ops). However, it seems it is 2018 and I still need access to these tools in BusyBox-like environments with almost nothing modern available.
1 parent 4d01e56 commit 403b645

File tree

2 files changed

+99
-115
lines changed

2 files changed

+99
-115
lines changed

Makefile

+99-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,107 @@
1-
# TODO: subsume internal/install.sh
1+
ifdef VERBOSE
2+
V :=
3+
else
4+
V := @
5+
endif
26

37
CC ?= cc
4-
CFLAGS ?= -std=c11 -W -Wall -Wextra -Wshadow -Wwrite-strings
8+
CFLAGS ?= -std=c11 -O3 -W -Wall -Wextra -Wshadow -Wwrite-strings
9+
10+
CXX ?= c++
11+
CFLAGS ?= -std=c++11 -O3 -W -Wall -Wextra -Wshadow -Wwrite-strings -Wmissing-declarations
512

613
# Serenity now
714
SHELL := $(shell which bash)
815

9-
default: ${HOME}/bin/cub
16+
default: \
17+
${HOME}/.ssh/config_mattutils \
18+
${HOME}/.agignore \
19+
${HOME}/.dircolors \
20+
${HOME}/.emacs \
21+
${HOME}/.fonts.conf \
22+
${HOME}/.gdbinit \
23+
${HOME}/.gitconfig \
24+
${HOME}/.hgrc \
25+
${HOME}/.mplayer \
26+
${HOME}/.screenrc \
27+
${HOME}/.tmux.conf \
28+
${HOME}/.tmux-new-pane_current_path.conf \
29+
${HOME}/.tmux-new-vi-copy.conf \
30+
${HOME}/.tmux-old-pane_current_path.conf \
31+
${HOME}/.tmux-old-vi-copy.conf \
32+
${HOME}/.tmux-tpm.conf \
33+
${HOME}/.vimrc \
34+
${HOME}/.vim \
35+
${HOME}/.wgetrc \
36+
${HOME}/.Xdefaults \
37+
${HOME}/.zsh \
38+
${HOME}/.zshrc \
39+
${HOME}/bin/addcert.sh \
40+
${HOME}/bin/after \
41+
${HOME}/bin/ag \
42+
${HOME}/bin/bashd.sh \
43+
${HOME}/bin/check_tmux_version.sh \
44+
${HOME}/bin/cmake \
45+
${HOME}/bin/compresspdf.sh \
46+
${HOME}/bin/cub \
47+
${HOME}/bin/dif \
48+
${HOME}/bin/fifi.sh \
49+
${HOME}/bin/find-broken.sh \
50+
${HOME}/bin/fwdmail.py \
51+
${HOME}/bin/generate-passwd \
52+
${HOME}/bin/g \
53+
${HOME}/bin/ifind \
54+
${HOME}/bin/kage \
55+
${HOME}/bin/meta_c \
56+
${HOME}/bin/meta_h \
57+
${HOME}/bin/meta_l \
58+
${HOME}/bin/meta_u \
59+
${HOME}/bin/meta_z \
60+
${HOME}/bin/notate.py \
61+
${HOME}/bin/pdfcrop.sh \
62+
${HOME}/bin/prefix \
63+
${HOME}/bin/pyman \
64+
${HOME}/bin/search \
65+
${HOME}/bin/ssh-proxy \
66+
${HOME}/bin/t \
67+
${HOME}/bin/term \
68+
${HOME}/bin/timestamp \
69+
${HOME}/bin/ubiquity \
70+
${HOME}/bin/validate.py \
71+
${HOME}/bin/wim \
72+
73+
74+
${HOME}/.ssh/config_mattutils: config/.ssh/config Makefile
75+
@printf ' [LN] %s\n' "$(notdir $@)"
76+
${V}if [ ! -e "$@" ]; then ln -s $$(pwd)/$< $@; elif [ ! -L "$@" ]; then printf 'Warning: Skipping %s that already exists\n' "$@" >&2; fi
77+
1078

1179
${HOME}/bin/cub: cub.c Makefile
12-
${CC} ${CFLAGS} -o $@ $<
80+
@printf ' [CC] %s\n' "$(notdir $@)"
81+
${V}mkdir -p "$(dir $@)"
82+
${V}${CC} ${CFLAGS} -o $@ $<
83+
84+
${HOME}/bin/dif: dif.cpp
85+
@printf ' [CXX] %s\n' "$(notdir $@)"
86+
${V}mkdir -p "$(dir $@)"
87+
${V}${CXX} ${CXXFLAGS} -o $@ $<
88+
89+
${HOME}/.%: config/.% Makefile
90+
@printf ' [LN] %s\n' "$(notdir $@)"
91+
${V}if [ ! -e "$@" ]; then ln -s $$(pwd)/$< $@; elif [ ! -L "$@" ]; then printf 'Warning: Skipping %s that already exists\n' "$@" >&2; fi
92+
93+
${HOME}/bin/%: % Makefile
94+
@printf ' [LN] %s\n' "$(notdir $@)"
95+
${V}mkdir -p "$(dir $@)"
96+
${V}if [ ! -e "$@" ]; then ln -s $$(pwd)/$< $@; elif [ ! -L "$@" ]; then printf 'Warning: Skipping %s that already exists\n' "$@" >&2; fi
97+
98+
${HOME}/bin/rerebase: rerebase.c Makefile
99+
@printf ' [CC] %s\n' "$(notdir $@)"
100+
${V}mkdir -p "$(dir $@)"
101+
${V}${CC} ${CFLAGS} -o $@ $<
102+
103+
${HOME}/.tmux/plugins/tpm: Makefile
104+
@printf 'Warning: Tmux Plugin Manager not found (~/.tmux/plugins/tpm)\n' >&2
105+
106+
# Disable built-in rules.
107+
.SUFFIXES:

internal/install.sh

-111
This file was deleted.

0 commit comments

Comments
 (0)