2011-07-27 05:56:38 +00:00
|
|
|
PKG_CONFIG ?= pkg-config
|
2012-02-28 12:36:03 +00:00
|
|
|
LUAAPK ?= yes
|
2009-07-08 06:50:21 +00:00
|
|
|
|
2016-06-13 07:19:44 +00:00
|
|
|
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)
|
|
|
|
|
2016-07-06 11:17:31 +00:00
|
|
|
FETCH_LIBS := $(shell $(CC) -print-file-name=libfetch.a)
|
2016-06-13 07:19:44 +00:00
|
|
|
|
2010-06-14 09:41:06 +00:00
|
|
|
# lua module
|
|
|
|
ifneq ($(LUAAPK),)
|
2013-06-26 14:42:10 +00:00
|
|
|
LUA_VERSION ?= 5.2
|
|
|
|
LUA_PC ?= lua$(LUA_VERSION)
|
|
|
|
LUA_LIBDIR ?= /usr/lib/lua/$(LUA_VERSION)
|
2010-06-14 09:41:06 +00:00
|
|
|
LIBAPK := YesPlease
|
2010-03-06 19:07:38 +00:00
|
|
|
shlibs-y += apk.so
|
|
|
|
apk.so-objs := lua-apk.o
|
2013-06-26 14:42:10 +00:00
|
|
|
CFLAGS_lua-apk.o := -DAPK_VERSION=\"$(FULL_VERSION)\" \
|
|
|
|
$(shell $(PKG_CONFIG) $(LUA_PC) --cflags)
|
2010-06-14 09:41:06 +00:00
|
|
|
LUA_LIB-y := $(obj)/apk.so
|
2011-09-16 07:12:45 +00:00
|
|
|
install-LUA_LIB-y := $(INSTALLDIR) $(DESTDIR)$(LUA_LIBDIR) && \
|
2010-06-14 09:41:06 +00:00
|
|
|
$(INSTALL) $(LUA_LIB-y) $(DESTDIR)$(LUA_LIBDIR)
|
|
|
|
endif
|
2010-03-06 19:07:38 +00:00
|
|
|
|
2009-04-16 10:49:16 +00:00
|
|
|
progs-y += apk
|
2011-09-13 08:47:34 +00:00
|
|
|
apk-objs := apk.o add.o del.o fix.o update.o info.o \
|
2010-03-05 08:13:25 +00:00
|
|
|
search.o upgrade.o cache.o ver.o index.o fetch.o \
|
2015-06-12 08:20:01 +00:00
|
|
|
audit.o verify.o dot.o policy.o stats.o
|
2010-03-05 08:13:25 +00:00
|
|
|
|
2011-09-09 13:31:11 +00:00
|
|
|
libapk.so-objs := common.o database.o package.o archive.o \
|
2011-07-26 13:56:55 +00:00
|
|
|
version.o io.o url.o gunzip.o blob.o hash.o print.o \
|
2013-06-11 11:06:06 +00:00
|
|
|
commit.o solver.o
|
2011-07-26 13:56:55 +00:00
|
|
|
|
|
|
|
ifeq ($(TEST),y)
|
2012-02-23 20:02:11 +00:00
|
|
|
progs-y += apk-test
|
|
|
|
apk-test-objs := apk-test.o $(filter-out apk.o, $(apk-objs))
|
2011-07-26 13:56:55 +00:00
|
|
|
endif
|
2010-06-14 09:41:06 +00:00
|
|
|
|
|
|
|
ifeq ($(SHARED_LIBAPK),)
|
|
|
|
apk-objs += $(libapk.so-objs)
|
2012-02-23 20:02:11 +00:00
|
|
|
apk-test-objs += $(libapk.so-objs)
|
2011-09-14 14:16:19 +00:00
|
|
|
apk.so-objs += $(libapk.so-objs)
|
2010-06-14 09:41:06 +00:00
|
|
|
else
|
|
|
|
LIBAPK := YesPlease
|
|
|
|
LIBS_apk := -lapk
|
2012-02-23 20:02:11 +00:00
|
|
|
LIBS_apk-test := -lapk
|
2011-09-14 14:16:19 +00:00
|
|
|
LIBS_apk.so := -L$(obj) -lapk
|
2010-06-14 09:41:06 +00:00
|
|
|
endif
|
|
|
|
|
2011-09-14 14:16:19 +00:00
|
|
|
ifneq ($(SHARED_LIBAPK),)
|
2010-06-14 09:41:06 +00:00
|
|
|
shlibs-y += libapk.so
|
|
|
|
LIBAPK-y := $(obj)/libapk.so
|
2011-09-16 07:12:45 +00:00
|
|
|
install-LIBAPK-y := $(INSTALLDIR) $(DESTDIR)$(LIBDIR) && \
|
2010-06-14 09:41:06 +00:00
|
|
|
$(INSTALL) $(LIBAPK-y) $(DESTDIR)$(LIBDIR)
|
|
|
|
endif
|
|
|
|
|
2010-06-11 10:41:52 +00:00
|
|
|
CFLAGS_ALL += -D_ATFILE_SOURCE
|
2009-04-16 10:49:16 +00:00
|
|
|
CFLAGS_apk.o := -DAPK_VERSION=\"$(FULL_VERSION)\"
|
2010-06-30 13:53:56 +00:00
|
|
|
CFLAGS_apk-static.o := -DAPK_VERSION=\"$(FULL_VERSION)\" -DOPENSSL_NO_ENGINE
|
2012-02-23 20:02:11 +00:00
|
|
|
CFLAGS_apk-test.o := -DAPK_VERSION=\"$(FULL_VERSION)\" -DOPENSSL_NO_ENGINE -DTEST_MODE
|
2008-04-17 14:09:13 +00:00
|
|
|
|
2009-04-16 10:49:16 +00:00
|
|
|
progs-$(STATIC) += apk.static
|
2010-06-30 13:53:56 +00:00
|
|
|
apk.static-objs := $(filter-out apk.o,$(apk-objs)) apk-static.o
|
2009-04-16 10:49:16 +00:00
|
|
|
LDFLAGS_apk.static := -static
|
2012-03-28 08:28:41 +00:00
|
|
|
LIBS_apk.static := -Wl,--as-needed -ldl -Wl,--no-as-needed
|
2014-05-12 16:42:32 +00:00
|
|
|
LDFLAGS_apk += -L$(obj)
|
|
|
|
LDFLAGS_apk-test += -L$(obj)
|
2008-04-17 14:09:13 +00:00
|
|
|
|
2016-06-13 07:19:44 +00:00
|
|
|
CFLAGS_ALL += $(OPENSSL_CFLAGS) $(ZLIB_CFLAGS)
|
|
|
|
LIBS := -Wl,--as-needed \
|
|
|
|
$(FETCH_LIBS) $(OPENSSL_LIBS) $(ZLIB_LIBS) \
|
2009-07-08 07:46:38 +00:00
|
|
|
-Wl,--no-as-needed
|
2008-04-17 14:09:13 +00:00
|
|
|
|
2011-07-26 13:56:55 +00:00
|
|
|
$(obj)/apk: $(LIBAPK-y)
|
2010-03-05 08:13:25 +00:00
|
|
|
|
2011-09-14 14:16:19 +00:00
|
|
|
$(obj)/apk.so: $(LIBAPK-y)
|
2010-03-06 19:07:38 +00:00
|
|
|
|
2010-06-14 09:41:06 +00:00
|
|
|
install: $(obj)/apk $(LIBAPK-y) $(LUA_LIB-y)
|
|
|
|
$(INSTALLDIR) $(DESTDIR)$(SBINDIR)
|
2009-04-16 10:49:16 +00:00
|
|
|
$(INSTALL) $(obj)/apk $(DESTDIR)$(SBINDIR)
|
2010-06-14 09:41:06 +00:00
|
|
|
$(install-LIBAPK-y)
|
|
|
|
$(install-LUA_LIB-y)
|
2010-03-05 08:13:25 +00:00
|
|
|
|