diff --git a/Makefile b/Makefile index ba692e0387879037399e936267296b918fcf335b..92ccb307b7716dc2dc62d915b8cbd351d414f419 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ export PATH := $(BIN_DIR):$(PATH) export GOMODCACHE = $(LOCAL_DIR)/cache/go export GOTMPDIR = $(TMP_DIR)/go - +export GOBIN = $(BIN_DIR) default: clean install build run @@ -39,6 +39,11 @@ $(BIN_DIR)/artifact.bin: -o $(@) \ $(SRC_DIR)/*.go +.PHONY: build-linux +build-linux: export GOOS := linux +build-linux: export GOARCH := amd64 +build-linux: $(BIN_DIR)/artifact.bin + .PHONY: test .SILENT: test diff --git a/README.md b/README.md index 0a309b88d5041d4454b8b227e3a8c3e8ce01947b..9ef0351bcae2bf3682d661893472d282f91e6a86 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Webservice ========== A Go-based simple web service meant to be the subject for any tutorial -or even the project work. +or maybe even the project work. __Prerequisites:__ @@ -10,11 +10,12 @@ __Prerequisites:__ * Go toolchain (install via system package manager or [by hand](https://go.dev/doc/install)) -__Main interactions:__ +__Primary interactions:__ 1. Install dependencies: `go get -t ./...` 2. Run locally: `go run .` 3. Execute unit tests: `go test -race -v ./...` 4. Build artifact: `go build -o ./artifact.bin ./*.go` -For more details, please refer to the `Makefile`. +To build for another platform, set `GOOS` and `GOARCH`. For more details, +please refer to the `Makefile`.