This repository has been archived by the owner on Nov 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
GNUmakefile
62 lines (46 loc) · 1.45 KB
/
GNUmakefile
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
PROJECT_ROOT := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
default: build
.PHONY: clean
clean: ## Remove build artifacts
rm -rf $(PROJECT_ROOT)/pkg
.PHONY: build
build:
go install
.PHONY: test
test:
go test \
-timeout=15m \
./...
.PHONY: fmt
fmt:
@echo "==> Fixing source code with gofmt..."
gofmt -s -w ./lxc
.PHONY: lint-deps
lint-deps: ## Install linter dependencies
@echo "==> Updating linter dependencies..."
GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/[email protected]
.PHONY: check
check: ## Lint the source code
@echo "==> Linting source code..."
@golangci-lint run -j 1 --timeout=10m
.PHONY: changelogfmt
changelogfmt:
@echo "--> Making [GH-xxxx] references clickable..."
@sed -E 's|([^\[])\[GH-([0-9]+)\]|\1[[GH-\2](https://github.com/hashicorp/nomad/issues/\2)]|g' CHANGELOG.md > changelog.tmp && mv changelog.tmp CHANGELOG.md
ALL_TARGETS += linux_amd64
# Define package targets for each of the build targets we actually have on this system
define makePackageTarget
pkg/$(1).zip: pkg/$(1)/nomad-driver-lxc
@echo "==> Packaging for $(1)..."
@zip -j pkg/$(1).zip pkg/$(1)/*
endef
# Reify the package targets
$(foreach t,$(ALL_TARGETS),$(eval $(call makePackageTarget,$(t))))
pkg/linux_amd64/nomad-driver-lxc:
./scripts/build.sh
.PHONY: dev
dev: clean pkg/linux_amd64/nomad-driver-lxc
.PHONY: release
release: clean pkg/linux_amd64.zip
@echo "==> Result:"
@tree --dirsfirst $(PROJECT_ROOT)/pkg