Skip to content

Commit 9071b85

Browse files
rustyrussellcdecker
authored andcommitted
Makefile: add bin-tarball rule to produce clightning-<version>-<distro>.tar.xz
Places everything under opt/clightning, as per LSB. Signed-off-by: Rusty Russell <[email protected]>
1 parent f64272c commit 9071b85

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Makefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#! /usr/bin/make
22
VERSION_NAME=I Accidentally The Smart Contract
3+
VERSION=$(shell git describe --always --dirty=-modded)
4+
DISTRO=$(shell lsb_release -is 2>/dev/null || echo unknown)-$(shell lsb_release -rs 2>/dev/null || echo unknown)
35
PKGNAME = c-lightning
46

57
# We use our own internal ccan copy.
@@ -309,7 +311,7 @@ ALL_PROGRAMS += ccan/ccan/cdump/tools/cdump-enumstr
309311
ccan/ccan/cdump/tools/cdump-enumstr.o: $(CCAN_HEADERS) Makefile
310312

311313
gen_version.h: FORCE
312-
@(echo "#define VERSION \"`git describe --always --dirty=-modded`\"" && echo "#define BUILD_FEATURES \"$(FEATURES)\"") > $@.new
314+
@(echo "#define VERSION \"$(VERSION)\"" && echo "#define BUILD_FEATURES \"$(FEATURES)\"") > $@.new
313315
@if cmp $@.new $@ >/dev/null 2>&2; then rm -f $@.new; else mv $@.new $@; echo Version updated; fi
314316

315317
# All binaries require the external libs, ccan
@@ -474,7 +476,14 @@ installcheck:
474476
@rm -rf testinstall || true
475477

476478
.PHONY: installdirs install-program install-data install uninstall \
477-
installcheck ncc
479+
installcheck ncc bin-tarball
480+
481+
# Make a tarball of opt/clightning/, optionally with label for distribution.
482+
bin-tarball: clightning-$(VERSION)-$(DISTRO).tar.xz
483+
clightning-$(VERSION)-$(DISTRO).tar.xz: DESTDIR=$(shell pwd)/
484+
clightning-$(VERSION)-$(DISTRO).tar.xz: prefix=opt/clightning
485+
clightning-$(VERSION)-$(DISTRO).tar.xz: install
486+
trap "rm -rf opt" 0; tar cvfa $@ opt/
478487

479488
ccan-breakpoint.o: $(CCANDIR)/ccan/breakpoint/breakpoint.c
480489
$(CC) $(CFLAGS) -c -o $@ $<

0 commit comments

Comments
 (0)