@@ -2,5 +2,96 @@ all: build lint test
22
33.PHONY : all
44
5+ # Version flags to embed in the binaries
6+ VERSION ?= $(shell [ -d .git ] && git describe --tags --always --dirty="-dev")
7+ # If we are not in an active git dir then try reading the version from .VERSION.
8+ # .VERSION contains a slug populated by `git archive`.
9+ VERSION := $(or $(VERSION ) ,$(shell ./.version.sh .VERSION) )
10+
511-include make/common.mk
612-include make/docker.mk
13+
14+ # ########################################
15+ # Debian
16+ # ########################################
17+
18+ changelog :
19+ $Q echo " step-cli ($( VERSION) ) unstable; urgency=medium" > debian/changelog
20+ $Q echo >> debian/changelog
21+ $Q echo " * See https://github.com/smallstep/cli/releases" >> debian/changelog
22+ $Q echo >> debian/changelog
23+ $Q echo " -- Smallstep Labs, Inc. <[email protected] > $( shell date -uR) " >> debian/changelog
24+
25+ debian : changelog
26+ $Q set -e; mkdir -p $(RELEASE ) ; \
27+ OUTPUT=../step-cli_* .deb; \
28+ rm -f $$ OUTPUT; \
29+ dpkg-buildpackage -b -rfakeroot -us -uc && cp $$ OUTPUT $(RELEASE ) /
30+
31+ distclean : clean
32+
33+ .PHONY : changelog debian distclean
34+
35+ # ################################################
36+ # Build statically compiled step binary for various operating systems
37+ # ################################################
38+
39+ BINARY_OUTPUT =$(OUTPUT_ROOT ) binary/
40+ BUNDLE_MAKE=v =$v GOOS_OVERRIDE='GOOS=$(1 ) GOARCH=$(2 ) ' PREFIX=$(3 ) make $(3 ) bin/step
41+ RELEASE =./.travis-releases
42+
43+ binary-linux :
44+ $(call BUNDLE_MAKE,linux,amd64,$(BINARY_OUTPUT ) linux/)
45+
46+ binary-darwin :
47+ $(call BUNDLE_MAKE,darwin,amd64,$(BINARY_OUTPUT ) darwin/)
48+
49+ define BUNDLE
50+ $(q ) set -e; BUNDLE_DIR=$(BINARY_OUTPUT )$(1 ) /bundle; \
51+ stepName=step_$(2 ) ; \
52+ mkdir -p $$BUNDLE_DIR $(RELEASE ) ; \
53+ TMP=$$(mktemp -d $$BUNDLE_DIR/tmp.XXXX ) ; \
54+ trap "rm -rf $$TMP" EXIT INT QUIT TERM; \
55+ newdir=$$TMP/$$stepName; \
56+ mkdir -p $$newdir/bin; \
57+ cp $(BINARY_OUTPUT )$(1 ) /bin/step $$newdir/bin/; \
58+ cp README.md $$newdir/; \
59+ NEW_BUNDLE=$(RELEASE ) /step_$(2 ) _$(1 ) _$(3 ) .tar.gz; \
60+ rm -f $$NEW_BUNDLE; \
61+ tar -zcvf $$NEW_BUNDLE -C $$TMP $$stepName;
62+ endef
63+
64+ bundle-linux : binary-linux
65+ $(call BUNDLE,linux,$(VERSION ) ,amd64)
66+
67+ bundle-darwin : binary-darwin
68+ $(call BUNDLE,darwin,$(VERSION ) ,amd64)
69+
70+ .PHONY : binary-linux binary-darwin bundle-linux bundle-darwin
71+
72+ # ################################################
73+ # Targets for creating OS specific artifacts
74+ # ################################################
75+
76+ artifacts-linux-tag : bundle-linux debian
77+
78+ artifacts-darwin-tag : bundle-darwin
79+
80+ artifacts-tag : artifacts-linux-tag artifacts-darwin-tag
81+
82+ .PHONY : artifacts-linux-tag artifacts-darwin-tag artifacts-tag
83+
84+ # ################################################
85+ # Targets for creating step artifacts
86+ # ################################################
87+
88+ # For all builds that are not tagged
89+ artifacts-master :
90+
91+ # For all builds with a release tag
92+ artifacts-release : artifacts-tag
93+
94+ # This command is called by travis directly *after* a successful build
95+ artifacts : artifacts-$(PUSHTYPE ) docker-$(PUSHTYPE )
96+
97+ .PHONY : artifacts-master artifacts-release artifacts
0 commit comments