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
28 CFLAGS_TERMKEY
= $(shell pkg-config
--cflags termkey
2> /dev
/null || echo
"")
29 CFLAGS_CURSES
= $(shell pkg-config
--cflags ncursesw
2> /dev
/null || echo
"-I/usr/include/ncursesw")
31 LDFLAGS_TERMKEY
= $(shell pkg-config
--libs termkey
2> /dev
/null || echo
"-ltermkey")
32 LDFLAGS_CURSES
= $(shell pkg-config
--libs ncursesw
2> /dev
/null || echo
"-lncursesw")
38 ifeq (${HAVE_SELINUX},1)
39 CFLAGS
+= -DHAVE_SELINUX
46 else ifeq (${OS},Darwin
)
47 CFLAGS
+= -D_DARWIN_C_SOURCE
48 else ifeq (${OS},OpenBSD
)
49 CFLAGS
+= -D_BSD_SOURCE
50 else ifeq (${OS},FreeBSD
)
51 CFLAGS
+= -D_BSD_SOURCE
52 else ifeq (${OS},NetBSD
)
53 CFLAGS
+= -D_BSD_SOURCE
55 CFLAGS
+= -D_ALL_SOURCE
58 CFLAGS_LIBS
= $(CFLAGS_TERMKEY
) $(CFLAGS_CURSES
)
59 LDFLAGS_LIBS
= $(LDFLAGS_TERMKEY
) $(LDFLAGS_CURSES
) $(LIBS
)
61 CFLAGS_VIS
= $(CFLAGS_LIBS
) -std
=c99
-Os
-DVERSION
=\"${VERSION}\" -DNDEBUG
-D_POSIX_C_SOURCE
=200809L -D_XOPEN_SOURCE
=700
62 LDFLAGS_VIS
= $(LDFLAGS_LIBS
)
64 DEBUG_CFLAGS_VIS
= ${CFLAGS_VIS} -UNDEBUG
-O0
-g
-ggdb
-Wall
-Wextra
-Wno-missing-field-initializers
-Wno-unused-parameter
71 CFLAGS
+= -fPIC
-fstack-protector-all
-D_FORTIFY_SOURCE
=2
72 LDFLAGS
+= -z now
-z relro
-pie
73 else ifeq (${CC},clang
)
74 CFLAGS
+= -fPIE
-fstack-protector-all
-D_FORTIFY_SOURCE
=2
75 LDFLAGS
+= -z now
-z relro
-pie