Adguardhome/Makefile
Ainar Garipov 54e6e30022
Some checks failed
build / test (macOS-latest) (push) Has been cancelled
build / test (ubuntu-latest) (push) Has been cancelled
build / test (windows-latest) (push) Has been cancelled
lint / go-lint (push) Has been cancelled
lint / eslint (push) Has been cancelled
build / build-release (push) Has been cancelled
build / notify (push) Has been cancelled
lint / notify (push) Has been cancelled
Pull request 2674: custom-flt-upd-ivl
Squashed commit of the following:

commit 37db2dd9d3
Author: Ainar Garipov <a.garipov@adguard.com>
Date:   Tue Jun 9 20:37:36 2026 +0300

    filtering: imp docs

commit 1ebd8f30c6
Author: Ainar Garipov <a.garipov@adguard.com>
Date:   Tue Jun 9 17:55:40 2026 +0300

    all: allow custom filter update intervals
2026-06-10 10:32:48 +00:00

152 lines
5.3 KiB
Makefile

# 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/9799919799/utilities/make.html.
.POSIX:
# This comment is used to simplify checking local copies of the Makefile. Bump
# this number every time a significant change is made to this Makefile.
#
# AdGuard-Project-Version: 12
# Don't name these macros "GO" etc., because GNU Make apparently makes 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.
#
# See https://unix.stackexchange.com/q/646255/105635.
GO.MACRO = $${GO:-go}
VERBOSE.MACRO = $${VERBOSE:-0}
CHANNEL = development
CLIENT_DIR = client
DEPLOY_SCRIPT_PATH = not/a/real/path
DIST_DIR = dist
GOAMD64 = v1
GOPROXY = https://proxy.golang.org|direct
GOTELEMETRY = off
GOTOOLCHAIN = go1.26.4
GPG_KEY = devteam@adguard.com
GPG_KEY_PASSPHRASE = not-a-real-password
NPM = npm
NPM_FLAGS = --prefix $(CLIENT_DIR)
NPM_INSTALL_FLAGS = $(NPM_FLAGS) --quiet --no-progress
RACE = 0
REVISION = $${REVISION:-$$(git rev-parse --short HEAD)}
SIGN = 1
SIGNER_API_KEY = not-a-real-key
VERSION = v0.0.0
NEXTAPI = 0
# Macros for the build-release target. If FRONTEND_PREBUILT is 0, the default,
# the macro $(BUILD_RELEASE_DEPS_$(FRONTEND_PREBUILT)) expands into
# BUILD_RELEASE_DEPS_0, and so both frontend and backend dependencies are
# fetched and the frontend is built. Otherwise, if FRONTEND_PREBUILT is 1, only
# backend dependencies are fetched and the frontend isn't rebuilt.
#
# TODO(a.garipov): We could probably do that from .../build-release.sh, but that
# would mean either calling make from inside make or duplicating commands in two
# places, both of which don't seem to me like nice solutions.
FRONTEND_PREBUILT = 0
BUILD_RELEASE_DEPS_0 = deps js-build
BUILD_RELEASE_DEPS_1 = go-deps
# TODO(f.setrakov): Remove the bin directory from the paths, as it is no longer
# needed.
ENV = env \
CHANNEL='$(CHANNEL)' \
DEPLOY_SCRIPT_PATH='$(DEPLOY_SCRIPT_PATH)' \
DIST_DIR='$(DIST_DIR)' \
GO="$(GO.MACRO)" \
GOAMD64='$(GOAMD64)' \
GOPROXY='$(GOPROXY)' \
GOTELEMETRY='$(GOTELEMETRY)' \
GOTOOLCHAIN='$(GOTOOLCHAIN)' \
GPG_KEY='$(GPG_KEY)' \
GPG_KEY_PASSPHRASE='$(GPG_KEY_PASSPHRASE)' \
NEXTAPI='$(NEXTAPI)' \
PATH="$${PWD}/bin:$$("$(GO.MACRO)" env GOPATH)/bin:$${PATH}" \
RACE='$(RACE)' \
REVISION="$(REVISION)" \
SIGN='$(SIGN)' \
SIGNER_API_KEY='$(SIGNER_API_KEY)' \
VERBOSE="$(VERBOSE.MACRO)" \
VERSION="$(VERSION)" \
# Keep the line above blank.
ENV_MISC = env \
PATH="$${PWD}/bin:$$("$(GO.MACRO)" env GOPATH)/bin:$${PATH}" \
VERBOSE="$(VERBOSE.MACRO)" \
# Keep the line above blank.
# Keep this target first, so that a naked make invocation triggers a full build.
.PHONY: build
build: deps quick-build
.PHONY: init
init: ; git config core.hooksPath ./scripts/hooks
.PHONY: quick-build
quick-build: js-build go-build
.PHONY: deps lint test
deps: js-deps go-deps
lint: js-lint go-lint
test: js-test go-test
# Here and below, keep $(SHELL) in quotes, because on Windows this will expand
# to something like "C:/Program Files/Git/usr/bin/sh.exe".
.PHONY: build-docker
build-docker: ; $(ENV) "$(SHELL)" ./scripts/make/build-docker.sh
.PHONY: build-release
build-release: $(BUILD_RELEASE_DEPS_$(FRONTEND_PREBUILT))
$(ENV) "$(SHELL)" ./scripts/make/build-release.sh
.PHONY: js-build js-deps js-typecheck js-lint js-test js-test-e2e
js-build: ; $(NPM) $(NPM_FLAGS) run build-prod
js-deps: ; $(NPM) $(NPM_INSTALL_FLAGS) ci
js-typecheck: ; $(NPM) $(NPM_FLAGS) run typecheck
js-lint: ; $(NPM) $(NPM_FLAGS) run lint
js-test: ; $(NPM) $(NPM_FLAGS) run test
js-test-e2e: ; $(NPM) $(NPM_FLAGS) run test:e2e
# TODO(a.garipov): Think about making RACE='1' the default for all targets.
.PHONY: go-bench go-build go-deps go-env go-fuzz go-lint go-test go-upd-tools
go-bench: ; $(ENV) "$(SHELL)" ./scripts/make/go-bench.sh
go-build: ; $(ENV) "$(SHELL)" ./scripts/make/go-build.sh
go-deps: ; $(ENV) "$(SHELL)" ./scripts/make/go-deps.sh
go-env: ; $(ENV) "$(GO.MACRO)" env
go-fuzz: ; $(ENV) "$(SHELL)" ./scripts/make/go-fuzz.sh
go-lint: ; $(ENV) "$(SHELL)" ./scripts/make/go-lint.sh
go-test: ; $(ENV) RACE='1' "$(SHELL)" ./scripts/make/go-test.sh
go-upd-tools: ; $(ENV) "$(SHELL)" ./scripts/make/go-upd-tools.sh
.PHONY: go-check
go-check: 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.
#
# NOTE: It is also important to check on both 32- and 64-bit systems.
.PHONY: go-os-check
go-os-check:
$(ENV) GOOS='darwin' "$(GO.MACRO)" vet ./...
$(ENV) GOOS='freebsd' "$(GO.MACRO)" vet ./...
$(ENV) GOOS='openbsd' "$(GO.MACRO)" vet ./...
$(ENV) GOOS='windows' "$(GO.MACRO)" vet ./...
$(ENV) GOARCH='amd64' GOOS='linux' "$(GO.MACRO)" vet ./...
$(ENV) GOARCH='386' GOOS='linux' "$(GO.MACRO)" vet ./...
.PHONY: txt-lint
txt-lint: ; $(ENV) "$(SHELL)" ./scripts/make/txt-lint.sh
.PHONY: md-lint sh-lint
md-lint: ; $(ENV_MISC) "$(SHELL)" ./scripts/make/md-lint.sh
sh-lint: ; $(ENV_MISC) "$(SHELL)" ./scripts/make/sh-lint.sh
# TODO(a.garipov): Re-add openapi-lint.