summaryrefslogtreecommitdiff
path: root/src/Makefile
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2010-06-14 09:41:06 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2010-06-14 09:41:06 +0000
commitefdd2f10f531c1f326092cf2bf2babbf79301356 (patch)
treefb756f53f1bf328404f4b1775fe424da9faaf737 /src/Makefile
parent8b317678e3a440ccbb3534cc531ccc788d0aa490 (diff)
downloadapk-tools-efdd2f10f531c1f326092cf2bf2babbf79301356.tar.gz
apk-tools-efdd2f10f531c1f326092cf2bf2babbf79301356.tar.bz2
apk-tools-efdd2f10f531c1f326092cf2bf2babbf79301356.tar.xz
apk-tools-efdd2f10f531c1f326092cf2bf2babbf79301356.zip
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.
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile39
1 files changed, 29 insertions, 10 deletions
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)