Skip to content

Commit

Permalink
Merge pull request #7 from DragonFlyBSD/chore-makefile
Browse files Browse the repository at this point in the history
chore: Add '-trimpath' build option and refactor Makefile.inc
  • Loading branch information
liweitianux authored Aug 3, 2024
2 parents d92094f + 6394a04 commit a86e741
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*.log
*.mmdb
/main
/mirrorselect
/mirrorselect-*-*
20 changes: 12 additions & 8 deletions Makefile.inc
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
MODULE= github.com/DragonFlyBSD/mirrorselect
PROG= mirrorselect
MODULE= github.com/DragonFlyBSD/$(PROG)

BUILD_ARGS+= -trimpath -ldflags "$(LDFLAGS)"

all:
CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o mirrorselect main.go
env CGO_ENABLED=0 \
go build $(BUILD_ARGS) -o $(PROG)

ci: all
CGO_ENABLED=0 GOOS=dragonfly GOARCH=amd64 \
go build -ldflags="$(LDFLAGS)" -o mirrorselect main.go
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 \
go build -ldflags="$(LDFLAGS)" -o mirrorselect main.go
env CGO_ENABLED=0 GOOS=dragonfly GOARCH=amd64 \
go build $(BUILD_ARGS) -o $(PROG)-dragonfly-amd64
env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 \
go build $(BUILD_ARGS) -o $(PROG)-freebsd-amd64

clean:
rm -f mirrorselect
rm -f $(PROG) $(PROG)-*-*

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

dbip: testdata/dbip-city-lite.mmdb
testdata/dbip-city-lite.mmdb:
curl https://download.db-ip.com/free/dbip-city-lite-2023-03.mmdb.gz | \
curl https://download.db-ip.com/free/dbip-city-lite-2024-08.mmdb.gz | \
gunzip > $@

0 comments on commit a86e741

Please sign in to comment.