Debian Codegraph @

Makefile

raw symbols SCIP
1 all: lint test build
2
3 ci: test build
4
5 .PHONY: all ci
6
7 #################################################
8 # Determine the type of `push` and `version`
9 #################################################
10
11 # If TRAVIS_TAG is set then we know this ref has been tagged.
12 ifdef TRAVIS_TAG
13 VERSION ?= $(TRAVIS_TAG)
14 NOT_RC := $(shell echo $(VERSION) | grep -v -e -rc)
15 ifeq ($(NOT_RC),)
16 PUSHTYPE := release-candidate
17 else
18 PUSHTYPE := release
19 endif
20 # GITHUB Actions
21 else ifdef GITHUB_REF
22 VERSION ?= $(shell echo $(GITHUB_REF) | sed 's/^refs\/tags\///')
23 NOT_RC := $(shell echo $(VERSION) | grep -v -e -rc)
24 ifeq ($(NOT_RC),)
25 PUSHTYPE := release-candidate
26 else
27 PUSHTYPE := release
28 endif
29 else
30 VERSION ?= $(shell [ -d .git ] && git describe --tags --always --dirty="-dev")
31 # If we are not in an active git dir then try reading the version from .VERSION.
32 # .VERSION contains a slug populated by `git archive`.
33 VERSION := $(or $(VERSION),$(shell ./.version.sh .VERSION))
34 ifeq ($(TRAVIS_BRANCH),master)
35 PUSHTYPE := master
36 else
37 PUSHTYPE := branch
38 endif
39 endif
40
41 VERSION := $(shell echo $(VERSION) | sed 's/^v//')
42 DEB_VERSION := $(shell echo $(VERSION) | sed 's/-/~/')
43
44 ifdef V
45 $(info TRAVIS_TAG is $(TRAVIS_TAG))
46 $(info GITHUB_REF is $(GITHUB_REF))
47 $(info VERSION is $(VERSION))
48 $(info DEB_VERSION is $(DEB_VERSION))
49 $(info PUSHTYPE is $(PUSHTYPE))
50 endif
51
52 include make/common.mk
53 include make/docker.mk
54
55 #########################################
56 # Debian
57 #########################################
58
59 changelog:
60 $Q echo "step-cli ($(DEB_VERSION)) unstable; urgency=medium" > debian/changelog
61 $Q echo >> debian/changelog
62 $Q echo " * See https://github.com/smallstep/cli/releases" >> debian/changelog
63 $Q echo >> debian/changelog
64 $Q echo " -- Smallstep Labs, Inc. <[email protected]> $(shell date -uR)" >> debian/changelog
65
66 debian: changelog
67 $Q set -e; mkdir -p $(RELEASE); \
68 OUTPUT=../step-cli_*.deb; \
69 rm -f $$OUTPUT; \
70 dpkg-buildpackage -b -rfakeroot -us -uc && cp $$OUTPUT $(RELEASE)/
71
72 distclean: clean
73
74 .PHONY: changelog debian distclean
75
76 #################################################
77 # Build statically compiled step binary for various operating systems
78 #################################################
79
80 BINARY_OUTPUT=$(OUTPUT_ROOT)binary/
81 RELEASE=./.releases
82
83 define BUNDLE_MAKE
84 # $(1) -- Go Operating System (e.g. linux, darwin, windows, etc.)
85 # $(2) -- Go Architecture (e.g. amd64, arm, arm64, etc.)
86 # $(3) -- Go ARM architectural family (e.g. 7, 8, etc.)
87 # $(4) -- Parent directory for executables generated by 'make'.
88 $(q) GOOS_OVERRIDE='GOOS=$(1) GOARCH=$(2) GOARM=$(3)' PREFIX=$(4) make $(4)bin/step
89 endef
90
91 binary-linux:
92 $(call BUNDLE_MAKE,linux,amd64,,$(BINARY_OUTPUT)linux/)
93
94 binary-linux-arm64:
95 $(call BUNDLE_MAKE,linux,arm64,,$(BINARY_OUTPUT)linux.arm64/)
96
97 binary-linux-armv7:
98 $(call BUNDLE_MAKE,linux,arm,7,$(BINARY_OUTPUT)linux.armv7/)
99
100 binary-linux-mips:
101 $(call BUNDLE_MAKE,linux,mips,,$(BINARY_OUTPUT)linux.mips/)
102
103 binary-darwin:
104 $(call BUNDLE_MAKE,darwin,amd64,,$(BINARY_OUTPUT)darwin/)
105
106 binary-windows:
107 $(call BUNDLE_MAKE,windows,amd64,,$(BINARY_OUTPUT)windows/)
108
109 define BUNDLE
110 # $(1) -- Format output as .ZIP archive, rather than .tar.gzip (for older windows architecture)
111 # $(2) -- Binary Output Dir Name
112 # $(3) -- Step Platform Name
113 # $(4) -- Step Binary Architecture
114 # $(5) -- Step Binary Name (For Windows Comaptibility)
115 $(q) ./make/bundle.sh $(1) "$(BINARY_OUTPUT)$(2)" "$(RELEASE)" "$(VERSION)" "$(3)" "$(4)" "$(5)"
116 endef
117
118 bundle-linux: binary-linux binary-linux-arm64 binary-linux-armv7 binary-linux-mips
119 $(call BUNDLE,,linux,linux,amd64,step)
120 $(call BUNDLE,,linux.arm64,linux,arm64,step)
121 $(call BUNDLE,,linux.armv7,linux,armv7,step)
122 $(call BUNDLE,,linux.mips,linux,mips,step)
123
124 bundle-darwin: binary-darwin
125 $(call BUNDLE,,darwin,darwin,amd64,step)
126
127 bundle-windows: binary-windows
128 $(call BUNDLE,,windows,windows,amd64,step.exe)
129 $(call BUNDLE,--zip,windows,windows,amd64,step.exe)
130
131 .PHONY: binary-linux binary-darwin binary-windows bundle-linux bundle-darwin bundle-windows
132
133 #################################################
134 # Targets for creating step artifacts
135 #################################################
136
137 docker-artifacts: docker-$(PUSHTYPE)
138
139 .PHONY: docker-artifacts