mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 07:35:59 +01:00
Query pkg-config only once for libs and cflags
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
parent
1bf887edc5
commit
66805ec2eb
3 changed files with 38 additions and 30 deletions
6
Makefile
6
Makefile
|
@ -10,22 +10,16 @@ OSOURCE = $(sort $(wildcard ${PROJECT}/*.c) \
|
|||
SOURCE_FILTER =
|
||||
|
||||
ifneq (${WITH_SQLITE},0)
|
||||
INCS += $(SQLITE_INC)
|
||||
LIBS += $(SQLITE_LIB)
|
||||
CPPFLAGS += -DWITH_SQLITE
|
||||
else
|
||||
SOURCE_FILTER += ${PROJECT}/database-sqlite.c
|
||||
endif
|
||||
|
||||
ifneq ($(WITH_MAGIC),0)
|
||||
INCS += $(MAGIC_INC)
|
||||
LIBS += $(MAGIC_LIB)
|
||||
CPPFLAGS += -DWITH_MAGIC
|
||||
endif
|
||||
|
||||
ifneq ($(WITH_SYNCTEX),0)
|
||||
INCS += $(SYNCTEX_INC)
|
||||
LIBS += $(SYNCTEX_LIB)
|
||||
CPPFLAGS += -DWITH_SYNCTEX
|
||||
endif
|
||||
|
||||
|
|
56
config.mk
56
config.mk
|
@ -74,38 +74,58 @@ PLUGINDIR ?= ${LIBDIR}/zathura
|
|||
LOCALEDIR ?= ${PREFIX}/share/locale
|
||||
|
||||
# libs
|
||||
GTK_INC ?= $(shell ${PKG_CONFIG} --cflags gtk+-3.0)
|
||||
GTK_LIB ?= $(shell ${PKG_CONFIG} --libs gtk+-3.0)
|
||||
ifeq (${GTK_INC}-${GTK_LIB},-)
|
||||
PKG_CONFIG_LIBS += gtk+-3.0
|
||||
else
|
||||
INCS += ${GTK_INC}
|
||||
LIBS += ${GTK_LIB}
|
||||
endif
|
||||
|
||||
GTHREAD_INC ?= $(shell ${PKG_CONFIG} --cflags gthread-2.0)
|
||||
GTHREAD_LIB ?= $(shell ${PKG_CONFIG} --libs gthread-2.0)
|
||||
ifeq (${GLIB_INC}-${GLIB_LIB},-)
|
||||
PKG_CONFIG_LIBS += gthread-2.0 gmodule-no-export-2.0 glib-2.0
|
||||
else
|
||||
INCS += ${GLIB_INC}
|
||||
LIBS += ${GLIB_LIB}
|
||||
endif
|
||||
|
||||
GMODULE_INC ?= $(shell ${PKG_CONFIG} --cflags gmodule-no-export-2.0)
|
||||
GMODULE_LIB ?= $(shell ${PKG_CONFIG} --libs gmodule-no-export-2.0)
|
||||
|
||||
GLIB_INC ?= $(shell ${PKG_CONFIG} --cflags glib-2.0)
|
||||
GLIB_LIB ?= $(shell ${PKG_CONFIG} --libs glib-2.0)
|
||||
|
||||
GIRARA_INC ?= $(shell ${PKG_CONFIG} --cflags girara-gtk3)
|
||||
GIRARA_LIB ?= $(shell ${PKG_CONFIG} --libs girara-gtk3)
|
||||
ifeq (${GIRARA_INC}-${GIRARA_LIB},-)
|
||||
PKG_CONFIG_LIBS += girara-gtk3
|
||||
else
|
||||
INCS += ${GIRARA_INC}
|
||||
LIBS += ${GIRARA_LIB}
|
||||
endif
|
||||
|
||||
ifneq (${WITH_SQLITE},0)
|
||||
SQLITE_INC ?= $(shell ${PKG_CONFIG} --cflags sqlite3)
|
||||
SQLITE_LIB ?= $(shell ${PKG_CONFIG} --libs sqlite3)
|
||||
ifeq (${SQLITE_INC}-${SQLITE_LIB},-)
|
||||
PKG_CONFIG_LIBS += sqlite3
|
||||
else
|
||||
INCS += ${SQLITE_INC}
|
||||
LIBS += ${SQLITE_LIB}
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (${WITH_MAGIC},0)
|
||||
MAGIC_INC ?=
|
||||
MAGIC_LIB ?= -lmagic
|
||||
|
||||
INCS += ${MAGIC_INC}
|
||||
LIBS += ${MAGIC_LIB}
|
||||
endif
|
||||
|
||||
ifneq ($(WITH_SYNCTEX),0)
|
||||
SYNCTEX_INC ?= $(shell ${PKG_CONFIG} --cflags synctex)
|
||||
SYNCTEX_LIB ?= $(shell ${PKG_CONFIG} --libs synctex)
|
||||
ifeq (${SYNCTEX_INC}-${SYNCTEX_LIB},-)
|
||||
PKG_CONFIG_LIBS += synctex
|
||||
else
|
||||
INCS += ${SYNCTEX_INC}
|
||||
LIBS += ${SYNCTEX_LIB}
|
||||
endif
|
||||
endif
|
||||
|
||||
INCS = ${GIRARA_INC} ${GTK_INC} ${GTHREAD_INC} ${GMODULE_INC} ${GLIB_INC}
|
||||
LIBS = ${GIRARA_LIB} ${GTK_LIB} ${GTHREAD_LIB} ${GMODULE_LIB} ${GLIB_LIB} -lpthread -lm
|
||||
ifneq (${PKG_CONFIG_LIBS},)
|
||||
INCS += $(shell ${PKG_CONFIG} --cflags ${PKG_CONFIG_LIBS})
|
||||
LIBS += $(shell ${PKG_CONFIG} --libs ${PKG_CONFIG_LIBS})
|
||||
endif
|
||||
LIBS += -lpthread -lm
|
||||
|
||||
# pre-processor flags
|
||||
CPPFLAGS += -D_FILE_OFFSET_BITS=64
|
||||
|
|
|
@ -15,22 +15,16 @@ OBJECTS_GCOV = $(addprefix ${BUILDDIR_GCOV}/,${SOURCE:.c=.o})
|
|||
FILTER = %/main.o
|
||||
|
||||
ifneq (${WITH_SQLITE},0)
|
||||
INCS += $(SQLITE_INC)
|
||||
LIBS += $(SQLITE_LIB)
|
||||
CPPFLAGS += -DWITH_SQLITE
|
||||
else
|
||||
FILTER += %/database-sqlite.o
|
||||
endif
|
||||
|
||||
ifneq ($(WITH_MAGIC),0)
|
||||
INCS += $(MAGIC_INC)
|
||||
LIBS += $(MAGIC_LIB)
|
||||
CPPFLAGS += -DWITH_MAGIC
|
||||
endif
|
||||
|
||||
ifneq ($(WITH_SYNCTEX),0)
|
||||
INCS += $(SYNCTEX_INC)
|
||||
LIBS += $(SYNCTEX_LIB)
|
||||
CPPFLAGS += -DWITH_SYNCTEX
|
||||
endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue