40 lines
1.1 KiB
Makefile
40 lines
1.1 KiB
Makefile
#-include .env
|
|
|
|
VERSION := $(shell git describe --tags)
|
|
BUILD := $(shell git rev-parse --short HEAD)
|
|
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:
|
|
go run cmd/tstor/main.go examples/conf_example.yaml
|
|
|
|
## build: build binary.
|
|
build: go-generate go-build
|
|
|
|
## test-race: execute all tests with race enabled.
|
|
test-race:
|
|
go test -v --race -coverprofile=coverage.out ./...
|
|
|
|
## test: execute all tests
|
|
test:
|
|
go test -v -coverprofile=coverage.out ./...
|
|
|
|
go-build:
|
|
@echo " > Building binary on $(BIN_OUTPUT)..."
|
|
go build -o $(BIN_OUTPUT) -tags "release" -ldflags='$(LDFLAGS)' cmd/tstor/main.go
|
|
|
|
go-generate:
|
|
@echo " > Generating code files..."
|
|
go generate ./...
|
|
|
|
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
|