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)