summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/Makefile18
-rwxr-xr-xconfigure24
-rw-r--r--plugin/Makefile10
3 files changed, 38 insertions, 14 deletions
diff --git a/client/Makefile b/client/Makefile
index 9eac86d..ec66b0b 100644
--- a/client/Makefile
+++ b/client/Makefile
@@ -21,12 +21,11 @@
#
CFLAGS ?= -O2 -g
-COMMONCFLAGS=$(CFLAGS) -Wall -Wextra -std=c99 -pedantic -Wno-unused-parameter
-PKG_DEPS=$(if $(WITH_GTK2),'gtk+-2.0 >= 2.18' gdk-2.0) $(if $(WITH_GTK3),gtk+-3.0) glib-2.0 gthread-2.0 $(if $(ENABLE_PKCS11),libp11) libcrypto
-CCFLAGS=$(COMMONCFLAGS) -I../npapi/include `pkg-config --cflags $(PKG_DEPS)` -DGTK_DISABLE_DEPRECATED=1 -DGDK_DISABLE_DEPRECATED=1 -DG_DISABLE_DEPRECATED=1 -DGSEAL_ENABLE -DFRIBID_CLIENT
+PKGCONFIG_CFLAGS=`../configure --internal--get-pc-cflags`
+CCFLAGS:=$(CFLAGS) -Wall -Wextra -std=c99 -pedantic -Wno-unused-parameter -I../npapi/include $(PKGCONFIG_CFLAGS) -DGTK_DISABLE_DEPRECATED=1 -DGDK_DISABLE_DEPRECATED=1 -DG_DISABLE_DEPRECATED=1 -DGSEAL_ENABLE -DFRIBID_CLIENT
# You may have to add -lpthread after $(LDFLAGS) on OpenBSD
-LINKFLAGS=$(CFLAGS) $(LDFLAGS) -Wl,--as-needed
-LIBS=`pkg-config --libs $(PKG_DEPS)`
+LINKFLAGS:=$(CFLAGS) $(LDFLAGS) -Wl,--as-needed
+LIBS=`../configure --internal--get-pc-libs`
# Files to be installed
LIBEXEC_PATH=`../configure --internal--get-define=LIBEXEC_PATH`
@@ -34,11 +33,12 @@ SHARE_PATH=`../configure --internal--get-define=SHARE_PATH`
UI_PATH=`../configure --internal--get-define=UI_PATH`
SIGNING_EXECUTABLE=`../configure --internal--get-define=SIGNING_EXECUTABLE`
UI_GTK_XML=`../configure --internal--get-define=UI_GTK_XML`
-ENABLE_PKCS11=$(shell ../configure --internal--get-define=ENABLE_PKCS11|grep 1)
-WITH_GTK2=$(shell ../configure --internal--get-define=WITH_GTK2|grep 1)
-WITH_GTK3=$(shell ../configure --internal--get-define=WITH_GTK3|grep 1)
-OBJECTS=backend.o bankid.o certutil.o $(if $(ENABLE_PKCS11),pkcs11.o) pkcs12.o request.o main.o misc.o pipe.o posix.o prefs.o glibconfig.o gtk.o xmldsig.o secmem.o
+# Object files. The != assignment is interpreted by BSD make only, and the second one is interpreted by GNU make only
+# The `...` syntax does not seem to work with dependencis
+EXTRA_OBJECTS!=../configure --internal--list-extra-objects
+EXTRA_OBJECTS?=$(shell ../configure --internal--list-extra-objects)
+OBJECTS:=backend.o bankid.o certutil.o pkcs12.o request.o main.o misc.o pipe.o posix.o prefs.o glibconfig.o gtk.o xmldsig.o secmem.o $(EXTRA_OBJECTS)
all: sign gtk/sign.xml
diff --git a/configure b/configure
index b8fd735..2e70f8b 100755
--- a/configure
+++ b/configure
@@ -81,6 +81,10 @@ error=""
basedir=`dirname "$0"`
+getconfig() {
+ printf '#define CALLED_FROM_CONFIGURE\n#include "%s"\n%s\n' "$basedir/common/defines.h" "$1" | cpp - | sed 's/#.*$//g' | tr -d '\n' | sed 's/" "//g' | tr -d '\"'
+}
+
while [ "$#" != "0" ]; do
flag="$1"
shift
@@ -188,9 +192,27 @@ Options:
--internal--get-define=*)
name=${flag#--internal--get-define=}
[ ! -r "$basedir/common/config.h" ] && exit 1 # Exit if not configured yet
- printf '#define CALLED_FROM_CONFIGURE\n#include "%s"\n%s\n' "$basedir/common/defines.h" "$name" | cpp - | sed 's/#.*$//g' | tr -d '\n' | sed 's/" "//g' | tr -d '\"'
+ getconfig "$name"
exit 0
;;
+ --internal--get-pc-cflags|--internal--get-pc-libs)
+ [ ! -r "$basedir/common/config.h" ] && exit 1
+ gtk2libs=$([ "x`getconfig WITH_GTK2`" = "x1" ] && echo "'gtk+-2.0 >= 2.18' gdk-2.0")
+ gtk3libs=$([ "x`getconfig WITH_GTK3`" = "x1" ] && echo "gtk+-3.0")
+ pkcs11libs=$([ "x`getconfig ENABLE_PKCS11`" = "x1" ] && echo "libp11")
+ if [ "x$flag" = "x--internal--get-pc-cflags" ]; then
+ flags="--cflags"
+ else
+ flags="--libs --cflags"
+ fi
+ pkg-config $flags glib-2.0 gthread-2.0 libcrypto $gtk2libs $gtk3libs $pkcs11libs
+ exit
+ ;;
+ --internal--list-extra-objects)
+ [ ! -r "$basedir/common/config.h" ] && exit 1
+ [ "x`getconfig ENABLE_PKCS11`" = "x1" ] && echo "pkcs11.o"
+ exit
+ ;;
--internal--remove-link)
link="$1"
target="$2"
diff --git a/plugin/Makefile b/plugin/Makefile
index 781717f..21b3eff 100644
--- a/plugin/Makefile
+++ b/plugin/Makefile
@@ -21,10 +21,12 @@
#
CFLAGS ?= -O2 -g
-COMMONCFLAGS=$(CFLAGS) -Wall -Wextra -std=c99 -pedantic -Wno-unused-parameter
-CCFLAGS=$(COMMONCFLAGS) -I../npapi -fPIC -fvisibility=hidden `pkg-config --cflags glib-2.0 x11` -DG_DISABLE_DEPRECATED=1 -DGSEAL_ENABLE -DFRIBID_PLUGIN
-LINKFLAGS=$(CFLAGS) $(LDFLAGS) -Wl,-z,defs,-soname,libfribidplugin.so
-LIBS=-lc `pkg-config --libs glib-2.0`
+PKGCONFIG_CFLAGS=`pkg-config --cflags glib-2.0 x11`
+CCFLAGS:=$(CFLAGS) -Wall -Wextra -std=c99 -pedantic -Wno-unused-parameter -I../npapi -fPIC -fvisibility=hidden $(PKGCONFIG_CFLAGS) -DG_DISABLE_DEPRECATED=1 -DGSEAL_ENABLE -DFRIBID_PLUGIN
+
+LINKFLAGS:=$(CFLAGS) $(LDFLAGS) -Wl,-z,defs,-soname,libfribidplugin.so
+PKGCONFIG_LIBS=`pkg-config --libs glib-2.0`
+LIBS:=-lc $(PKGCONFIG_LIBS)
# Files to be installed
LIB_PATH=`../configure --internal--get-define=LIB_PATH`