-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
74 lines (52 loc) · 2.13 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
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/make -f
CURRENT_DIR = $(shell pwd)
BUILDDIR ?= $(CURDIR)/build
BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'
# check for nostrip option
ifeq (,$(findstring nostrip,$(COSMOS_BUILD_OPTIONS)))
BUILD_FLAGS += -trimpath
endif
# Check for debug option
ifeq (debug,$(findstring debug,$(COSMOS_BUILD_OPTIONS)))
BUILD_FLAGS += -gcflags "all=-N -l"
endif
###############################################################################
### Build ###
###############################################################################
BUILD_TARGETS := build
build: BUILD_ARGS=
build-linux-amd64:
GOOS=linux GOARCH=amd64 LEDGER_ENABLED=false $(MAKE) build
build-linux-arm64:
GOOS=linux GOARCH=arm64 LEDGER_ENABLED=false $(MAKE) build
$(BUILD_TARGETS): go.sum $(BUILDDIR)/
cd ${CURRENT_DIR} && go $@ -mod=readonly $(BUILD_FLAGS) $(BUILD_ARGS) ./...
$(BUILDDIR)/:
mkdir -p $(BUILDDIR)/
###############################################################################
### Test ###
###############################################################################
test:
@go test ./...
###############################################################################
### Tools & Dependencies ###
###############################################################################
go.sum: go.mod
@go mod verify
@go mod tidy
###############################################################################
### Linting ###
###############################################################################
golangci_version=v1.61.0
lint-install:
@echo "--> Installing golangci-lint $(golangci_version)"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
lint:
@echo "--> Running linter"
$(MAKE) lint-install
@golangci-lint run -c "./.golangci.yml"
lint-fix:
@echo "--> Running linter"
$(MAKE) lint-install
@golangci-lint run -c "./.golangci.yml" --fix
.PHONY: lint lint-fix