Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
86 lines (67 loc) · 1.59 KB
/
Copy pathMakefile
File metadata and controls
86 lines (67 loc) · 1.59 KB
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
# Copyright 2022 Mitchell Kember. Subject to the MIT License.
define usage
Targets:
all Build scripts
help Show this help message
install Symlink scripts using sim
uninstall Remove installed symlimks
check Run before committing
fmt Format code
lint Lint code
clean Remove build output
Variables:
DEBUG If nonempty, build in debug mode
endef
.PHONY: all help install uninstall check fmt lint clean
CXXFLAGS := $(shell cat compile_flags.txt) $(if $(DEBUG),-O0 -g,-O3)
script_sh := $(wildcard *.sh)
script_py := $(wildcard *.py)
script_pl := $(wildcard *.pl)
script_fish := $(wildcard *.fish)
script_all := $(script_sh) $(script_py) $(script_pl) $(script_fish)
src_cpp := $(wildcard *.cpp)
bin_cpp := $(src_cpp:%.cpp=bin/%)
bin_all := $(bin_cpp)
exe_all := $(script_all) $(bin_all)
# These are the scripts I actively use.
exe_install := \
24bitcolor.sh \
base16test.sh \
clean-icloud-dups.sh \
goodnight.sh \
j.sh \
journallint.py \
kitty-bell-notify.sh \
noextensions.sh \
recall.sh \
tmux-session.sh \
tmux-set-cwd.sh \
tmux-window.sh \
unquarantine.sh \
update-zig.sh \
z-projects.fish \
bin/kitty-colors \
bin/ledgerlint \
bin/yank
.SUFFIXES:
all: $(bin_all)
help:
$(info $(usage))
@:
install: $(bin_all)
sim install --no-ext $(exe_install)
uninstall:
sim remove --target --quiet $(exe_all)
check: fmt lint all
fmt:
black $(script_py)
fish_indent -w $(script_fish)
clang-format --style=file -i $(src_cpp)
lint:
shellcheck $(script_sh)
clean:
rm -rf bin
bin:
mkdir $@
$(bin_cpp): bin/%: %.cpp | bin
$(CXX) $(CXXFLAGS) -o $@ $^