Akron | aa62916 | 2025-06-04 11:44:52 +0200 | [diff] [blame] | 1 | MODULE = github.com/KorAP/KoralPipe-TermMapper |
| 2 | CONFIG = github.com/KorAP/KoralPipe-TermMapper/config |
| 3 | DEV_DIR = $(shell pwd) |
| 4 | BUILDDATE = $(shell date -u '+%Y-%m-%d_%I:%M:%S%p') |
| 5 | BUILDVERSION = $(shell git describe --tags --abbrev=0 2>/dev/null) |
| 6 | BUILDCOMMIT = $(shell git rev-parse --short HEAD) |
| 7 | |
| 8 | BUILDOUT = |
| 9 | ifeq ($(ACTION), build) |
| 10 | BUILDOUT = -o ./termmapper |
| 11 | endif |
| 12 | |
| 13 | |
| 14 | ifeq ($(strip $(BUILDVERSION)), ) |
| 15 | BUILDVERSION = "EARLY" |
| 16 | endif |
| 17 | |
| 18 | build: |
| 19 | go build -v \ |
| 20 | -ldflags "-X $(CONFIG).Buildtime=$(BUILDDATE) \ |
| 21 | -X $(CONFIG).Buildhash=$(BUILDCOMMIT) \ |
| 22 | -X $(CONFIG).Version=$(BUILDVERSION) \ |
| 23 | -s \ |
| 24 | -w" \ |
| 25 | --trimpath \ |
| 26 | $(BUILDOUT) \ |
| 27 | ./cmd/termmapper/ |
| 28 | |
| 29 | update: ## Update all dependencies and clean up the dependency files. |
| 30 | go get -u all && go mod tidy |
| 31 | |
| 32 | test: |
| 33 | go test ./... |
| 34 | |
| 35 | bench: ## Run all benchmarks in the code. |
| 36 | go test -bench=. -benchmem ./... -run=^# -count 5 |
| 37 | |
| 38 | vet: ## Run `go vet` on the code. |
| 39 | go vet ./... |
| 40 | |
| 41 | fuzz: |
| 42 | go test -fuzz=FuzzTransformEndpoint -fuzztime=1m ./cmd/termmapper |