Makefile.packaging 4.08 KB
Newer Older
1
# Copyright (C) 2016-2017 Savoir-faire Linux Inc.
2 3 4 5 6 7 8 9 10 11 12 13 14
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
aviau's avatar
aviau committed
15 16
#
.DEFAULT_GOAL := package-all
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

##############################
## Version number variables ##
##############################
# YYYY-MM-DD
LAST_COMMIT_DATE:=$(shell git log -1 --format=%cd --date=short)

# number of commits that day
NUMBER_OF_COMMITS:=$(shell git log --format=%cd --date=short | grep -c $(LAST_COMMIT_DATE))

# YYMMDD
LAST_COMMIT_DATE_SHORT:=$(shell echo $(LAST_COMMIT_DATE) | sed -s 's/-//g')

# last commit id
COMMIT_ID:=$(shell git rev-parse --short HEAD)

RELEASE_VERSION:=$(LAST_COMMIT_DATE_SHORT).$(NUMBER_OF_COMMITS).$(COMMIT_ID)
RELEASE_TARBALL_FILENAME:=ring_$(RELEASE_VERSION).tar.gz

aviau's avatar
aviau committed
36 37 38 39
# Debian versions
DEBIAN_VERSION:=$(RELEASE_VERSION)~dfsg1-1
DEBIAN_DSC_FILENAME:=ring_$(DEBIAN_VERSION).dsc

40 41 42 43
#####################
## Other variables ##
#####################
TMPDIR := $(shell mktemp -d)
aviau's avatar
aviau committed
44
CURRENT_UID:=$(shell id -u)
45 46 47 48 49 50 51 52 53 54 55

#############################
## Release tarball targets ##
#############################
.PHONY: release-tarball
release-tarball: $(RELEASE_TARBALL_FILENAME)

$(RELEASE_TARBALL_FILENAME):
	# Fetch tarballs
	mkdir -p daemon/contrib/native
	cd daemon/contrib/native && \
56
	    ../bootstrap && make list && \
57
	    make fetch-all -j || make fetch-all || make fetch-all
58 59 60 61 62 63 64 65 66 67 68
	rm -rf daemon/contrib/native

	cd $(TMPDIR) && \
	    tar -C $(CURDIR)/.. \
	        --exclude-vcs \
	        -zcf $(RELEASE_TARBALL_FILENAME) \
	        $(shell basename $(CURDIR)) && \
	    mv $(RELEASE_TARBALL_FILENAME) $(CURDIR)

	rm -rf $(CURDIR)/daemon/contrib/tarballs/*

aviau's avatar
aviau committed
69 70 71 72 73
#######################
## Packaging targets ##
#######################

.PHONY: package-all
aviau's avatar
aviau committed
74 75 76 77 78 79 80 81 82
package-all: package-debian_8 \
             package-debian_8_i386 \
             package-debian_9 \
             package-debian_9_i386 \
             package-ubuntu_14.04 \
             package-ubuntu_14.04_i386 \
             package-ubuntu_15.10 \
             package-ubuntu_15.10_i386 \
             package-ubuntu_16.04 \
aviau's avatar
aviau committed
83
             package-ubuntu_16.04_i386 \
aviau's avatar
aviau committed
84 85
             package-ubuntu_16.10 \
             package-ubuntu_16.10_i386 \
86 87
             package-ubuntu_17.04 \
             package-ubuntu_17.04_i386 \
88 89
             package-ubuntu_17.10 \
             package-ubuntu_17.10_i386 \
aviau's avatar
aviau committed
90 91 92 93 94
             package-fedora_22 \
             package-fedora_22_i386 \
             package-fedora_23 \
             package-fedora_23_i386 \
             package-fedora_24 \
95
             package-fedora_24_i386 \
aviau's avatar
aviau committed
96 97
             package-fedora_25 \
             package-fedora_25_i386 \
98 99
             package-fedora_26 \
             package-fedora_26_i386 \
Guillaume Roguez's avatar
Guillaume Roguez committed
100 101
             package-fedora_27 \
             package-fedora_27_i386 \
102
             package-gentoo
aviau's avatar
aviau committed
103 104 105 106 107 108

# Append the output of make-packaging-target to this Makefile
# see Makefile.packaging.distro_targets
$(shell scripts/make-packaging-target.py --generate-all > Makefile.packaging.distro_targets)
include Makefile.packaging.distro_targets

109 110 111 112
###################
## Other targets ##
###################
.PHONY: docs
113 114 115 116

# Build the documentation
# Note that newly added RST files will likely not display on all documents'
# navigation bar unless the docs/build folder is manually deleted.
117 118 119 120 121 122 123 124 125 126 127 128 129
docs: env
	env/bin/sphinx-build -b html docs/source docs/build/html
	env/bin/sphinx-build -b texinfo docs/source docs/build/texinfo

env:
	virtualenv env
	env/bin/pip install Sphinx==1.4.1 sphinx-rtd-theme==0.1.9

.PHONY: clean
clean:
	rm -rf env
	rm -rf docs/build
	rm -f ring_*.tar.gz
aviau's avatar
aviau committed
130 131 132
	rm -rf packages
	rm -f Makefile.packaging.distro_targets
	rm -f .docker-image-*