Add build target to Makefile
Add a build target to the Makefile that allows building a non static version if both garm and garm-cli. This is useful when you just need to build the binaries locally and make sure the version is properly set. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
9ed9e9eec5
commit
9e18d5d7a9
1 changed files with 8 additions and 0 deletions
8
Makefile
8
Makefile
|
|
@ -6,6 +6,7 @@ USER_ID=$(shell ((docker --version | grep -q podman) && echo "0" || id -u))
|
|||
USER_GROUP=$(shell ((docker --version | grep -q podman) && echo "0" || id -g))
|
||||
ROOTDIR=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
||||
GOPATH ?= $(shell go env GOPATH)
|
||||
VERSION ?= $(shell git describe --tags --match='v[0-9]*' --dirty --always)
|
||||
GO ?= go
|
||||
|
||||
|
||||
|
|
@ -18,6 +19,13 @@ build-static:
|
|||
docker run --rm -e USER_ID=$(USER_ID) -e USER_GROUP=$(USER_GROUP) -v $(PWD):/build/garm:z $(IMAGE_TAG) /build-static.sh
|
||||
@echo Binaries are available in $(PWD)/bin
|
||||
|
||||
build:
|
||||
@echo Building garm ${VERSION}
|
||||
$(shell mkdir -p ./bin)
|
||||
@$(GO) build -ldflags "-s -w -X main.Version=${VERSION}" -tags osusergo,netgo,sqlite_omit_load_extension -o bin/garm ./cmd/garm
|
||||
@$(GO) build -ldflags "-s -w -X github.com/cloudbase/garm/cmd/garm-cli/cmd.Version=${VERSION}" -tags osusergo,netgo,sqlite_omit_load_extension -o bin/garm-cli ./cmd/garm-cli
|
||||
@echo Binaries are available in $(PWD)/bin
|
||||
|
||||
install:
|
||||
@$(GO) install -tags osusergo,netgo,sqlite_omit_load_extension ./...
|
||||
@echo Binaries available in ${GOPATH}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue