aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJannis Teunissen <jannis@teunissen.net>2019-05-01 22:20:19 +0200
committerJannis Teunissen <jannis@teunissen.net>2019-05-01 22:20:19 +0200
commitc0be644d82e659f11b7bd7679342cd14bacddbb5 (patch)
tree512b0a4a92a4c16926032e7921764f4520f630ef
parent33802dc273fa976a07b9b3bff4fc68ac40a018a9 (diff)
downloadpurple-matrix-c0be644d82e659f11b7bd7679342cd14bacddbb5.tar.gz
Abort if pkg-config returns an error
Before, if one of the packages was not found, CFLAGS was not updated, which led to unexpected error messages.
-rw-r--r--Makefile16
1 files changed, 14 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index b9716cd..66e7ff0 100644
--- a/Makefile
+++ b/Makefile
@@ -4,9 +4,21 @@ CC=gcc
LIBS=purple json-glib-1.0 glib-2.0 sqlite3
PKG_CONFIG=pkg-config
-CFLAGS+=$(shell $(PKG_CONFIG) --cflags $(LIBS))
+
+PKG_CFLAGS=$(shell $(PKG_CONFIG) --cflags $(LIBS) || echo "FAILED")
+ifeq ($(PKG_CFLAGS),FAILED)
+$(error "$(PKG_CONFIG) failed")
+else
+CFLAGS+=$(PKG_CFLAGS)
+endif
CFLAGS+=-fPIC -DPIC
-LDLIBS+=$(shell $(PKG_CONFIG) --libs $(LIBS))
+
+PKG_LDLIBS=$(shell $(PKG_CONFIG) --libs $(LIBS) || echo "FAILED")
+ifeq ($(PKG_LDLIBS),FAILED)
+$(error "$(PKG_CONFIG) failed")
+else
+LDLIBS+=$(PKG_LDLIBS)
+endif
LDLIBS+=-lhttp_parser
ifndef MATRIX_NO_E2E