-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
104 lines (84 loc) · 2.88 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
.PHONY: lib-build lib-clean plug-install plug-sync plug-gc plug-clean normalize-runtime setup
CC = clang
SRCDIRS = $(wildcard src/*)
TARGETS = $(patsubst src/%, lib/%.so, $(SRCDIRS))
INCDIR = include
CFLAGS := -std=c23 -I$(INCDIR) -Wtautological-compare -Wsign-compare -Wall \
-Wextra -fforce-emit-vtables -ffunction-sections -fdata-sections \
-faddrsig -march=native -mtune=native -funroll-loops -fomit-frame-pointer \
-fPIC -O3
LDFLAGS = -flto=full -fwhole-program-vtables -funroll-loops -fomit-frame-pointer \
-O3 -shared
lib-build: $(TARGETS)
lib/%.so: src/%
$(CC) $</*.c $(CFLAGS) $(LDFLAGS) -o $@
lib-clean:
rm $(TARGETS)
GITHUB_URL := https://github.com
PLUGINDIR := plugins
PLUGINS := MunifTanjim/nui.nvim \
SmiteshP/nvim-navbuddy \
SmiteshP/nvim-navic \
ThePrimeagen/refactoring.nvim \
altermo/ultimate-autopair.nvim \
andersevenrud/nvim_context_vt \
folke/flash.nvim \
folke/snacks.nvim \
gbprod/substitute.nvim \
hadronized/hop.nvim \
koron/codic-vim \
kylechui/nvim-surround \
niuiic/core.nvim \
niuiic/track.nvim \
nvim-lua/plenary.nvim \
nvim-telescope/telescope.nvim \
nvim-tree/nvim-web-devicons \
nvim-treesitter/nvim-treesitter \
rafamadriz/friendly-snippets \
saghen/blink.cmp \
sidebar-nvim/sidebar.nvim \
stevearc/oil.nvim \
utilyre/sentiment.nvim \
vim-jp/nvimdoc-ja \
vim-jp/vimdoc-ja \
zbirenbaum/copilot.lua \
neovim/neovim \
# destination directory name
PLUGIN_PATHS := $(addprefix $(PLUGINDIR)/, $(PLUGINS))
# list of installed repositories
ACCOUNTS_EXIST := $(shell ls $(PLUGINDIR))
REPOS_INSTALLED := $(patsubst plugins/%, %, $(shell find $(PLUGINDIR) -mindepth 2 -maxdepth 2 -type d))
# repositories deleted from the list
# filter-out: filter listed repos ; $(filter-out a, a b c) -> b c
GARBAGE_ACCOUNTS := $(filter-out $(patsubst %/, %, $(dir $(PLUGINS))), $(ACCOUNTS_EXIST))
GARBAGE_ACCOUNTS_PATHS := $(addprefix $(PLUGINDIR)/, $(GARBAGE_ACCOUNTS))
GARBAGE_REPOS := $(filter-out $(PLUGINS), $(REPOS_INSTALLED))
GARBAGE_REPOS_PATHS := $(addprefix $(PLUGINDIR)/, $(GARBAGE_REPOS))
GARBAGES := $(GARBAGE_REPOS_PATHS) $(GARBAGE_ACCOUNTS_PATHS)
$(PLUGINDIR)/%:
git clone --depth 1 $(GITHUB_URL)/$* $@
%.plug-sync:
cd $(PLUGINDIR)/$* && git pull
%.plug-rm: $(PLUGINDIR)/$*
rm -rf $(PLUGINDIR)/$*
plug-install: $(PLUGIN_PATHS)
plug-sync: $(addsuffix .plug-sync, $(PLUGINS))
plug-gc: $(GARBAGES)
ifneq (,$^)
rm -rf $^
endif
plug-clean: $(addsuffix .plug-rm, $(PLUGINS))
plug-update:
$(MAKE) plug-sync
$(MAKE) -f make/setup-blink.mk
$(MAKE) -f make/setup-treesitter.mk
$(MAKE) -f make/setup-neovim.mk
$(MAKE) normalize-runtime
# about 3ms faster startup
normalize-runtime:
rm -rf ~/.local/share/nvim/runtime/plugin
rm -rf ~/.local/share/nvim/runtime/pack
setup:
$(MAKE) normalize-runtime
$(MAKE) lib-build
$(MAKE) plug-update