65 lines
1.5 KiB
Makefile
65 lines
1.5 KiB
Makefile
# Code generated by go.einride.tech/sage. DO NOT EDIT.
|
|
# To learn more, see ../../.sage/main.go and https://github.com/einride/sage.
|
|
|
|
.DEFAULT_GOAL := all
|
|
|
|
cwd := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
|
|
sagefile := $(abspath $(cwd)/../../.sage/bin/sagefile)
|
|
|
|
# Setup Go.
|
|
go := $(shell command -v go 2>/dev/null)
|
|
export GOWORK ?= off
|
|
ifndef go
|
|
SAGE_GO_VERSION ?= 1.20.2
|
|
export GOROOT := $(abspath $(cwd)/../../.sage/tools/go/$(SAGE_GO_VERSION)/go)
|
|
export PATH := $(PATH):$(GOROOT)/bin
|
|
go := $(GOROOT)/bin/go
|
|
os := $(shell uname | tr '[:upper:]' '[:lower:]')
|
|
arch := $(shell uname -m)
|
|
ifeq ($(arch),x86_64)
|
|
arch := amd64
|
|
endif
|
|
$(go):
|
|
$(info installing Go $(SAGE_GO_VERSION)...)
|
|
@mkdir -p $(dir $(GOROOT))
|
|
@curl -sSL https://go.dev/dl/go$(SAGE_GO_VERSION).$(os)-$(arch).tar.gz | tar xz -C $(dir $(GOROOT))
|
|
@touch $(GOROOT)/go.mod
|
|
@chmod +x $(go)
|
|
endif
|
|
|
|
.PHONY: $(sagefile)
|
|
$(sagefile): $(go)
|
|
@cd ../../.sage && $(go) mod tidy && $(go) run .
|
|
|
|
.PHONY: sage
|
|
sage:
|
|
@$(MAKE) $(sagefile)
|
|
|
|
.PHONY: update-sage
|
|
update-sage: $(go)
|
|
@cd ../../.sage && $(go) get -d go.einride.tech/sage@latest && $(go) mod tidy && $(go) run .
|
|
|
|
.PHONY: clean-sage
|
|
clean-sage:
|
|
@git clean -fdx ../../.sage/tools ../../.sage/bin ../../.sage/build
|
|
|
|
.PHONY: all
|
|
all: $(sagefile)
|
|
@$(sagefile) Proto:All
|
|
|
|
.PHONY: buf-format
|
|
buf-format: $(sagefile)
|
|
@$(sagefile) Proto:BufFormat
|
|
|
|
.PHONY: buf-generate
|
|
buf-generate: $(sagefile)
|
|
@$(sagefile) Proto:BufGenerate
|
|
|
|
.PHONY: buf-lint
|
|
buf-lint: $(sagefile)
|
|
@$(sagefile) Proto:BufLint
|
|
|
|
.PHONY: build
|
|
build: $(sagefile)
|
|
@$(sagefile) Proto:Build
|