export PATH := $(PATH):$(HOME)/go/bin IMAGE?=fedora:latest #LDFLAGS?=--ldflags '-extldflags "-static -ldl -lc -lm"' --ldflags="-X 'main.commit=$(shell git rev-parse HEAD)' -X 'main.version=$(shell git describe --tags)' -X 'main.date=$(shell date '+%Y-%m-%d %T.%s%z')'" export CC?=muscl-gcc LDFLAGS?=--ldflags '-extldflags "-static"' --ldflags="-X 'main.commit=$(shell git rev-parse HEAD)' -X 'main.version=$(shell git describe --tags)' -X 'main.date=$(shell date '+%Y-%m-%d %T.%s%z')'" export CGO_ENABLED=1 VERSION?=$(shell git describe --tags | sed -e 's/^v//' -e 's/-/_/g') .PHONY=jx-cli build: jx-cli jx-cli: go build -o jx $(LDFLAGS) ./cmd/cli/main.go test: jx-cli go test -coverprofile=artifacts/coverage.profile ./... go tool cover -html=artifacts/coverage.profile -o artifacts/code-coverage.html fedora-deps: ./jx apply build/rpm.jx.yaml spectool -g -R build/jx.spec curl -L -o - https://go.dev/dl/go1.22.3.linux-amd64.tar.gz | tar -zxvf - rpm: fedora-deps echo Building $(VERSION) rpmbuild -ba --define='version $(VERSION)' build/jx.spec ubuntu-deps: apt-get update -y apt-get install -y git make libluajit-5.1-dev iproute2 gcc curl curl -L -o - https://go.dev/dl/go1.22.3.linux-amd64.tar.gz | tar -zxvf - deb: ubuntu-deps : run: docker run -it -v $(HOME)/.git-credentials:/root/.git-credentials -v $(HOME)/.gitconfig:/root/.gitconfig -v /var/run/docker.sock:/var/run/docker.sock -v $(shell pwd):/src $(IMAGE) sh run-alpine: docker run -it -v $(HOME)/.git-credentials:/root/.git-credentials -v $(HOME)/.gitconfig:/root/.gitconfig -v /var/run/docker.sock:/var/run/docker.sock -v $(shell pwd):/src golang:1.22.6-alpine sh build-container: docker run -it -v $(HOME)/.git-credentials:/root/.git-credentials -v /tmp:/tmp -v $(HOME)/.gitconfig:/root/.gitconfig -v /var/run/docker.sock:/var/run/docker.sock -e WORKSPACE_PATH=$(shell pwd) -v $(shell pwd):/src -w /src rosskeenhouse/build-golang:1.22.6-alpine sh clean: go clean -modcache rm jx go-deps: go install google.golang.org/protobuf/cmd/protoc-gen-go@latest go install golang.org/x/vuln/cmd/govulncheck@latest lint: golangci-lint run --verbose ./... vulncheck: govulncheck ./... go vet ./...