-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
42 lines (31 loc) · 1.01 KB
/
Makefile
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
DIST_DIRS := find dist -depth 1 -type d -execdir
VERSION := $(patsubst v%,%,$(shell git describe --tags))
LDFLAGS := -ldflags "-X 'github.com/gotgenes/getignore/pkg/getignore.Version=${VERSION}'"
build:
go build ${LDFLAGS} ./cmd/getignore
install:
go install ${LDFLAGS} ./cmd/getignore
dev-install:
go install github.com/onsi/ginkgo/v2/[email protected]
test:
go vet ./...
ginkgo -r ${LDFLAGS}
acceptance-test: build
bats test/
test-all: test acceptance-test
tag:
git tag -a -m "Release $(version)" v$(version)
clean:
rm -f ./getignore
rm -rf ./dist
build-all:
gox \
${LDFLAGS} \
-osarch="darwin/amd64 darwin/arm64 linux/386 linux/amd64 linux/arm linux/arm64 windows/amd64" \
-output="dist/getignore-${VERSION}-{{.OS}}-{{.Arch}}/{{.Dir}}" \
./cmd/getignore
dist: build-all
$(DIST_DIRS) cp -r ../LICENSE ../README.md ../completions {} \; && \
$(DIST_DIRS) tar -zcf {}.tar.gz {} \; && \
$(DIST_DIRS) zip -r {}.zip {} \;
.PHONY: build test acceptance-test test-all install dev-install tag clean build-all dist