Skip to content

Commit 2ba0d7c

Browse files
committed
dev: update Makefile
1 parent 09d3c43 commit 2ba0d7c

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build/

Makefile

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
VERSION=0.1.9
22

3-
all: deps release
4-
5-
deps:
6-
go get github.com/spf13/pflag
3+
.PHONY: all
4+
all: release
75

6+
.PHONY: release
87
release: release-deps
9-
gox -output="build/{{.Dir}}_{{.OS}}_{{.Arch}}" .
8+
gox \
9+
-osarch="!darwin/386" \
10+
-ldflags="-s -w -X main.version=$(VERSION)" \
11+
-asmflags="-trimpath" \
12+
-output="build/{{.Dir}}_{{.OS}}_{{.Arch}}" \
13+
.
1014

15+
.PHONY: release-deps
1116
release-deps:
12-
go get github.com/mitchellh/gox
17+
go install github.com/mitchellh/gox@latest
1318

14-
.PNONY: all release release-deps
19+
.PHONY: clean
20+
clean:
21+
rm -rf build

main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ var (
3434
smtpAddr = envOrStr("MH_SENDMAIL_SMTP_ADDR", "localhost:1025")
3535
)
3636

37+
// set via -ldflags.
38+
var version = "development"
39+
3740
func main() {
3841
var verbose bool
3942

@@ -51,7 +54,7 @@ func main() {
5154
recip := flag.Args()
5255

5356
if verbose {
54-
fmt.Fprintln(os.Stderr, smtpAddr, fromAddr)
57+
fmt.Fprintln(os.Stderr, "mhsendmail", version, smtpAddr, fromAddr)
5558
}
5659

5760
body, err := ioutil.ReadAll(os.Stdin)

0 commit comments

Comments
 (0)