Makefile: use PKG_CONFIG to get static compilation flags as well

This commit is contained in:
Maxime Coste 2018-02-18 15:43:28 +11:00
parent f8861734cf
commit eb2e44e0eb

View File

@ -26,6 +26,11 @@ deps := $(addprefix ., $(sources:.cc=$(suffix).d))
PKG_CONFIG ?= $(shell command -v pkg-config 2>/dev/null) PKG_CONFIG ?= $(shell command -v pkg-config 2>/dev/null)
ifeq ($(static),yes)
PKG_CONFIG_FLAGS += -static
LDFLAGS += -static -pthread
endif
PREFIX ?= /usr/local PREFIX ?= /usr/local
DESTDIR ?= # root dir DESTDIR ?= # root dir
@ -58,16 +63,11 @@ else
$(error "pkg-config not found in PATH") $(error "pkg-config not found in PATH")
endif endif
LIBS += $(shell $(PKG_CONFIG) --libs ncursesw) LIBS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs ncursesw)
CPPFLAGS += $(shell $(PKG_CONFIG) --cflags ncursesw) CPPFLAGS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags ncursesw)
LDFLAGS += -rdynamic LDFLAGS += -rdynamic
endif endif
ifeq ($(static),yes)
LIBS += -ltinfo -lgpm
LDFLAGS += -static -pthread
endif
CXXFLAGS += -pedantic -std=gnu++14 -g -Wall -Wextra -Wno-unused-parameter -Wno-reorder -Wno-sign-compare -Wno-address -Wno-noexcept-type -Wno-unknown-attributes -Wno-unknown-warning-option CXXFLAGS += -pedantic -std=gnu++14 -g -Wall -Wextra -Wno-unused-parameter -Wno-reorder -Wno-sign-compare -Wno-address -Wno-noexcept-type -Wno-unknown-attributes -Wno-unknown-warning-option
all : kak all : kak