mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 23:36:00 +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 =
|
SOURCE_FILTER =
|
||||||
|
|
||||||
ifneq (${WITH_SQLITE},0)
|
ifneq (${WITH_SQLITE},0)
|
||||||
INCS += $(SQLITE_INC)
|
|
||||||
LIBS += $(SQLITE_LIB)
|
|
||||||
CPPFLAGS += -DWITH_SQLITE
|
CPPFLAGS += -DWITH_SQLITE
|
||||||
else
|
else
|
||||||
SOURCE_FILTER += ${PROJECT}/database-sqlite.c
|
SOURCE_FILTER += ${PROJECT}/database-sqlite.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(WITH_MAGIC),0)
|
ifneq ($(WITH_MAGIC),0)
|
||||||
INCS += $(MAGIC_INC)
|
|
||||||
LIBS += $(MAGIC_LIB)
|
|
||||||
CPPFLAGS += -DWITH_MAGIC
|
CPPFLAGS += -DWITH_MAGIC
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(WITH_SYNCTEX),0)
|
ifneq ($(WITH_SYNCTEX),0)
|
||||||
INCS += $(SYNCTEX_INC)
|
|
||||||
LIBS += $(SYNCTEX_LIB)
|
|
||||||
CPPFLAGS += -DWITH_SYNCTEX
|
CPPFLAGS += -DWITH_SYNCTEX
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
56
config.mk
56
config.mk
|
@ -74,38 +74,58 @@ PLUGINDIR ?= ${LIBDIR}/zathura
|
||||||
LOCALEDIR ?= ${PREFIX}/share/locale
|
LOCALEDIR ?= ${PREFIX}/share/locale
|
||||||
|
|
||||||
# libs
|
# libs
|
||||||
GTK_INC ?= $(shell ${PKG_CONFIG} --cflags gtk+-3.0)
|
ifeq (${GTK_INC}-${GTK_LIB},-)
|
||||||
GTK_LIB ?= $(shell ${PKG_CONFIG} --libs gtk+-3.0)
|
PKG_CONFIG_LIBS += gtk+-3.0
|
||||||
|
else
|
||||||
|
INCS += ${GTK_INC}
|
||||||
|
LIBS += ${GTK_LIB}
|
||||||
|
endif
|
||||||
|
|
||||||
GTHREAD_INC ?= $(shell ${PKG_CONFIG} --cflags gthread-2.0)
|
ifeq (${GLIB_INC}-${GLIB_LIB},-)
|
||||||
GTHREAD_LIB ?= $(shell ${PKG_CONFIG} --libs gthread-2.0)
|
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)
|
ifeq (${GIRARA_INC}-${GIRARA_LIB},-)
|
||||||
GMODULE_LIB ?= $(shell ${PKG_CONFIG} --libs gmodule-no-export-2.0)
|
PKG_CONFIG_LIBS += girara-gtk3
|
||||||
|
else
|
||||||
GLIB_INC ?= $(shell ${PKG_CONFIG} --cflags glib-2.0)
|
INCS += ${GIRARA_INC}
|
||||||
GLIB_LIB ?= $(shell ${PKG_CONFIG} --libs glib-2.0)
|
LIBS += ${GIRARA_LIB}
|
||||||
|
endif
|
||||||
GIRARA_INC ?= $(shell ${PKG_CONFIG} --cflags girara-gtk3)
|
|
||||||
GIRARA_LIB ?= $(shell ${PKG_CONFIG} --libs girara-gtk3)
|
|
||||||
|
|
||||||
ifneq (${WITH_SQLITE},0)
|
ifneq (${WITH_SQLITE},0)
|
||||||
SQLITE_INC ?= $(shell ${PKG_CONFIG} --cflags sqlite3)
|
ifeq (${SQLITE_INC}-${SQLITE_LIB},-)
|
||||||
SQLITE_LIB ?= $(shell ${PKG_CONFIG} --libs sqlite3)
|
PKG_CONFIG_LIBS += sqlite3
|
||||||
|
else
|
||||||
|
INCS += ${SQLITE_INC}
|
||||||
|
LIBS += ${SQLITE_LIB}
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (${WITH_MAGIC},0)
|
ifneq (${WITH_MAGIC},0)
|
||||||
MAGIC_INC ?=
|
MAGIC_INC ?=
|
||||||
MAGIC_LIB ?= -lmagic
|
MAGIC_LIB ?= -lmagic
|
||||||
|
|
||||||
|
INCS += ${MAGIC_INC}
|
||||||
|
LIBS += ${MAGIC_LIB}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(WITH_SYNCTEX),0)
|
ifneq ($(WITH_SYNCTEX),0)
|
||||||
SYNCTEX_INC ?= $(shell ${PKG_CONFIG} --cflags synctex)
|
ifeq (${SYNCTEX_INC}-${SYNCTEX_LIB},-)
|
||||||
SYNCTEX_LIB ?= $(shell ${PKG_CONFIG} --libs synctex)
|
PKG_CONFIG_LIBS += synctex
|
||||||
|
else
|
||||||
|
INCS += ${SYNCTEX_INC}
|
||||||
|
LIBS += ${SYNCTEX_LIB}
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
INCS = ${GIRARA_INC} ${GTK_INC} ${GTHREAD_INC} ${GMODULE_INC} ${GLIB_INC}
|
ifneq (${PKG_CONFIG_LIBS},)
|
||||||
LIBS = ${GIRARA_LIB} ${GTK_LIB} ${GTHREAD_LIB} ${GMODULE_LIB} ${GLIB_LIB} -lpthread -lm
|
INCS += $(shell ${PKG_CONFIG} --cflags ${PKG_CONFIG_LIBS})
|
||||||
|
LIBS += $(shell ${PKG_CONFIG} --libs ${PKG_CONFIG_LIBS})
|
||||||
|
endif
|
||||||
|
LIBS += -lpthread -lm
|
||||||
|
|
||||||
# pre-processor flags
|
# pre-processor flags
|
||||||
CPPFLAGS += -D_FILE_OFFSET_BITS=64
|
CPPFLAGS += -D_FILE_OFFSET_BITS=64
|
||||||
|
|
|
@ -15,22 +15,16 @@ OBJECTS_GCOV = $(addprefix ${BUILDDIR_GCOV}/,${SOURCE:.c=.o})
|
||||||
FILTER = %/main.o
|
FILTER = %/main.o
|
||||||
|
|
||||||
ifneq (${WITH_SQLITE},0)
|
ifneq (${WITH_SQLITE},0)
|
||||||
INCS += $(SQLITE_INC)
|
|
||||||
LIBS += $(SQLITE_LIB)
|
|
||||||
CPPFLAGS += -DWITH_SQLITE
|
CPPFLAGS += -DWITH_SQLITE
|
||||||
else
|
else
|
||||||
FILTER += %/database-sqlite.o
|
FILTER += %/database-sqlite.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(WITH_MAGIC),0)
|
ifneq ($(WITH_MAGIC),0)
|
||||||
INCS += $(MAGIC_INC)
|
|
||||||
LIBS += $(MAGIC_LIB)
|
|
||||||
CPPFLAGS += -DWITH_MAGIC
|
CPPFLAGS += -DWITH_MAGIC
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(WITH_SYNCTEX),0)
|
ifneq ($(WITH_SYNCTEX),0)
|
||||||
INCS += $(SYNCTEX_INC)
|
|
||||||
LIBS += $(SYNCTEX_LIB)
|
|
||||||
CPPFLAGS += -DWITH_SYNCTEX
|
CPPFLAGS += -DWITH_SYNCTEX
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue