Skip to content

Commit 7c5a2f1

Browse files
committed
add Make to build binary
1 parent 26bfbab commit 7c5a2f1

File tree

8 files changed

+29
-0
lines changed

8 files changed

+29
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
tmp
2+
bin
23
templates
34
*.templ

Makefile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Version := $(shell git describe --tags --dirty)
2+
GitCommit := $(shell git rev-parse HEAD)
3+
LDFLAGS := "-s -w -X main.Version=$(Version) -X main.GitCommit=$(GitCommit)"
4+
5+
.PHONY: all
6+
all: gofmt vendor dist
7+
8+
.PHONY: gofmt
9+
gofmt:
10+
@test -z $(shell gofmt -l ./ | tee /dev/stderr) || (echo "[WARN] Fix formatting issues with 'make fmt'" && exit 1)
11+
12+
.PHONY: vendor
13+
vendor:
14+
go mod vendor
15+
16+
.PHONY: dist
17+
dist:
18+
mkdir -p bin/
19+
CGO_ENABLED=0 GOOS=linux go build -mod=vendor -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/templ-css-sort-amd64
20+
CGO_ENABLED=0 GOOS=darwin go build -mod=vendor -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/templ-css-sort-darwin
21+
GOARM=7 GOARCH=arm CGO_ENABLED=0 GOOS=linux go build -mod=vendor -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/templ-css-sort-arm
22+
GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -mod=vendor -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/templ-css-sort-arm64
23+
GOOS=windows CGO_ENABLED=0 go build -mod=vendor -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/templ-css-sort.exe
24+
25+
test:
26+
go test ./... -v -race

bin/release-it-amd64

1.69 MB
Binary file not shown.

bin/release-it-arm

1.75 MB
Binary file not shown.

bin/release-it-arm64

1.69 MB
Binary file not shown.

bin/release-it-darwin

1.74 MB
Binary file not shown.

bin/release-it.exe

1.76 MB
Binary file not shown.

vendor/modules.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# github.com/a-h/templ v0.2.747
2+
## explicit; go 1.21

0 commit comments

Comments
 (0)