apk-tools/src/Makefile

86 lines
2.4 KiB
Makefile
Raw Normal View History

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 := $(shell $(CC) -print-file-name=libfetch.a)
# lua module
ifneq ($(LUAAPK),)
LUA_VERSION ?= 5.2
LUA_PC ?= lua$(LUA_VERSION)
LUA_LIBDIR ?= /usr/lib/lua/$(LUA_VERSION)
LIBAPK := YesPlease
2010-03-06 19:07:38 +00:00
shlibs-y += apk.so
apk.so-objs := lua-apk.o
CFLAGS_lua-apk.o := -DAPK_VERSION=\"$(FULL_VERSION)\" \
$(shell $(PKG_CONFIG) $(LUA_PC) --cflags)
LUA_LIB-y := $(obj)/apk.so
install-LUA_LIB-y := $(INSTALLDIR) $(DESTDIR)$(LUA_LIBDIR) && \
$(INSTALL) $(LUA_LIB-y) $(DESTDIR)$(LUA_LIBDIR)
endif
2010-03-06 19:07:38 +00:00
progs-y += apk
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
libapk.so-objs := common.o database.o package.o archive.o \
version.o io.o url.o gunzip.o blob.o hash.o print.o \
commit.o solver.o
ifeq ($(TEST),y)
progs-y += apk-test
apk-test-objs := apk-test.o $(filter-out apk.o, $(apk-objs))
endif
ifeq ($(SHARED_LIBAPK),)
apk-objs += $(libapk.so-objs)
apk-test-objs += $(libapk.so-objs)
apk.so-objs += $(libapk.so-objs)
else
LIBAPK := YesPlease
LIBS_apk := -lapk
LIBS_apk-test := -lapk
LIBS_apk.so := -L$(obj) -lapk
endif
ifneq ($(SHARED_LIBAPK),)
shlibs-y += libapk.so
LIBAPK-y := $(obj)/libapk.so
install-LIBAPK-y := $(INSTALLDIR) $(DESTDIR)$(LIBDIR) && \
$(INSTALL) $(LIBAPK-y) $(DESTDIR)$(LIBDIR)
endif
CFLAGS_ALL += -D_ATFILE_SOURCE
CFLAGS_apk.o := -DAPK_VERSION=\"$(FULL_VERSION)\"
CFLAGS_apk-static.o := -DAPK_VERSION=\"$(FULL_VERSION)\" -DOPENSSL_NO_ENGINE
CFLAGS_apk-test.o := -DAPK_VERSION=\"$(FULL_VERSION)\" -DOPENSSL_NO_ENGINE -DTEST_MODE
progs-$(STATIC) += apk.static
apk.static-objs := $(filter-out apk.o,$(apk-objs)) apk-static.o
LDFLAGS_apk.static := -static
LIBS_apk.static := -Wl,--as-needed -ldl -Wl,--no-as-needed
LDFLAGS_apk += -L$(obj)
LDFLAGS_apk-test += -L$(obj)
CFLAGS_ALL += $(OPENSSL_CFLAGS) $(ZLIB_CFLAGS)
LIBS := -Wl,--as-needed \
$(FETCH_LIBS) $(OPENSSL_LIBS) $(ZLIB_LIBS) \
-Wl,--no-as-needed
$(obj)/apk: $(LIBAPK-y)
2010-03-05 08:13:25 +00:00
$(obj)/apk.so: $(LIBAPK-y)
2010-03-06 19:07:38 +00:00
install: $(obj)/apk $(LIBAPK-y) $(LUA_LIB-y)
$(INSTALLDIR) $(DESTDIR)$(SBINDIR)
$(INSTALL) $(obj)/apk $(DESTDIR)$(SBINDIR)
$(install-LIBAPK-y)
$(install-LUA_LIB-y)
2010-03-05 08:13:25 +00:00