Skip to content

Commit 13f6a06

Browse files
committed
Add Makefile
1 parent 7d60c71 commit 13f6a06

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
ws-tcp-relay
22
vendor
3+
_dist
4+
35
# Compiled Object files, Static and Dynamic libs (Shared Objects)
46
*.o
57
*.a

Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
SRC = $(wildcard *.go)
2+
BIN = ws-tcp-relay
3+
DIST_DIR = _dist
4+
5+
$(BIN): $(SRC) fmt ## Build binary for this platform
6+
go build -o "$(BIN)" $(SRC)
7+
8+
.PHONY: fmt dist clean help
9+
10+
dist: $(SRC) fmt ## Build distribution binaries for all platforms using gox
11+
@which gox &> /dev/null || go get github.com/mitchellh/gox
12+
gox -output "$(DIST_DIR)/$(BIN)_{{.OS}}_{{.Arch}}"
13+
14+
fmt: $(SRC) ## Lint with gofmt
15+
gofmt -w $(SRC)
16+
17+
clean: ## Clean up build files
18+
rm -rf $(DIST_DIR) $(BIN)
19+
20+
help:
21+
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

0 commit comments

Comments
 (0)