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
)
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}
19 # this is used when no git is available, e.g. for release tarball
23 # Customize below to fit your system
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")
41 ifeq (${HAVE_SELINUX},1)
42 CFLAGS
+= -DHAVE_SELINUX
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
58 CFLAGS
+= -D_ALL_SOURCE
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
65 LDFLAGS_VIS
= $(LDFLAGS_LIBS
)
67 DEBUG_CFLAGS_VIS
= ${CFLAGS_VIS} -UNDEBUG
-O0
-g
-ggdb
-Wall
-Wextra
-Wno-missing-field-initializers
-Wno-unused-parameter
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