summaryrefslogtreecommitdiff
path: root/src/Makefile
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2016-06-13 07:19:44 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2016-06-13 09:32:02 +0000
commit98a13624a1559c201bb96ca9db71dc74324396b1 (patch)
tree8db3f939655da377c1e5101969ee8194f804f017 /src/Makefile
parent5906aef6958208b9705083ad56881fc63a326dff (diff)
downloadapk-tools-98a13624a1559c201bb96ca9db71dc74324396b1.tar.gz
apk-tools-98a13624a1559c201bb96ca9db71dc74324396b1.tar.bz2
apk-tools-98a13624a1559c201bb96ca9db71dc74324396b1.tar.xz
apk-tools-98a13624a1559c201bb96ca9db71dc74324396b1.zip
build: allow override compiler/linker flags for external libs
Make it possible to individually override openssl, zlib and libfetch cflags and linker flags. This makes it possible to build apk-tools without having pkg-config installed.
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/Makefile b/src/Makefile
index 250d2f0..72450f2 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,7 +1,14 @@
-PKGDEPS := openssl zlib
PKG_CONFIG ?= pkg-config
LUAAPK ?= yes
+OPENSSL_CFLAGS := $(shell $(PKG_CONFIG) --cflags openssl)
+OPENSSL_LIBS := $(shell $(PKG_CONFIG) --libs openssl)
+
+ZLIB_CFLAGS := $(shell $(PKG_CONFIG) --cflags zlib)
+ZLIB_LIBS := $(shell $(PKG_CONFIG) --libs zlib)
+
+FETCH_LIBS := /usr/lib/libfetch.a
+
# lua module
ifneq ($(LUAAPK),)
LUA_VERSION ?= 5.2
@@ -17,10 +24,6 @@ install-LUA_LIB-y := $(INSTALLDIR) $(DESTDIR)$(LUA_LIBDIR) && \
$(INSTALL) $(LUA_LIB-y) $(DESTDIR)$(LUA_LIBDIR)
endif
-ifeq ($(shell $(PKG_CONFIG) --print-errors --exists $(PKGDEPS) || echo fail),fail)
-$(error Build dependencies are not met)
-endif
-
progs-y += apk
apk-objs := apk.o add.o del.o fix.o update.o info.o \
search.o upgrade.o cache.o ver.o index.o fetch.o \
@@ -65,10 +68,9 @@ LIBS_apk.static := -Wl,--as-needed -ldl -Wl,--no-as-needed
LDFLAGS_apk += -L$(obj)
LDFLAGS_apk-test += -L$(obj)
-CFLAGS_ALL += $(shell $(PKG_CONFIG) --cflags $(PKGDEPS))
-LIBS := /usr/lib/libfetch.a \
- -Wl,--as-needed \
- $(shell $(PKG_CONFIG) --libs $(PKGDEPS)) \
+CFLAGS_ALL += $(OPENSSL_CFLAGS) $(ZLIB_CFLAGS)
+LIBS := -Wl,--as-needed \
+ $(FETCH_LIBS) $(OPENSSL_LIBS) $(ZLIB_LIBS) \
-Wl,--no-as-needed
$(obj)/apk: $(LIBAPK-y)