Makefile 1.28 KB
Newer Older
1
PKGDEPS := openssl zlib lua
Timo Teräs's avatar
Timo Teräs committed
2 3 4 5 6

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

Natanael Copa's avatar
Natanael Copa committed
7 8 9 10
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

Natanael Copa's avatar
Natanael Copa committed
11 12 13
shlibs-y		+= apk.so
apk.so-objs		:= lua-apk.o
CFLAGS_lua-apk.o	:= -DAPK_VERSION=\"$(FULL_VERSION)\"
14
LIBS_apk.so		:= -L$(obj) -lapk
Natanael Copa's avatar
Natanael Copa committed
15

16
progs-y			+= apk
Natanael Copa's avatar
Natanael Copa committed
17 18 19 20
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

21
CFLAGS_ALL		+= -D_ATFILE_SOURCE
22
CFLAGS_apk.o		:= -DAPK_VERSION=\"$(FULL_VERSION)\"
Natanael Copa's avatar
Natanael Copa committed
23
LIBS_apk		:= -lapk
24

25 26 27
progs-$(STATIC)		+= apk.static
apk.static-objs		:= $(apk-objs)
LDFLAGS_apk.static	:= -static
Natanael Copa's avatar
Natanael Copa committed
28
LDFLAGS_apk		+= -nopie -L$(obj)
29

30
CFLAGS_ALL		+= $(shell pkg-config --cflags $(PKGDEPS))
31 32 33
LIBS			:= -Wl,--as-needed \
				$(shell pkg-config --libs $(PKGDEPS)) \
			   -Wl,--no-as-needed
34

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

Natanael Copa's avatar
Natanael Copa committed
37 38 39 40
$(obj)/apk.so:	$(obj)/libapk.so

install: $(obj)/apk $(obj)/libapk.so $(obj)/apk.so
	$(INSTALLDIR) $(addprefix $(DESTDIR),$(SBINDIR) $(LIBDIR) $(LUA_LIBDIR))
41
	$(INSTALL) $(obj)/apk $(DESTDIR)$(SBINDIR)
Natanael Copa's avatar
Natanael Copa committed
42
	$(INSTALL) $(obj)/libapk.so $(DESTDIR)$(LIBDIR)
Natanael Copa's avatar
Natanael Copa committed
43
	$(INSTALL) $(obj)/apk.so $(DESTDIR)$(LUA_LIBDIR)
Natanael Copa's avatar
Natanael Copa committed
44