forked from martanne/vis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
103 lines (79 loc) · 3.09 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
-include config.mk
SRC = array.c buffer.c libutf.c main.c map.c register.c ring-buffer.c \
sam.c text.c text-motions.c text-objects.c text-regex.c text-util.c \
ui-curses.c view.c vis.c vis-lua.c vis-modes.c vis-motions.c \
vis-operators.c vis-prompt.c vis-text-objects.c
# conditionally initialized, this is needed for standalone build
# with empty config.mk
PREFIX ?= /usr/local
SHAREPREFIX ?= ${PREFIX}/share
MANPREFIX ?= ${PREFIX}/man
VERSION = $(shell git describe 2>/dev/null || echo "0.2")
CONFIG_LUA ?= 1
CONFIG_ACL ?= 0
CONFIG_SELINUX ?= 0
CFLAGS_STD ?= -std=c99 -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -DNDEBUG
LDFLAGS_STD ?= -lc
CFLAGS_VIS = $(CFLAGS_AUTO) $(CFLAGS_TERMKEY) $(CFLAGS_CURSES) $(CFLAGS_ACL) \
$(CFLAGS_SELINUX) $(CFLAGS_LUA) $(CFLAGS_STD)
CFLAGS_VIS += -DVERSION=\"${VERSION}\"
CFLAGS_VIS += -DVIS_PATH=\"${SHAREPREFIX}/vis\"
CFLAGS_VIS += -DCONFIG_LUA=${CONFIG_LUA}
CFLAGS_VIS += -DCONFIG_SELINUX=${CONFIG_SELINUX}
CFLAGS_VIS += -DCONFIG_ACL=${CONFIG_ACL}
LDFLAGS_VIS = $(LDFLAGS_AUTO) $(LDFLAGS_TERMKEY) $(LDFLAGS_CURSES) $(LDFLAGS_ACL) \
$(LDFLAGS_SELINUX) $(LDFLAGS_LUA) $(LDFLAGS_STD)
DEBUG_CFLAGS_VIS = ${CFLAGS_VIS} -UNDEBUG -O0 -g -ggdb -Wall -Wextra -pedantic \
-Wno-missing-field-initializers -Wno-unused-parameter
STRIP?=strip
all: vis
config.h:
cp config.def.h config.h
config.mk:
@touch $@
vis: config.h config.mk *.c *.h
${CC} ${CFLAGS} ${CFLAGS_VIS} ${SRC} ${LDFLAGS} ${LDFLAGS_VIS} -o $@
debug: clean
@$(MAKE) CFLAGS_VIS='${DEBUG_CFLAGS_VIS}'
profile: clean
@$(MAKE) CFLAGS_VIS='${DEBUG_CFLAGS_VIS} -pg'
test-update:
git submodule init
git submodule update --remote --rebase
test:
[ -e test/Makefile ] || $(MAKE) test-update
@$(MAKE) -C test
clean:
@echo cleaning
@rm -f vis vis-${VERSION}.tar.gz
dist: clean
@echo creating dist tarball
@git archive --prefix=vis-${VERSION}/ -o vis-${VERSION}.tar.gz HEAD
install: vis
@echo stripping executable
@${STRIP} vis
@echo installing executable file to ${DESTDIR}${PREFIX}/bin
@mkdir -p ${DESTDIR}${PREFIX}/bin
@cp -f vis ${DESTDIR}${PREFIX}/bin
@chmod 755 ${DESTDIR}${PREFIX}/bin/vis
@cp -f vis-open ${DESTDIR}${PREFIX}/bin
@chmod 755 ${DESTDIR}${PREFIX}/bin/vis-open
@cp -f vis-clipboard ${DESTDIR}${PREFIX}/bin
@chmod 755 ${DESTDIR}${PREFIX}/bin/vis-clipboard
@echo installing support files to ${DESTDIR}${SHAREPREFIX}/vis
@mkdir -p ${DESTDIR}${SHAREPREFIX}/vis
@cp -r visrc.lua vis.lua lexers ${DESTDIR}${SHAREPREFIX}/vis
@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
@mkdir -p ${DESTDIR}${MANPREFIX}/man1
@sed "s/VERSION/${VERSION}/g" < vis.1 > ${DESTDIR}${MANPREFIX}/man1/vis.1
@chmod 644 ${DESTDIR}${MANPREFIX}/man1/vis.1
uninstall:
@echo removing executable file from ${DESTDIR}${PREFIX}/bin
@rm -f ${DESTDIR}${PREFIX}/bin/vis
@rm -f ${DESTDIR}${PREFIX}/bin/vis-open
@rm -f ${DESTDIR}${PREFIX}/bin/vis-clipboard
@echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
@rm -f ${DESTDIR}${MANPREFIX}/man1/vis.1
@echo removing support files from ${DESTDIR}${SHAREPREFIX}/vis
@rm -rf ${DESTDIR}${SHAREPREFIX}/vis
.PHONY: all clean dist install uninstall debug profile test test-update