Skip to content

Commit aad44f6

Browse files
committed
add Makefile
1 parent 90b22c9 commit aad44f6

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
CMD_PATH := cmd/git-remote-https+iap
2+
CMD_NAME := git-remote-https+iap
3+
4+
BIN_PATH := dist/bin/
5+
6+
version := $(shell git describe --match "v*.*" --abbrev=7 --tags --dirty)
7+
build_args := -ldflags "-X main.version=${version}"
8+
9+
.PHONY: all
10+
all: build
11+
12+
$(BIN_PATH):
13+
mkdir -p $@
14+
15+
build: $(BIN_PATH)
16+
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build ${build_args} -o $(BIN_PATH)${CMD_NAME}-darwin-amd64 ${CMD_PATH}/*.go
17+
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ${build_args} -o $(BIN_PATH)${CMD_NAME}-linux-amd64 ${CMD_PATH}/*.go
18+
19+
.PHONY: version
20+
version:
21+
@echo "$(version)"
22+
23+
.PHONY: clean
24+
clean:
25+
rm -rf $(BIN_PATH)

0 commit comments

Comments
 (0)