Makefile 1.48 KB
Newer Older
1 2 3 4 5 6 7 8 9
# Makefile - one file to rule them all, one file to bind them
#
# Copyright (C) 2007 Timo Teräs <timo.teras@iki.fi>
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it 
# under the terms of the GNU General Public License version 3 as published
# by the Free Software Foundation. See http://www.gnu.org/ for details.

10
PACKAGE := apk-tools
Natanael Copa's avatar
Natanael Copa committed
11
VERSION := 2.0_pre3
12 13 14 15 16 17 18 19 20 21 22 23

SVN_REV := $(shell svn info 2> /dev/null | grep ^Revision | cut -d ' ' -f 2)
ifneq ($(SVN_REV),)
FULL_VERSION := $(VERSION)-r$(SVN_REV)
else
FULL_VERSION := $(VERSION)
endif

CC=gcc
INSTALL=install
INSTALLDIR=$(INSTALL) -d

24 25 26 27
CFLAGS?=-g -Werror -Wall -Wstrict-prototypes
CFLAGS+=-D_GNU_SOURCE -std=gnu99 -DAPK_VERSION=\"$(FULL_VERSION)\"

LDFLAGS?=-g
Natanael Copa's avatar
Natanael Copa committed
28
LDFLAGS+=-nopie
29
LIBS=/usr/lib/libz.a
30 31 32 33 34

ifeq ($(STATIC),yes)
CFLAGS+=-fno-stack-protector
LDFLAGS+=-static
endif
35 36

DESTDIR=
37
SBINDIR=/sbin
38 39 40 41
CONFDIR=/etc/apk
MANDIR=/usr/share/man
DOCDIR=/usr/share/doc/apk

42
SUBDIRS=src
43

44
.PHONY: compile install clean all static
45 46 47

all: compile

48 49 50
static:
	$(MAKE) $(MFLAGS) -C src apk.static

51 52 53 54 55 56 57
compile install clean::
	@for i in $(SUBDIRS); do $(MAKE) $(MFLAGS) -C $$i $(MAKECMDGOALS); done

install::
	$(INSTALLDIR) $(DESTDIR)$(DOCDIR)
	$(INSTALL) README $(DESTDIR)$(DOCDIR)

Natanael Copa's avatar
Natanael Copa committed
58 59 60
clean::
	rm -rf $(TARBALL)

61
TARBALL := $(PACKAGE)-$(VERSION).tar.bz2
Natanael Copa's avatar
Natanael Copa committed
62 63
dist:	$(TARBALL)
$(TARBALL):
64 65 66 67 68
	rm -rf $(PACKAGE)
	git clone . $(PACKAGE)
	cd $(PACKAGE) && (cd .. && git diff) | patch -p1
	tar -cjf $@ $(PACKAGE)
	rm -rf $(PACKAGE)
69 70

.EXPORT_ALL_VARIABLES: