2022-08-26 14:18:35 +03:00
|
|
|
# Keep the Makefile POSIX-compliant. We currently allow hyphens in
|
|
|
|
# target names, but that may change in the future.
|
|
|
|
#
|
|
|
|
# See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html.
|
|
|
|
.POSIX:
|
|
|
|
|
2022-12-29 15:36:26 +03:00
|
|
|
# This comment is used to simplify checking local copies of the
|
2022-11-29 18:20:10 +03:00
|
|
|
# Makefile. Bump this number every time a significant change is made to
|
|
|
|
# this Makefile.
|
2022-12-29 15:36:26 +03:00
|
|
|
#
|
|
|
|
# AdGuard-Project-Version: 2
|
2022-11-29 18:20:10 +03:00
|
|
|
|
2023-08-08 18:31:48 +03:00
|
|
|
# Don't name these macros "GO" etc., because GNU Make apparently makes
|
2022-11-29 18:20:10 +03:00
|
|
|
# them exported environment variables with the literal value of
|
|
|
|
# "${GO:-go}" and so on, which is not what we need. Use a dot in the
|
|
|
|
# name to make sure that users don't have an environment variable with
|
|
|
|
# the same name.
|
2022-08-26 14:18:35 +03:00
|
|
|
#
|
|
|
|
# See https://unix.stackexchange.com/q/646255/105635.
|
|
|
|
GO.MACRO = $${GO:-go}
|
2022-11-29 18:20:10 +03:00
|
|
|
VERBOSE.MACRO = $${VERBOSE:-0}
|
2022-08-26 14:18:35 +03:00
|
|
|
|
|
|
|
BRANCH = $$( git rev-parse --abbrev-ref HEAD )
|
2022-11-29 18:20:10 +03:00
|
|
|
GOAMD64 = v1
|
|
|
|
GOPROXY = https://goproxy.cn|https://proxy.golang.org|direct
|
|
|
|
RACE = 0
|
2022-08-26 14:18:35 +03:00
|
|
|
REVISION = $$( git rev-parse --short HEAD )
|
2022-11-29 18:20:10 +03:00
|
|
|
VERSION = 0
|
2022-08-26 14:18:35 +03:00
|
|
|
|
|
|
|
ENV = env\
|
|
|
|
BRANCH="$(BRANCH)"\
|
|
|
|
GO="$(GO.MACRO)"\
|
|
|
|
GOAMD64='$(GOAMD64)'\
|
|
|
|
GOPROXY='$(GOPROXY)'\
|
|
|
|
PATH="$${PWD}/bin:$$( "$(GO.MACRO)" env GOPATH )/bin:$${PATH}"\
|
|
|
|
RACE='$(RACE)'\
|
|
|
|
REVISION="$(REVISION)"\
|
2022-11-29 18:20:10 +03:00
|
|
|
VERBOSE="$(VERBOSE.MACRO)"\
|
2022-08-26 14:18:35 +03:00
|
|
|
VERSION="$(VERSION)"\
|
|
|
|
|
|
|
|
# Keep the line above blank.
|
|
|
|
|
2022-11-29 18:20:10 +03:00
|
|
|
# Keep this target first, so that a naked make invocation triggers a
|
|
|
|
# full build.
|
2022-08-26 14:18:35 +03:00
|
|
|
build: go-deps go-build
|
|
|
|
|
2022-11-29 18:20:10 +03:00
|
|
|
init: ; git config core.hooksPath ./scripts/hooks
|
2022-08-26 14:18:35 +03:00
|
|
|
|
|
|
|
test: go-test
|
|
|
|
|
2022-11-29 18:20:10 +03:00
|
|
|
go-bench: ; $(ENV) "$(SHELL)" ./scripts/make/go-bench.sh
|
2022-08-26 14:18:35 +03:00
|
|
|
go-build: ; $(ENV) "$(SHELL)" ./scripts/make/go-build.sh
|
|
|
|
go-deps: ; $(ENV) "$(SHELL)" ./scripts/make/go-deps.sh
|
2023-09-06 08:22:07 +03:00
|
|
|
go-gen: ; $(ENV) "$(SHELL)" ./scripts/make/go-gen.sh
|
2022-08-26 14:18:35 +03:00
|
|
|
go-lint: ; $(ENV) "$(SHELL)" ./scripts/make/go-lint.sh
|
|
|
|
go-test: ; $(ENV) RACE='1' "$(SHELL)" ./scripts/make/go-test.sh
|
|
|
|
go-tools: ; $(ENV) "$(SHELL)" ./scripts/make/go-tools.sh
|
|
|
|
|
|
|
|
go-check: go-tools go-lint go-test
|
|
|
|
|
|
|
|
# A quick check to make sure that all operating systems relevant to the
|
|
|
|
# development of the project can be typechecked and built successfully.
|
|
|
|
go-os-check:
|
|
|
|
env GOOS='darwin' "$(GO.MACRO)" vet ./internal/...
|
|
|
|
env GOOS='linux' "$(GO.MACRO)" vet ./internal/...
|
|
|
|
# Additionally, check the AdGuard Home OSs in the dnsserver module.
|
|
|
|
env GOOS='freebsd' "$(GO.MACRO)" vet ./internal/dnsserver/...
|
|
|
|
env GOOS='openbsd' "$(GO.MACRO)" vet ./internal/dnsserver/...
|
|
|
|
env GOOS='windows' "$(GO.MACRO)" vet ./internal/dnsserver/...
|
|
|
|
|
|
|
|
txt-lint: ; $(ENV) "$(SHELL)" ./scripts/make/txt-lint.sh
|
|
|
|
|
|
|
|
sync-github: ; $(ENV) "$(SHELL)" ./scripts/make/github-sync.sh
|