forked from siemens/wfx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (49 loc) · 1.5 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# SPDX-FileCopyrightText: 2023 Siemens AG
#
# SPDX-License-Identifier: Apache-2.0
#
# Author: Michael Adler <[email protected]>
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --jobs=$(shell nproc)
DESTDIR ?=
prefix ?= /usr/local
GO_TAGS = sqlite,postgres,mysql,plugin
export CGO_ENABLED=1
LD_FLAGS := -s -w
STATIC ?= 0
ifeq ($(STATIC), 1)
LD_FLAGS := -linkmode external -extldflags "-static" -s -w
endif
ALL_TARGETS := wfx wfxctl wfx-viewer wfx-loadtest
.PHONY: default
default:
@$(MAKE) -s $(ALL_TARGETS)
.PHONY: test
test:
go test -race -coverprofile=coverage.out -covermode=atomic -timeout 30s ./... "--tags=sqlite,testing,plugin"
.PHONY: install
install:
for target in $(ALL_TARGETS); do \
install -m 0755 -D $$target $(DESTDIR)$(prefix)/bin/$$target ; \
done
.PHONY: wfx wfxctl wfx-loadtest wfx-viewer
wfx wfxctl wfx-loadtest wfx-viewer:
@echo "Building $@"
@go build -trimpath -tags=$(GO_TAGS) \
-ldflags '$(LD_FLAGS) -X github.com/siemens/wfx/cmd/$@/metadata.Commit=$(shell git rev-parse HEAD | tr -d [:space:]) -X github.com/siemens/wfx/cmd/$@/metadata.Date=$(shell date -Iseconds)' \
./cmd/$@
.PHONY: plugins
plugins:
cd example/plugin && go build
.PHONY: contrib
contrib:
$(MAKE) -s -C contrib/remote-access
$(MAKE) -s -C contrib/config-deployment
.PHONY: clean
clean:
@$(RM) $(ALL_TARGETS) *.exe
@find . \( -name "*.db" -o -name "*.db-wal" -o -name "*.db-shm" -o -name "*.out" \) -delete