-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (57 loc) · 2.58 KB
/
Copy pathMakefile
File metadata and controls
70 lines (57 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS := -ldflags "-X main.version=$(VERSION)"
BINARY := md-to-slack
CMD := ./cmd/md-to-slack
# macOS Developer ID signing / notarization (see nlink-jp/.github
# CONVENTIONS.md §Code Signing). Defaults match any Developer ID
# Application cert in the keychain and the org-standard notary
# profile. Builds without these fall back to ad-hoc / un-notarized
# with a one-line warning — see scripts/codesign-darwin.sh.
CODESIGN_IDENTITY ?= Developer ID Application
NOTARY_PROFILE ?= nlink-jp-notary
# darwin ships arm64 only (no amd64, no universal). linux/windows keep their matrix.
PLATFORMS := darwin/arm64 linux/amd64 linux/arm64 windows/amd64
.PHONY: build test vet lint check build-all package clean
build: _dist
go build $(LDFLAGS) -o dist/$(BINARY) $(CMD)
@scripts/codesign-darwin.sh dist/$(BINARY) "$(CODESIGN_IDENTITY)"
test:
go test ./...
vet:
go vet ./...
lint:
golangci-lint run ./...
check: vet lint test build
build-all: _dist
@for p in $(PLATFORMS); do os=$${p%/*}; arch=$${p#*/}; \
ext=""; [ "$$os" = windows ] && ext=".exe"; \
CGO_ENABLED=0 GOOS=$$os GOARCH=$$arch go build $(LDFLAGS) -o dist/$(BINARY)-$$os-$$arch$$ext $(CMD) ; \
done
@scripts/codesign-darwin.sh dist/$(BINARY)-darwin-arm64 "$(CODESIGN_IDENTITY)" "$(BINARY)"
## package: Build all platforms, archive with version suffix (zip for
## darwin/windows, tar.gz for linux), bundle the canonical binary +
## README.md + LICENSE, and notarize the darwin build → dist/. Asset
## naming follows the org Release Archive Standard
## (md-to-slack-vX.Y.Z-<os>-<arch>.<ext>).
package: build-all
@cd dist && for p in $(PLATFORMS); do os=$${p%/*}; arch=$${p#*/}; \
ext=""; [ "$$os" = windows ] && ext=".exe"; \
stage=_pkg; rm -rf $$stage; mkdir -p $$stage; \
cp "$(BINARY)-$$os-$$arch$$ext" "$$stage/$(BINARY)$$ext"; \
cp ../README.md ../LICENSE $$stage/; \
base="$(BINARY)-$(VERSION)-$$os-$$arch"; \
if [ "$$os" = linux ]; then ( cd $$stage && tar -czf "../$$base.tar.gz" * ); \
else ( cd $$stage && zip -q "../$$base.zip" * ); fi; \
rm -rf $$stage; \
done
@scripts/notarize-darwin.sh dist/$(BINARY)-$(VERSION)-darwin-arm64.zip "$(NOTARY_PROFILE)"
_dist:
mkdir -p dist
clean:
rm -rf dist/
# Homebrew tap generation (see scripts/release-brew.mk). After `make package`,
# `make brew` generates this formula from the built darwin-arm64 zip into the
# local nlink-jp/homebrew-tap checkout. The package target is unchanged.
BREW_KIND := formula
BREW_DESC := Markdown to Slack Block Kit JSON converter
include scripts/release-brew.mk