Debian Codegraph @

rules.mk

raw symbols SCIP
1 # Only use the recipes defined in these makefiles
2 MAKEFLAGS += --no-builtin-rules
3 .SUFFIXES:
4 # Delete target files if there's an error
5 # This avoids a failure to then skip building on next run if the output is created by shell redirection for example
6 # Not really necessary for now, but just good to have already if it becomes necessary later.
7 .DELETE_ON_ERROR:
8 # Treat the whole recipe as a one shell script/invocation instead of one-per-line
9 .ONESHELL:
10 # Use bash instead of plain sh
11 SHELL := bash
12 .SHELLFLAGS := -o pipefail -euc
13
14 version := $(shell git rev-parse --short HEAD)
15 tag := $(shell git tag --points-at HEAD)
16 ifneq (,$(tag))
17 version := $(tag)-$(version)
18 endif
19 LDFLAGS := -ldflags "-X main.version=$(version)"
20 export CGO_ENABLED := 0
21
22 ifeq ($(origin GOBIN), undefined)
23 GOBIN := ${PWD}/bin
24 export GOBIN
25 PATH := ${GOBIN}:${PATH}
26 export PATH
27 endif
28
29 toolsBins := $(addprefix bin/,$(notdir $(shell grep '^\s*_' tooling/tools.go | awk -F'"' '{print $$2}')))
30
31 # installs cli tools defined in tools.go
32 $(toolsBins): tooling/go.mod tooling/go.sum tooling/tools.go
33 $(toolsBins): CMD=$(shell awk -F'"' '/$(@F)"/ {print $$2}' tooling/tools.go)
34 $(toolsBins):
35 cd tooling && go install $(CMD)
36
37 .PHONY: gofumpt
38 gofumpt: bin/gofumpt
39 gofumpt -s -d .
40
41 gofumpt-fix: bin/gofumpt
42 gofumpt -s -w .
43
44 .PHONY: prettier prettier-fix
45 prettier:
46 prettier --list-different --ignore-path .gitignore .
47
48 prettier-fix:
49 prettier --write --ignore-path .gitignore .