diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2012-04-08 23:10:42 +0200 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2012-04-08 23:10:42 +0200 |
commit | 50bfb9acf98d5f4c0c5948cc28285e990b40b659 (patch) | |
tree | 404988f522437c2a9c84a3a70a8e7e6584ebe9e1 /Makefile | |
parent | a4df9fbd1e22a75eda2959765e58888dbcc6e42b (diff) |
Replace fragile manual »make dist« system with one based on »git archive«.
* Makeconf (lndist): Remove target.
(dist-hook, dist.tar): New targets.
* Makefile (dist): Rewrite this target's as well as accompanying rules.
(%-lndist, cp-linked-files, $(lf-inst)): Remove targets.
(%.bz2, %.gz, %/dist-hook): New targets.
(DISTFILES): Set.
* doc/Makefile (DISTFILES): Set.
* doc/Makefile (lndist, lndist-info-targets): Remove targets.
* include/Makefile (lndist): Remove target.
* libthreads/Makefile (lndist, lndist-i386-files, lndist-map-file): Remove
targets.
* pfinet/Makefile (lndist, lndist-linux-src-net-core-files)
(lndist-linux-src-net-ethernet-files, lndist-linux-src-net-ipv4-files)
(lndist-linux-src-net-ipv6-files, lndist-linux-src-asm-files)
(lndist-linux-src-include-linux-files, lndist-linux-src-include-net-files)
(lndist-linux-src-include-asm-files, lndist-glue-include-linux-files)
(lndist-glue-include-asm-files): Remove targets.
* auth/Makefile (LCLHDRS): Don't set.
* boot/Makefile (LCLHDRS, DIST_FILES): Likewise.
* bsdfsck/Makefile (LCLHDRS): Likewise.
* config/Makefile (DIST_FILES): Likewise.
* console-client/Makefile (LCLHDRS): Likewise.
* console/Makefile (LCLHDRS, DIST_FILES): Likewise.
* doc/Makefile (DIST_FILES): Likewise.
* exec/Makefile (LCLHDRS, DIST_FILES): Likewise.
* ext2fs/Makefile (LCLHDRS): Likewise.
* fatfs/Makefile (LCLHDRS): Likewise.
* ftpfs/Makefile (LCLHDRS): Likewise.
* hostmux/Makefile (LCLHDRS): Likewise.
* hurd/Makefile (DIST_FILES): Likewise.
* include/Makefile (LCLHDRS): Likewise.
* isofs/Makefile (LCLHDRS, DIST_FILES): Likewise.
* libcons/Makefile (LCLHDRS): Likewise.
* libdirmgt/Makefile (LCLHDRS): Likewise.
* libdiskfs/Makefile (LCLHDRS): Likewise.
* libfshelp/Makefile (LCLHDRS): Likewise.
* libftpconn/Makefile (LCLHDRS): Likewise.
* libihash/Makefile (LCLHDRS): Likewise.
* libiohelp/Makefile (LCLHDRS): Likewise.
* libnetfs/Makefile (LCLHDRS): Likewise.
* libpager/Makefile (LCLHDRS): Likewise.
* libpipe/Makefile (LCLHDRS): Likewise.
* libports/Makefile (LCLHDRS): Likewise.
* libps/Makefile (LCLHDRS): Likewise.
* libshouldbeinlibc/Makefile (LCLHDRS): Likewise.
* libstore/Makefile (LCLHDRS, DIST_FILES): Likewise.
* libthreads/Makefile (LCLHDRS): Likewise.
* libtreefs/Makefile (LCLHDRS): Likewise.
* libtrivfs/Makefile (LCLHDRS): Likewise.
* mach-defpager/Makefile (LCLHDRS): Likewise.
* nfs/Makefile (LCLHDRS): Likewise.
* nfsd/Makefile (LCLHDRS): Likewise.
* pfinet/Makefile (LCLHDRS): Likewise.
* pflocal/Makefile (LCLHDRS): Likewise.
* proc/Makefile (LCLHDRS, DIST_FILES): Likewise.
* release/Makefile (DIST_FILES): Likewise.
* storeio/Makefile (LCLHDRS): Likewise.
* sutils/Makefile (LCLHDRS): Likewise.
* term/Makefile (LCLHDRS, DIST_FILES): Likewise.
* tmpfs/Makefile (LCLHDRS): Likewise.
* ufs-fsck/Makefile (LCLHDRS): Likewise.
* ufs/Makefile (LCLHDRS): Likewise.
* usermux/Makefile (LCLHDRS): Likewise.
* utils/Makefile (LCLHDRS): Likewise.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 69 |
1 files changed, 39 insertions, 30 deletions
@@ -19,12 +19,9 @@ dir := . makemode := misc -include ./Makeconf - -DIST_FILES = ChangeLog COPYING Makeconf config.make.in configure.in configure \ - move-if-change hurd.boot build.mk.in build.mkcf.in aclocal.m4 \ - README NEWS tasks INSTALL INSTALL-cross version.h.in +DISTFILES := configure +include ./Makeconf ## Subdirectories of this directory should all be mentioned here @@ -52,9 +49,6 @@ other-subdirs = hurd doc config release include # All the subdirectories together subdirs = $(lib-subdirs) $(prog-subdirs) $(other-subdirs) -# Any subdirectories here that we don't want to distribute to the world -subdirs-nodist = - # This allows the creation of a file BROKEN in any of the prog-subdirs; # that will prevent this top level Makefile from attempting to make it. working-prog-subdirs := $(filter-out \ @@ -70,17 +64,35 @@ $(subdirs): version.h all: $(lib-subdirs) $(working-prog-subdirs) -# Create a distribution tar file. Set make variable `version' on the -# command line; otherwise the tar file will be a dated snapshot. -ifeq ($(version),) -version:=$(shell date +%Y%m%d) +# Create a distribution tar file. + +git_describe := git describe --match '*release*' +dist-version := $(shell cd $(top_srcdir)/ && $(git_describe)) + +.PHONY: dist +ifdef configured +dist: $(foreach Z,bz2 gz,$(dist-version).tar.$(Z)) +else +dist: + @echo >&2 'Cannot build a distribution from an unconfigured tree.' + false endif -dirname:=hurd -dist: $(srcdir)/hurd-snap $(addsuffix -lndist,$(filter-out $(subdirs-nodist), $(subdirs))) lndist - mv $(srcdir)/hurd-snap $(srcdir)/$(dirname)-$(version) - cd $(srcdir); tar cfz $(dirname)-$(version).tar.gz $(dirname)-$(version) - rm -rf $(srcdir)/$(dirname)-$(version) +HEAD.tar: FORCE + cd $(top_srcdir)/ && git status --short \ + | $(AWK) '{ print; rc=1 } END { exit rc }' \ + || { echo >&2 \ + 'Refusing to build a distribution from dirty sources.' && \ + false; } + (cd $(top_srcdir)/ && git archive --prefix=$(dist-version)/ HEAD) > $@ + +$(dist-version).tar: HEAD.tar $(addsuffix /dist-hook,hurd/.. $(subdirs)) + tar -c -f $@ --files-from=/dev/null +# Concatenate HEAD.tar and all subdirs' dist.tar that have been created. Have +# to do it one by one: <http://savannah.gnu.org/patch/?7757>. + for f in HEAD.tar dist.tar */dist.tar; do \ + tar -v --concatenate -f $@ "$$f"; \ + done clean: $(addsuffix -clean,$(subdirs)) clean-misc @@ -97,15 +109,18 @@ install-headers: $(addsuffix -install-headers,$(lib-subdirs) \ TAGS: $(addsuffix -TAGS,$(working-prog-subdirs) $(lib-subdirs)) etags -o $@ $(patsubst %-TAGS,-i %/TAGS,$^) + +%.bz2: % + bzip2 -9 < $< > $@ + +%.gz: % + gzip -9n < $< > $@ ## Targets used by the main targets above. $(prog-subdirs) $(lib-subdirs): FORCE $(MAKE) -C $@ all FORCE: -%-lndist: $(top_srcdir)/hurd-snap - $(MAKE) -C $* lndist no_deps=t - %-clean: $(MAKE) -C $* clean no_deps=t @@ -124,19 +139,13 @@ FORCE: %-TAGS: $(MAKE) -C $* TAGS no_deps=t -$(srcdir)/hurd-snap: - mkdir $(srcdir)/hurd-snap - -lndist: cp-linked-files - -linked-files = install-sh config.guess config.sub mkinstalldirs -lf-inst = $(addprefix $(srcdir)/hurd-snap/,$(linked-files)) -cp-linked-files: $(lf-inst) -$(lf-inst): $(srcdir)/hurd-snap/%: $(srcdir)/% - cp $< $@ +.PHONY: %/dist-hook +%/dist-hook: + $(MAKE) -C $* dist-hook no_deps=t dist-version=$(dist-version) .PHONY: clean-misc distclean clean-misc: + rm -f HEAD.tar distclean: clean rm -f config.make config.log config.status config.cache |