forked from basho/riak
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (62 loc) · 2.19 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
OS = $(shell uname -s)
KERNEL = $(shell uname -r)
ERLANG_BIN = $(shell dirname $(shell which erl))
ifeq ($(OS),Linux) # Linux
ARCH = $(shell uname -m)
PKGER = $(shell cat /etc/redhat-release 2> /dev/null)
ifeq ($(PKGER),) # Debian / Ubuntu
OSNAME = Debian
PKGERDIR = deb
BUILDDIR = debuild
DISTRO = $(shell lsb_release -cs)
DEBARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH)
else # Redhat / Centos
OSNAME = RedHat
PKGERDIR = rpm
BUILDDIR = rpmbuild
endif
endif # linux
ifeq ($(OS),SunOS) # Solaris flavors
KERNELVER = $(shell uname -v | grep -c joyent 2> /dev/null)
ARCH = $(shell uname -p)
ifneq ($(KERNELVER),0) # SmartOS
OSNAME = SmartOS
PKGERDIR = smartos
BUILDDIR = smartosbuild
else # Solaris / OmniOS
PKGERDIR = solaris
DISTRO = $(shell head -1 /etc/release|awk \
'{if ($$1 == "OmniOS") {print $$1} else {print "Solaris"}}')
OSNAME = ${DISTRO}
endif
endif # solaris
ifeq ($(OS),Darwin) # OSX
OSNAME = OSX
ARCH = $(shell file `which erlc` | grep -c x86_64 2> /dev/null | awk \
'{if ($$1 == "0") {print "i386"} else {print "x86_64"}}')
PKGERDIR = osx
BUILDDIR = osxbuild
endif
ifeq ($(OS),FreeBSD) # FreeBSD
OSNAME = $(OS)
ARCH = $(shell uname -p)
PKGERDIR = freebsd
BUILDDIR = bsdbuild
endif
DATE = $(shell date +%Y-%m-%d)
VERSIONSTRING = $(APP) ($(PKG_VERSION) $(DATE)) $(OSNAME) $(ARCH)
APP = $(shell echo "$(REPO)" | sed -e 's/_/-/g')
# Assumes CURDIR is .../$(APP)/package/$(APP)/
RIAK_PATH ?= ..
RELEASE ?=
$(APP)-$(PKG_VERSION).tar.gz: ../$(DISTNAME).tar.gz
ln -s $< $@
pkgclean: $(PKGERDIR)/pkgclean
rm -rf $(APP)-*.tar.gz packages $(BUILDDIR)
pkgcheck:
$(if $(DISTNAME),,$(error "You can't generate a release tarball from a non-tagged revision. Run 'git checkout <tag>', then 'make dist'"))
$(if $(RELEASE),,$(error "You must provide a package release number via RELEASE= on the command line"))
@echo "Packaging \"$(DISTNAME)\""
# The heavy lifting is done by the individual packager Makefiles
package: pkgcheck build
include $(PKGERDIR)/Makefile