Makefile 1.74 KB
Newer Older
1
PKGDEPS := openssl zlib
Timo Teräs's avatar
Timo Teräs committed
2

3 4 5
# lua module
ifneq ($(LUAAPK),)
LIBAPK			:= YesPlease
6
PKGDEPS			+= lua
Natanael Copa's avatar
Natanael Copa committed
7 8 9
shlibs-y		+= apk.so
apk.so-objs		:= lua-apk.o
CFLAGS_lua-apk.o	:= -DAPK_VERSION=\"$(FULL_VERSION)\"
10
LIBS_apk.so		:= -L$(obj) -lapk
11 12 13 14
LUA_LIB-y		:= $(obj)/apk.so
install-LUA_LIB-y	:= $(INSTALLDIR) $(DESTDIR)$(LUA_LIBDIR) \
			   $(INSTALL) $(LUA_LIB-y) $(DESTDIR)$(LUA_LIBDIR)
endif
Natanael Copa's avatar
Natanael Copa committed
15

16 17 18 19
ifeq ($(shell pkg-config --print-errors --exists $(PKGDEPS) || echo fail),fail)
$(error Build dependencies are not met)
endif

20
progs-y			+= apk
Natanael Copa's avatar
Natanael Copa committed
21 22
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 \
23
			   audit.o verify.o dot.o
Natanael Copa's avatar
Natanael Copa committed
24

25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
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

42
CFLAGS_ALL		+= -D_ATFILE_SOURCE
43
CFLAGS_apk.o		:= -DAPK_VERSION=\"$(FULL_VERSION)\"
44
CFLAGS_apk-static.o	:= -DAPK_VERSION=\"$(FULL_VERSION)\" -DOPENSSL_NO_ENGINE
45

46
progs-$(STATIC)		+= apk.static
47
apk.static-objs		:= $(filter-out apk.o,$(apk-objs)) apk-static.o
48
LDFLAGS_apk.static	:= -static
Natanael Copa's avatar
Natanael Copa committed
49
LDFLAGS_apk		+= -nopie -L$(obj)
50

51
CFLAGS_ALL		+= $(shell pkg-config --cflags $(PKGDEPS))
52 53 54
LIBS			:= -Wl,--as-needed \
				$(shell pkg-config --libs $(PKGDEPS)) \
			   -Wl,--no-as-needed
55

56
$(obj)/apk:	$(LIBAPK-y)
Natanael Copa's avatar
Natanael Copa committed
57

Natanael Copa's avatar
Natanael Copa committed
58 59
$(obj)/apk.so:	$(obj)/libapk.so

60 61
install: $(obj)/apk $(LIBAPK-y) $(LUA_LIB-y)
	$(INSTALLDIR) $(DESTDIR)$(SBINDIR)
62
	$(INSTALL) $(obj)/apk $(DESTDIR)$(SBINDIR)
63 64
	$(install-LIBAPK-y)
	$(install-LUA_LIB-y)
Natanael Copa's avatar
Natanael Copa committed
65