Browse files

Add "dist" target to makefile

Run as "make dist" to generate snabbswitch-`git describe`.tar.xz, which
will contain source code and a built binary.

Set DIST_BINARY to rename the binary.  Set PACKAGE to rename the
  • Loading branch information...
1 parent 0d6470d commit 08e3a0cc2996563979e47ba05328be779b0e7067 @wingo wingo committed Feb 25, 2016
Showing with 13 additions and 0 deletions.
  1. +13 −0 Makefile
@@ -29,4 +29,17 @@ clean:
(cd lib/luajit && $(MAKE) clean)
(cd src; $(MAKE) clean; rm -rf syscall.lua syscall)
+BUILDDIR:=$(shell pwd)
+dist: DISTDIR:=$(BUILDDIR)/$(PACKAGE)-$(shell git describe --tags)
+dist: all
+ mkdir "$(DISTDIR)"
+ git clone "$(BUILDDIR)" "$(DISTDIR)/snabbswitch"
+ rm -rf "$(DISTDIR)/snabbswitch/.git"
+ cp "$(BUILDDIR)/src/snabb" "$(DISTDIR)/$(DIST_BINARY)"
+ cd "$(DISTDIR)/.." && tar cJvf "`basename '$(DISTDIR)'`.tar.xz" "`basename '$(DISTDIR)'`"
+ rm -rf "$(DISTDIR)"
.SERIAL: all

0 comments on commit 08e3a0c

Please sign in to comment.