summaryrefslogtreecommitdiff
path: root/build-aux/Makefile.once.head/10-dist.mk
blob: 27b39ecc5a8192b0b20678524002dfd4f2fbb4ad (plain)
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
74
75
76
77
78
79
# Copyright (C) 2015-2016  Luke Shumaker
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

mod.dist.description = `dist` target to create distribution tarballs
define mod.dist.doc
# User variables:
#   - `CP      ?= cp`
#   - `GZIP    ?= gzip`
#   - `MKDIR   ?= mkdir`
#   - `MKDIR_P ?= mkdir -p`
#   - `MV      ?= mv`
#   - `RM      ?= rm -f`
#   - `TAR     ?= tar`
#   - `GZIPFLAGS ?= $(GZIP_ENV)`
#   - `GZIP_ENV ?= --best` (only used via `GZIPFLAGS`, not directly)
# Inputs:
#   - Global variable    : `dist.exts`    (Default: `.tar.gz`)
#   - Global variable    : `dist.pkgname` (Default: first of PACKAGE_TARNAME PACKAGE PACKAGE_NAME)
#   - Global variable    : `dist.version` (Default: first of PACKAGE_VERSION VERSION)
#   - Directory variable : `files.src`
# Outputs:
#   - Directory variable : `files.out.int` (only in top dir)
#   - .PHONY Target      : `$(outdir)/dist`
#   - Target             : `$(topoutdir)/$(dist.pkgname)-$(dist.version)`
#   - Target             : `$(topoutdir)/$(dist.pkgname)-$(dist.version).tar`
#   - Target             : `$(topoutdir)/$(dist.pkgname)-$(dist.version).tar.gz`
#
# Provide the standard `dist` .PHONY target, based on the `files` module
# information.
#
# You may change the default compression target easily via the
# `dist.exts` variable, but you must define the rule for it manually.
#
# Bugs:
#
#   The tarball isn't reproducible.  It uses file-system ordering of
#   files, and includes timestamps.
endef
mod.dist.doc := $(value mod.dist.doc)

# Developer configuration

dist.exts ?= .tar.gz
dist.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME))
dist.version ?= $(firstword $(PACKAGE_VERSION) $(VERSION))

ifeq ($(dist.pkgname),)
$(error Autothing module: dist: dist.pkgname must be set)
endif
ifeq ($(dist.version),)
$(error Autothing module: dist: dist.version must be set)
endif

_dist.files =

# User configuration

CP      ?= cp
GZIP    ?= gzip
MKDIR   ?= mkdir
MKDIR_P ?= mkdir -p
MV      ?= mv
RM      ?= rm -f
TAR     ?= tar

GZIPFLAGS ?= $(GZIP_ENV)
GZIP_ENV ?= --best