Makefile 1.03 KB
Newer Older
1
PKGDEPS := openssl zlib
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

11
progs-y			+= apk
Natanael Copa's avatar
Natanael Copa committed
12 13 14 15
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

16
CFLAGS			+= -D_ATFILE_SOURCE
17
CFLAGS_apk.o		:= -DAPK_VERSION=\"$(FULL_VERSION)\"
Natanael Copa's avatar
Natanael Copa committed
18
LIBS_apk		:= -lapk
19

20 21 22
progs-$(STATIC)		+= apk.static
apk.static-objs		:= $(apk-objs)
LDFLAGS_apk.static	:= -static
Natanael Copa's avatar
Natanael Copa committed
23
LDFLAGS_apk		+= -nopie -L$(obj)
24

25 26 27 28
CFLAGS			+= $(shell pkg-config --cflags $(PKGDEPS))
LIBS			:= -Wl,--as-needed \
				$(shell pkg-config --libs $(PKGDEPS)) \
			   -Wl,--no-as-needed
29

Natanael Copa's avatar
Natanael Copa committed
30 31 32 33 34

$(obj)/apk:	$(obj)/libapk.so

install: $(obj)/apk $(obj)/libapk.so
	$(INSTALLDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR)
35
	$(INSTALL) $(obj)/apk $(DESTDIR)$(SBINDIR)
Natanael Copa's avatar
Natanael Copa committed
36 37
	$(INSTALL) $(obj)/libapk.so $(DESTDIR)$(LIBDIR)