|
1 | 1 | #! /usr/bin/make |
2 | 2 | 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) |
3 | 5 | PKGNAME = c-lightning |
4 | 6 |
|
5 | 7 | # We use our own internal ccan copy. |
@@ -309,7 +311,7 @@ ALL_PROGRAMS += ccan/ccan/cdump/tools/cdump-enumstr |
309 | 311 | ccan/ccan/cdump/tools/cdump-enumstr.o: $(CCAN_HEADERS) Makefile |
310 | 312 |
|
311 | 313 | 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 |
313 | 315 | @if cmp $@.new $@ >/dev/null 2>&2; then rm -f $@.new; else mv $@.new $@; echo Version updated; fi |
314 | 316 |
|
315 | 317 | # All binaries require the external libs, ccan |
@@ -474,7 +476,14 @@ installcheck: |
474 | 476 | @rm -rf testinstall || true |
475 | 477 |
|
476 | 478 | .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/ |
478 | 487 |
|
479 | 488 | ccan-breakpoint.o: $(CCANDIR)/ccan/breakpoint/breakpoint.c |
480 | 489 | $(CC) $(CFLAGS) -c -o $@ $< |
|
0 commit comments