Skip to content

Commit 3acfa9c

Browse files
committed
chore: Add '-trimpath' build option and refactor Makefile.inc
- Add '-trimpath' option to build, so that the absolute full source paths are not included in the binary, which makes it more reproducible. In addition, we can later make the log messages print the full file paths instead of the final file names. - Refactor the Makefile.inc to clean up a bit. - Update the .gitignore accordingly.
1 parent d92094f commit 3acfa9c

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
*.log
22
*.mmdb
3-
/main
43
/mirrorselect
4+
/mirrorselect-*-*

Makefile.inc

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
MODULE= github.com/DragonFlyBSD/mirrorselect
1+
PROG= mirrorselect
2+
MODULE= github.com/DragonFlyBSD/$(PROG)
3+
4+
BUILD_ARGS+= -trimpath -ldflags "$(LDFLAGS)"
25

36
all:
4-
CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o mirrorselect main.go
7+
env CGO_ENABLED=0 \
8+
go build $(BUILD_ARGS) -o $(PROG)
59

610
ci: all
7-
CGO_ENABLED=0 GOOS=dragonfly GOARCH=amd64 \
8-
go build -ldflags="$(LDFLAGS)" -o mirrorselect main.go
9-
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 \
10-
go build -ldflags="$(LDFLAGS)" -o mirrorselect main.go
11+
env CGO_ENABLED=0 GOOS=dragonfly GOARCH=amd64 \
12+
go build $(BUILD_ARGS) -o $(PROG)-dragonfly-amd64
13+
env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 \
14+
go build $(BUILD_ARGS) -o $(PROG)-freebsd-amd64
1115

1216
clean:
13-
rm -f mirrorselect
17+
rm -f $(PROG) $(PROG)-*-*
1418

1519
test: dbip
1620
go test -v ./common ./geoip ./monitor ./workerpool

0 commit comments

Comments
 (0)