]> ruderich.org/simon Gitweb - safcm/safcm.git/blob - Makefile
Use SPDX license identifiers
[safcm/safcm.git] / Makefile
1 LDFLAGS = '\
2     -X "main.versionGit=$(shell git describe --long --tags --dirty --always) \
3 $(shell git show --no-patch --pretty=format:%as)" \
4     -X "main.versionGo=$(shell go version)" \
5 '
6 # Build with `make GOFLAGS=` if -race is not supported
7 GOFLAGS=-race
8
9
10 all: safcm
11
12 safcm:
13         go fmt ./...
14         cd cmd/safcm-remote && ./build.sh
15         go build $(GOFLAGS) -ldflags $(LDFLAGS) ruderich.org/simon/safcm/cmd/safcm
16
17 test:
18         @# For proper permissions after initial clone with a strict umask
19         cd cmd/safcm/testdata/project && ../../../../safcm fixperms 2> /dev/null
20         @#
21         ./cmd/safcm/testdata/ssh/prepare.sh
22         go vet ./...
23         go test $(GOFLAGS) ./...
24
25 lint:
26         shellcheck ci/run
27         shellcheck cmd/safcm-remote/build.sh
28         shellcheck cmd/safcm/testdata/ssh/prepare.sh
29
30 clean:
31         rm -rf cmd/safcm/remote/
32         rm -f safcm
33         rm -f cmd/safcm/testdata/ssh/ssh/authorized_keys
34         rm -f cmd/safcm/testdata/ssh/ssh/id_ed25519
35         rm -f cmd/safcm/testdata/ssh/ssh/id_ed25519.pub
36         rm -f cmd/safcm/testdata/ssh/ssh/known_hosts
37         rm -f cmd/safcm/testdata/ssh/sshd/ssh_host_key
38         rm -f cmd/safcm/testdata/ssh/sshd/ssh_host_key.pub
39         rm -rf cmd/safcm/testdata/ssh/project/no-changes.example.org/
40
41 .PHONY: all test clean safcm