summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build-aux/Makefile.each.tail/00-dist.mk4
-rw-r--r--build-aux/Makefile.once.head/00-dist.mk36
-rw-r--r--build-aux/Makefile.once.tail/00-dist.mk26
3 files changed, 44 insertions, 22 deletions
diff --git a/build-aux/Makefile.each.tail/00-dist.mk b/build-aux/Makefile.each.tail/00-dist.mk
index 1ab7568..6e6a5cb 100644
--- a/build-aux/Makefile.each.tail/00-dist.mk
+++ b/build-aux/Makefile.each.tail/00-dist.mk
@@ -14,5 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
ifeq ($(outdir),$(topoutdir))
-std.clean_files += $(addprefix $(PACKAGE)-*,$(dist.exts) /)
+std.clean_files += $(addprefix $(PACKAGE)-*,$(dist.exts) .tar /)
endif
+
+$(outdir)/dist: $(addprefix $(topoutdir)/$(PACKAGE)-$(VERSION),$(dist.exts))
diff --git a/build-aux/Makefile.once.head/00-dist.mk b/build-aux/Makefile.once.head/00-dist.mk
index 314f7f8..98fc6b3 100644
--- a/build-aux/Makefile.once.head/00-dist.mk
+++ b/build-aux/Makefile.once.head/00-dist.mk
@@ -1 +1,37 @@
+# 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/>.
+
+# Developer configuration
+
dist.exts ?= .tar.gz
+PACKAGE ?= YOUR_PACKAGE_NAME
+VERSION ?= 0.0.1
+
+# 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
+
+# Implementation
+
+at.phony += dist
diff --git a/build-aux/Makefile.once.tail/00-dist.mk b/build-aux/Makefile.once.tail/00-dist.mk
index d8fa226..ef3ecb1 100644
--- a/build-aux/Makefile.once.tail/00-dist.mk
+++ b/build-aux/Makefile.once.tail/00-dist.mk
@@ -13,32 +13,16 @@
# 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/>.
-# Add the `dist` target
-.PHONY: dist
-dist: $(addprefix $(topoutdir)/$(PACKAGE)-$(VERSION),$($(_am)distexts)
-
-_am_copyfile = $(MKDIR_P) $(dir $2) && $(CP) -T $1 $2
-_am_addfile = $(call _am_copyfile,$3,$2/$(call _am_relto,$1,$3))
-$(topoutdir)/$(PACKAGE)-$(VERSION): $(_am_src_files/$(topoutdir)) $(_am_gen_files/$(topoutdir))
+_dist.copyfile = $(MKDIR_P) $(dir $2) && $(CP) -T $1 $2
+_dist.addfile = $(call _dist.copyfile,$3,$2/$(call at.relto,$1,$3))
+$(topoutdir)/$(PACKAGE)-$(VERSION): $(std.src_files/$(topoutdir)) $(std.gen_files/$(topoutdir))
$(RM) -r $@
@PS4='' && set -x && \
$(MKDIR) $(@D)/tmp.$(@F).$$$$ && \
- $(foreach f,$^,$(call _am_addfile,$(topsrcdir),$(@D)/tmp.$(@F).$$$$,$f) &&) \
+ $(foreach f,$^,$(call _dist.addfile,$(topsrcdir),$(@D)/tmp.$(@F).$$$$,$f) &&) \
$(MV) $(@D)/tmp.$(@F).$$$$ $@ || $(RM) -r $(@D)/tmp.$(@F).$$$$
$(topoutdir)/$(PACKAGE)-$(VERSION).tar: $(topoutdir)/$(PACKAGE)-$(VERSION)
$(TAR) cf $@ -C $(<D) $(<F)
$(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz: $(topoutdir)/$(PACKAGE)-$(VERSION).tar
- $(GZIP) $(GZIP_ENV) < $< > $@
-
-CP ?= cp
-GZIP ?= gzip
-MKDIR ?= mkdir
-MKDIR_P ?= mkdir -p
-MV ?= mv
-RM ?= rm -f
-RMDIR_P ?= rmdir -p
-TAR ?= tar
-TRUE ?= true
-
-GZIP_ENV ?= --best
+ $(GZIP) $(GZIPFLAGS) < $< > $@