tstor/Makefile

41 lines
1.1 KiB
Makefile
Raw Normal View History

#-include .env
VERSION := $(shell git describe --tags)
BUILD := $(shell git rev-parse --short HEAD)
2023-10-08 16:46:03 +00:00
BIN_OUTPUT ?= bin/tstor-$(VERSION)-`go env GOOS`-`go env GOARCH``go env GOEXE`
PROJECTNAME := $(shell basename "$(PWD)")
# Use linker flags to provide version/build settings
LDFLAGS=-X=main.Version=$(VERSION) -X=main.Build=$(BUILD) -linkmode external
# Make is verbose in Linux. Make it silent.
MAKEFLAGS += --silent
## run: run from code.
run:
2023-10-08 16:46:03 +00:00
go run cmd/tstor/main.go examples/conf_example.yaml
## build: build binary.
build: go-generate go-build
2021-12-17 22:44:42 +00:00
## test-race: execute all tests with race enabled.
test-race:
2022-01-05 20:17:28 +00:00
go test -v --race -coverprofile=coverage.out ./...
2021-12-17 22:44:42 +00:00
## test: execute all tests
test:
2022-01-05 20:17:28 +00:00
go test -v -coverprofile=coverage.out ./...
2021-12-17 22:44:42 +00:00
go-build:
@echo " > Building binary on $(BIN_OUTPUT)..."
2023-10-08 16:46:03 +00:00
go build -o $(BIN_OUTPUT) -tags "release" -ldflags='$(LDFLAGS)' cmd/tstor/main.go
go-generate:
@echo " > Generating code files..."
go generate ./...
2024-03-17 21:00:34 +00:00
generate-graphql: src/delivery/graph/generated.go
src/delivery/graph/generated.go: .gqlgen.yml graphql/* graphql/types/* cmd/generate-graphql/*
go run cmd/generate-graphql/main.go