-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Create Makefile and Update README (#41)
* create makefile * update cfg section
- Loading branch information
Showing
2 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Makefile for tlin | ||
|
||
# Go parameters | ||
GOCMD=go | ||
GOBUILD=$(GOCMD) build | ||
GOTEST=$(GOCMD) test | ||
GOCLEAN=$(GOCMD) clean | ||
GOGET=$(GOCMD) get | ||
BINARY_NAME=tlin | ||
BINARY_UNIX=$(BINARY_NAME)_unix | ||
BINARY_WINDOWS=$(BINARY_NAME).exe | ||
BINARY_MAC=$(BINARY_NAME)_mac | ||
|
||
# Main package path | ||
MAIN_PACKAGE=./cmd/tlin | ||
|
||
# Build the project | ||
all: test build | ||
|
||
build: | ||
$(GOBUILD) -o $(BINARY_NAME) -v $(MAIN_PACKAGE) | ||
|
||
# Cross compilation | ||
build-linux: | ||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_UNIX) -v $(MAIN_PACKAGE) | ||
|
||
build-windows: | ||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GOBUILD) -o $(BINARY_WINDOWS) -v $(MAIN_PACKAGE) | ||
|
||
build-mac: | ||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GOBUILD) -o $(BINARY_MAC) -v $(MAIN_PACKAGE) | ||
|
||
test: | ||
$(GOTEST) -v ./... | ||
|
||
clean: | ||
$(GOCLEAN) | ||
rm -f $(BINARY_NAME) | ||
rm -f $(BINARY_UNIX) | ||
rm -f $(BINARY_WINDOWS) | ||
rm -f $(BINARY_MAC) | ||
|
||
run: | ||
$(GOBUILD) -o $(BINARY_NAME) -v $(MAIN_PACKAGE) | ||
./$(BINARY_NAME) | ||
|
||
# Cross compilation | ||
build-all: build-linux build-windows build-mac | ||
|
||
# Dependencies | ||
deps: | ||
$(GOGET) -v ./... | ||
|
||
# Install golangci-lint | ||
install-linter: | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin | ||
|
||
# Run golangci-lint | ||
lint: | ||
golangci-lint run | ||
|
||
.PHONY: all build test clean run deps build-linux build-windows build-mac build-all install-linter lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters