Makefile 841 Bytes
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

7
progs-y			+= apk
Timo Teräs's avatar
Timo Teräs committed
8
apk-objs		:= common.o state.o database.o package.o archive.o \
Timo Teräs's avatar
Timo Teräs committed
9
			   version.o io.o url.o gunzip.o blob.o hash.o apk.o \
10
			   add.o del.o fix.o update.o info.o search.o upgrade.o \
Timo Teräs's avatar
Timo Teräs committed
11
			   cache.o ver.o index.o fetch.o audit.o verify.o
12
CFLAGS			+= -D_ATFILE_SOURCE
13
CFLAGS_apk.o		:= -DAPK_VERSION=\"$(FULL_VERSION)\"
14

15 16 17
progs-$(STATIC)		+= apk.static
apk.static-objs		:= $(apk-objs)
LDFLAGS_apk.static	:= -static
18
LDFLAGS_apk		+= -nopie
19

20 21 22 23
CFLAGS			+= $(shell pkg-config --cflags $(PKGDEPS))
LIBS			:= -Wl,--as-needed \
				$(shell pkg-config --libs $(PKGDEPS)) \
			   -Wl,--no-as-needed
24

25
install:
26
	$(INSTALLDIR) $(DESTDIR)$(SBINDIR)
27
	$(INSTALL) $(obj)/apk $(DESTDIR)$(SBINDIR)