view: do not highlight matching symbols if selection is active
[vis.git] / config.mk
blobf11e8c1b41628ac83d1fbcb50ea2b5e3e3f19204
1 # optional features
2 HAVE_ACL=0
3 HAVE_SELINUX=0
5 # vis version
6 RELEASE = HEAD
7 # try to get a tag and hash first
8 GITHASH = $(shell git log -1 --format='%h' 2>/dev/null)
9 GITTAG = $(shell git describe --abbrev=0 --tags 2>/dev/null)
10 ifneq ($(GITTAG),)
11 # we have a tag and revcount from there
12 GITREVCOUNT = $(shell git rev-list --count ${GITTAG}.. 2>/dev/null)
13 VERSION = ${GITTAG}.r${GITREVCOUNT}.g${GITHASH}
14 else ifneq ($(GITHASH),)
15 # we have no tags in git, so just use revision count an hash for now
16 GITREVCOUNT = $(shell git rev-list --count HEAD)
17 VERSION = 0.r${GITREVCOUNT}.g${GITHASH}
18 else
19 # this is used when no git is available, e.g. for release tarball
20 VERSION = ${RELEASE}
21 endif
23 # Customize below to fit your system
25 PREFIX ?= /usr/local
26 MANPREFIX = ${PREFIX}/share/man
27 SHAREPREFIX = ${PREFIX}/share/vis
29 CFLAGS_LUA = $(shell pkg-config --cflags lua5.1 2> /dev/null || echo "-I/usr/include/lua5.1")
30 CFLAGS_TERMKEY = $(shell pkg-config --cflags termkey 2> /dev/null || echo "")
31 CFLAGS_CURSES = $(shell pkg-config --cflags ncursesw 2> /dev/null || echo "-I/usr/include/ncursesw")
33 LDFLAGS_LUA = $(shell pkg-config --libs lua5.1 2> /dev/null || echo "-llua")
34 LDFLAGS_TERMKEY = $(shell pkg-config --libs termkey 2> /dev/null || echo "-ltermkey")
35 LDFLAGS_CURSES = $(shell pkg-config --libs ncursesw 2> /dev/null || echo "-lncursesw")
37 LIBS = -lm -ldl -lc
38 OS = $(shell uname)
40 ifeq (${OS},Linux)
41 ifeq (${HAVE_SELINUX},1)
42 CFLAGS += -DHAVE_SELINUX
43 LIBS += -lselinux
44 endif
45 ifeq (${HAVE_ACL},1)
46 CFLAGS += -DHAVE_ACL
47 LIBS += -lacl
48 endif
49 else ifeq (${OS},Darwin)
50 CFLAGS += -D_DARWIN_C_SOURCE
51 else ifeq (${OS},OpenBSD)
52 CFLAGS += -D_BSD_SOURCE
53 else ifeq (${OS},FreeBSD)
54 CFLAGS += -D_BSD_SOURCE
55 else ifeq (${OS},NetBSD)
56 CFLAGS += -D_BSD_SOURCE
57 else ifeq (${OS},AIX)
58 CFLAGS += -D_ALL_SOURCE
59 endif
61 CFLAGS_LIBS = $(CFLAGS_LUA) $(CFLAGS_TERMKEY) $(CFLAGS_CURSES)
62 LDFLAGS_LIBS = $(LDFLAGS_LUA) $(LDFLAGS_TERMKEY) $(LDFLAGS_CURSES) $(LIBS)
64 CFLAGS_VIS = $(CFLAGS_LIBS) -std=c99 -Os -DVERSION=\"${VERSION}\" -DNDEBUG -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_ALL
65 LDFLAGS_VIS = $(LDFLAGS_LIBS)
67 DEBUG_CFLAGS_VIS = ${CFLAGS_VIS} -UNDEBUG -O0 -g -ggdb -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter
69 CC ?= cc
70 STRIP ?= strip
72 # Hardening
73 ifeq (${CC},gcc)
74 CFLAGS += -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2
75 LDFLAGS += -z now -z relro -pie
76 else ifeq (${CC},clang)
77 CFLAGS += -fPIE -fstack-protector-all -D_FORTIFY_SOURCE=2
78 LDFLAGS += -z now -z relro -pie
79 endif