config.mk 1.36 KB
Newer Older
Marek Vavruša's avatar
Marek Vavruša committed
1
# Project
2
MAJOR := 1
Vladimír Čunát's avatar
Vladimír Čunát committed
3
MINOR := 5
Vladimír Čunát's avatar
Vladimír Čunát committed
4
PATCH := 2
Vladimír Čunát's avatar
Vladimír Čunát committed
5
EXTRA :=
6
ABIVER := 4
7
BUILDMODE := dynamic
8
HARDENING := yes
Marek Vavruša's avatar
Marek Vavruša committed
9

Ondřej Surý's avatar
Ondřej Surý committed
10
VERSION := $(MAJOR).$(MINOR).$(PATCH)$(EXTRA)
11

Marek Vavruša's avatar
Marek Vavruša committed
12
# Paths
13 14 15 16
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
SBINDIR ?= $(PREFIX)/sbin
LIBDIR ?= $(PREFIX)/lib
17 18
PKGCONFIGDIR ?= $(LIBDIR)/pkgconfig
MANDIR ?= $(PREFIX)/share/man
19 20
INCLUDEDIR ?= $(PREFIX)/include
MODULEDIR ?= $(LIBDIR)/kdns_modules
21
ETCDIR ?= $(PREFIX)/etc/knot-resolver
Vladimír Čunát's avatar
Vladimír Čunát committed
22
ROOTHINTS ?= $(ETCDIR)/root.hints
23
COVERAGE_STAGE ?= gcov
24 25
COVERAGE_STATSDIR ?= $(CURDIR)/coverage.stats
TOPSRCDIR := $(CURDIR)
26
KEYFILE_DEFAULT ?=
Marek Vavruša's avatar
Marek Vavruša committed
27 28

# Tools
29 30
CC      ?= cc
RM      := rm -f
31
LN      := ln -s
32
XXD_LUA := ./scripts/embed-lua.sh
Marek Vavruša's avatar
Marek Vavruša committed
33
INSTALL := install
34 35

# Flags
36
BUILD_LDFLAGS += $(LDFLAGS)
Vladimír Čunát's avatar
Vladimír Čunát committed
37 38 39
BUILD_CFLAGS := $(CFLAGS) -std=c99 -D_GNU_SOURCE
BUILD_CFLAGS += -Wno-unused -Wtype-limits -Wformat -Wformat-security -Wall
BUILD_CFLAGS += -I$(abspath .) -I$(abspath lib/generic) -I$(abspath contrib)
40
BUILD_CFLAGS += -DPACKAGE_VERSION="\"$(VERSION)\"" -DPREFIX="\"$(PREFIX)\"" -DMODULEDIR="\"$(MODULEDIR)\""
41
BUILD_CFLAGS += -fvisibility=hidden
42 43

# Otherwise Fedora is making kresd symbols inaccessible for modules
44
# TODO: clang needs different flag name, etc.
45 46 47
BUILD_CFLAGS += -rdynamic
BUILD_LDFLAGS += -export-dynamic

48 49
ifeq (,$(findstring -O,$(CFLAGS)))
	BUILD_CFLAGS += -O2
50 51 52
endif
ifeq (,$(findstring -fsanitize=address,$(CFLAGS)))
	BUILD_CFLAGS += -D_FORTIFY_SOURCE=2
Marek Vavrusa's avatar
Marek Vavrusa committed
53
endif