-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (42 loc) · 1.46 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
# Flags used to compress (because why not) from:
# https://ptspts.blogspot.com/2013/12/how-to-make-smaller-c-and-c-binaries.html
CC=gcc
CFLAGS=-Wall -Werror -Wno-unused-result -O0 -fno-unwind-tables -fno-stack-protector -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -Wl,--gc-sections -Wl,-z,norelro -Wl,--build-id=none
LINKFLAGS=-lm
STRIP=strip
STRIPFLAGS=-s -R .comment -R .gnu.version --strip-unneeded -R .note.gnu.gold-version -R .note -R .note.gnu.build-id -R .note.ABI-tag
DEBUGFLAGS=-ggdb -O0
TARGET=statusline
.phony: statusline clean debug deploy valgrind update-nvim
$(TARGET): $(TARGET).c
$(CC) $(TARGET).c $(CFLAGS) -o $(TARGET) $(LINKFLAGS)
$(STRIP) $(STRIPFLAGS) $(TARGET)
# See https://askubuntu.com/a/1349048 for more info
# make debug
# gdb ./statusline_debug
# r
# bt (or `bt full`)
#
# to set breakpoints:
# break statusline.c:45
debug: $(TARGET).c
$(CC) $(TARGET).c $(CFLAGS) -o $(TARGET).debug $(LINKFLAGS) $(DEBUGFLAGS)
valgrind: debug
valgrind \
--tool=memcheck \
--leak-check=full \
--track-origins=yes \
--leak-resolution=high \
--show-reachable=yes \
--trace-children=yes \
./$(TARGET).debug
clean:
rm -f $(TARGET)
deploy:
cp ~/spell/en.utf-8.add ./spell/en.utf-8.add \
&& ./dotfiles deploy -v \
&& cp ./statusline ~/statusline
update-nvim:
wget https://github.com/neovim/neovim/releases/latest/download/nvim.appimage -O ~/.local/bin/nvim \
&& chmod u+x ~/.local/bin/nvim \
&& rm ~/.local/state/nvim/lsp.log