blob: 0c5ed2435c2a3a50928dfd7d276117ebd6e5e1e7 [file] [log] [blame]
Akron2ef703c2025-07-03 15:57:42 +02001MODULE = github.com/KorAP/Koral-Mapper
2CONFIG = github.com/KorAP/Koral-Mapper/config
Akronaa629162025-06-04 11:44:52 +02003DEV_DIR = $(shell pwd)
4BUILDDATE = $(shell date -u '+%Y-%m-%d_%I:%M:%S%p')
5BUILDVERSION = $(shell git describe --tags --abbrev=0 2>/dev/null)
6BUILDCOMMIT = $(shell git rev-parse --short HEAD)
7
8BUILDOUT =
9ifeq ($(ACTION), build)
Akron2ef703c2025-07-03 15:57:42 +020010 BUILDOUT = -o ./koralmapper
Akronaa629162025-06-04 11:44:52 +020011endif
12
13
14ifeq ($(strip $(BUILDVERSION)), )
15 BUILDVERSION = "EARLY"
16endif
17
18build:
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) \
Akron2ef703c2025-07-03 15:57:42 +020027 ./cmd/koralmapper/
Akronaa629162025-06-04 11:44:52 +020028
29update: ## Update all dependencies and clean up the dependency files.
30 go get -u all && go mod tidy
31
32test:
33 go test ./...
34
35bench: ## Run all benchmarks in the code.
36 go test -bench=. -benchmem ./... -run=^# -count 5
37
38vet: ## Run `go vet` on the code.
39 go vet ./...
40
41fuzz:
Akron2ef703c2025-07-03 15:57:42 +020042 go test -fuzz=FuzzTransformEndpoint -fuzztime=1m ./cmd/koralmapper
Akron50d5f832025-06-06 15:08:04 +020043
44docker:
Akron2ef703c2025-07-03 15:57:42 +020045 docker build -f Dockerfile -t korap/koral-mapper:latest .