Simple implementation of the 'dist' rule

This is for better compatibility with automake-generated makefiles.
It generates a distribution tar file.
This commit is contained in:
Christophe de Dinechin 2018-09-19 18:52:54 +02:00
parent 4b5a42369d
commit 741ce2047c
4 changed files with 42 additions and 3 deletions

7
NEWS Normal file
View File

@ -0,0 +1,7 @@
v0.1 This is the first official release of make-it-quick.
This alpha-quality version provides most of the basic functions I
think are useful to develop C / C++ software on Linux and macOS. This
was not extensively tested on any other platform at this point,
although some effort was made to ensure it would not be gratuitously
broken.

View File

@ -39,6 +39,26 @@ UNINSTALL_DIR= /bin/rmdir > /dev/null 2>&1
UNINSTALL_OK= || true
CAT= cat /dev/null
# Tarball generation
GEN_TARBALL= mkdir $(MIQ_TARNAME) && \
tar cf - AUTHORS NEWS $(shell git ls-files) | \
(cd $(MIQ_TARNAME); tar xf - ) && \
tar cfj $@ $(MIQ_TARNAME) && \
rm -rf $(MIQ_TARNAME)
GEN_AUTHORS= (echo "This software was brought to you by:"; \
echo "" ; \
git log --format='%aN <%aE>' | sort -u | \
sed -e 's/^/- /g'; \
echo ""; \
echo "Thank you!")
GEN_NEWS= grep '^$(shell git tag -l)' $@ || \
(touch $@; \
(git tag -l $(shell git describe) -n999 ; \
echo ""; \
cat $@) \
> $@.latest && mv $@.latest $@)
#------------------------------------------------------------------------------
# Compilation flags

View File

@ -61,8 +61,9 @@ NOT_PARALLEL?= .NOTPARALLEL
# Git revision for the current code
GIT_REVISION:= $(shell git rev-parse --short HEAD 2> /dev/null || echo "unknown")
# Product version defaults to package version
PRODUCTS_VERSION?=$(PACKAGE_VERSION)
# Extract defaults for package name and version if not set
PACKAGE_NAME?=$(firstword $(PRODUCTS) $(notdir $(shell pwd)))
PACKAGE_VERSION?=$(shell (git describe --always --match 'v[0-9].*' | sed -e 's/^v//') || echo unknown)
# Package installation directory
PACKAGE_DIR?=$(PACKAGE_NAME:%=%/)

View File

@ -161,6 +161,9 @@ MIQ_INDEX:= 1
MIQ_COUNT:= $(words $(MIQ_SOURCES))
MIQ_PROFOUT:= $(subst $(EXE_EXT),,$(MIQ_OUTEXE))_prof_$(GIT_REVISION).vsp
MIQ_TARNAME= $(PACKAGE_NAME)-$(PACKAGE_VERSION)
MIQ_TARBALL= $(MIQ_TARNAME).tar.bz2
ifeq (3.80,$(firstword $(sort $(MAKE_VERSION) 3.80)))
MIQ_ORDERONLY=|
endif
@ -192,8 +195,16 @@ clean: $(SUBDIRS:%=%.clean) $(VARIANTS:%=%.variant-clean)
%.variant-clean:
$(PRINT_COMMAND) $(MIQ_RECURSE) VARIANT=$* VARIANTS= clean $(COLORIZE)
dist: $(MIQ_TARBALL)
$(MIQ_TARBALL): AUTHORS NEWS
$(PRINT_GENERATE) $(GEN_TARBALL)
AUTHORS: .ALWAYS
$(PRINT_GENERATE) $(GEN_AUTHORS) > $@
NEWS: .ALWAYS
$(PRINT_GENERATE) $(GEN_NEWS)
distclean nuke: clean
-$(PRINT_CLEAN) rm -rf $(MIQ_OUTPRODS) $(OBJFILES) $(LOGS)
-$(PRINT_CLEAN) rm -rf $(MIQ_OUTPRODS) $(OBJFILES) $(LOGS) $(MIQ_TARBALL)
help:
@$(ECHO) "Available targets:"