This repository was archived by the owner on Apr 30, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77* .dylib
88pcp$
99
10+ out /**
11+
1012# Test binary, built with `go test -c`
1113* .test
1214
Original file line number Diff line number Diff line change 1+ # ########################################################## #
2+ # Makefile for Golang Project
3+ # Includes cross-compiling, installation, cleanup
4+ # ########################################################## #
5+
6+ ROOT_DIR: =$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST ) ) ) )
7+
8+ BINARY =pcp
9+ VERSION =0.1.0
10+ BUILD =` git rev-parse HEAD `
11+ PLATFORMS =darwin linux windows
12+ ARCHITECTURES =386 amd64 arm
13+
14+ # Setup linker flags option for build that interoperate with variable names in src code
15+ LDFLAGS =-ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD}"
16+
17+ default : build
18+
19+ all : clean release install
20+
21+ build :
22+ go build ${LDFLAGS} -o ${BINARY} cmd/pcp/pcp.go
23+
24+ release :
25+ $(foreach GOOS, $(PLATFORMS ) ,\
26+ $(foreach GOARCH, $(ARCHITECTURES ) , $(shell export GOOS=$(GOOS ) ; export GOARCH=$(GOARCH ) ; go build -o out/$(BINARY ) -$(GOOS ) -$(GOARCH ) cmd/pcp/pcp.go) ) )
27+
28+ install :
29+ go install ${LDFLAGS}
30+
31+ # Remove only what we've created
32+ clean :
33+ rm -r out
34+
35+ .PHONY : check clean install release all
Original file line number Diff line number Diff line change 11package main
22
33import (
4+ "fmt"
45 "os"
56
67 "github.com/urfave/cli/v2"
@@ -11,17 +12,18 @@ import (
1112 "github.com/dennis-tra/pcp/pkg/send"
1213)
1314
14- const (
15+ var (
1516 // Version of the PCP command line tool.
16- Version = "0.0.1"
17+ Version = "compile-time"
18+ Build = "compile-time"
1719)
1820
1921func main () {
2022
2123 app := & cli.App {
2224 Name : "pcp" ,
2325 Usage : "Peer Copy, a peer-to-peer data transfer tool." ,
24- Version : Version ,
26+ Version : fmt . Sprintf ( "%s+%s" , Version , Build [: 7 ]) ,
2527 EnableBashCompletion : true ,
2628 Commands : []* cli.Command {
2729 receive .Command ,
You can’t perform that action at this time.
0 commit comments