Skip to content

Commit

Permalink
Fix Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
waynezhang committed Dec 29, 2023
1 parent 41cf686 commit 73d913f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
OUTPUT_PATH=bin
BINARY=foto

VERSION=`git tag | tr -d "v"`
VERSION=`git for-each-ref --sort=creatordate --format '%(refname)' refs/tags | tail -n 1 | sed 's/refs\/tags\/v\(.*\)/\1/g'`
BUILD_TIME=`date +%Y%m%d%H%M`

LDFLAGS=-ldflags "-X github.com/waynezhang/foto/internal/cmd.Version=${VERSION} -X github.com/waynezhang/foto/internal/cmd.Revision=${BUILD_TIME}"

all: build

build:
go build ${LDFLAGS} -o ${OUTPUT_PATH}/${BINARY} main.go
@go build ${LDFLAGS} -o ${OUTPUT_PATH}/${BINARY} main.go

.PHONY: install
install:
go install ${LDFLAGS} ./...
@go install ${LDFLAGS} ./...

.PHONY: clean
clean:
if [ -f ${OUTPUT_PATH}/${BINARY} ] ; then rm ${OUTPUT_PATH}/${BINARY} ; fi
@if [ -f ${OUTPUT_PATH}/${BINARY} ] ; then rm ${OUTPUT_PATH}/${BINARY} ; fi

0 comments on commit 73d913f

Please sign in to comment.