github.com/randomizedcoder/goTrackRTP@v0.0.2/cmd/goTrackRTPer/Makefile (about)

     1  #
     2  # Makefile
     3  #
     4  
     5  # ldflags variables to update --version
     6  # short commit hash
     7  COMMIT :=$(shell /usr/bin/git describe --always)
     8  DATE :=$(shell /bin/date -u +"%Y-%m-%d-%H:%M")
     9  BINARY := goTrackRTPer
    10  
    11  all: clean build version
    12  
    13  test:
    14  	go test
    15  
    16  clean:
    17  	[ -f ${BINARY} ] && /bin/rm -rf ./${BINARY} || true
    18  
    19  build:
    20  	CGO_ENABLED=0 go build -ldflags "-X main.commit=${COMMIT} -X main.date=${DATE}" -o ./${BINARY} ./${BINARY}.go
    21  
    22  # https://words.filippo.io/shrink-your-go-binaries-with-this-one-weird-trick/
    23  buildsmall:
    24  	CGO_ENABLED=0 go build -ldflags "-s -w -X main.commit=${COMMIT} -X main.date=${DATE}" -o ./${BINARY} ./${BINARY}.go
    25  
    26  shrink:
    27  	upx --brute ./${BINARY}
    28  
    29  version:
    30  	./${BINARY} --version
    31  
    32  #