From efdd2f10f531c1f326092cf2bf2babbf79301356 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Mon, 14 Jun 2010 09:41:06 +0000 Subject: Makefile: Don't build or install the libapk and lua module by default Make the libapk and lua module optional at buildtime and off by default. This is because enabling libapk requires that mkinitfs also copies the libapk.so or the initramfs will not work. To build libapk: make LIBAPK=yes To build lua module (will enable LIBAPK=yes): make LUAAPK To link apk to libapk (will enable LIBAPK=yes): make SHARED_LIBAPK=yes All the above applies to make install target as well. --- src/Makefile | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index b834246..50f9664 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,23 +4,42 @@ ifeq ($(shell pkg-config --print-errors --exists $(PKGDEPS) || echo fail),fail) $(error Build dependencies are not met) endif -shlibs-y += libapk.so -libapk.so-objs := common.o state.o database.o package.o archive.o \ - version.o io.o url.o gunzip.o blob.o hash.o print.o - +# lua module +ifneq ($(LUAAPK),) +LIBAPK := YesPlease shlibs-y += apk.so apk.so-objs := lua-apk.o CFLAGS_lua-apk.o := -DAPK_VERSION=\"$(FULL_VERSION)\" LIBS_apk.so := -L$(obj) -lapk +LUA_LIB-y := $(obj)/apk.so +install-LUA_LIB-y := $(INSTALLDIR) $(DESTDIR)$(LUA_LIBDIR) \ + $(INSTALL) $(LUA_LIB-y) $(DESTDIR)$(LUA_LIBDIR) +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 \ audit.o verify.o +libapk.so-objs := common.o state.o database.o package.o archive.o \ + version.o io.o url.o gunzip.o blob.o hash.o print.o + +ifeq ($(SHARED_LIBAPK),) +apk-objs += $(libapk.so-objs) +else +LIBAPK := YesPlease +LIBS_apk := -lapk +endif + +ifneq ($(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)\" -LIBS_apk := -lapk progs-$(STATIC) += apk.static apk.static-objs := $(apk-objs) @@ -32,13 +51,13 @@ LIBS := -Wl,--as-needed \ $(shell pkg-config --libs $(PKGDEPS)) \ -Wl,--no-as-needed -$(obj)/apk: $(obj)/libapk.so +$(obj)/apk: $(LIBAPK-y) $(obj)/apk.so: $(obj)/libapk.so -install: $(obj)/apk $(obj)/libapk.so $(obj)/apk.so - $(INSTALLDIR) $(addprefix $(DESTDIR),$(SBINDIR) $(LIBDIR) $(LUA_LIBDIR)) +install: $(obj)/apk $(LIBAPK-y) $(LUA_LIB-y) + $(INSTALLDIR) $(DESTDIR)$(SBINDIR) $(INSTALL) $(obj)/apk $(DESTDIR)$(SBINDIR) - $(INSTALL) $(obj)/libapk.so $(DESTDIR)$(LIBDIR) - $(INSTALL) $(obj)/apk.so $(DESTDIR)$(LUA_LIBDIR) + $(install-LIBAPK-y) + $(install-LUA_LIB-y) -- cgit v1.2.3-70-g09d2