-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcommon.mk
More file actions
72 lines (64 loc) · 1.95 KB
/
common.mk
File metadata and controls
72 lines (64 loc) · 1.95 KB
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
.SHELLFLAGS += -x -e
SHELL = /bin/bash
PWD = $(shell pwd)
UID = $(shell id -u)
GID = $(shell id -g)
VERSION = 0.40.5
VERSION_HASH = $(shell git rev-parse HEAD)
VERSION_HASH_SHORT = $(shell git rev-parse HEAD | head -c 8)
VERSION_TS = $(shell date +%s)
ifeq ($(OS),Windows_NT)
ARCH := $(PROCESSOR_ARCHITEW6432)
else
ARCH := $(shell dpkg-architecture -q DEB_BUILD_ARCH)
endif
PLATFORM := $(shell bash -c "uname -o | tr '[:upper:]' '[:lower:]'")
TOP = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
PROTO_DIR := "${TOP}/protobuf"
_LD_FLAGS = ${LD_FLAGS} -X goauthentik.io/platform/pkg/meta.Version=${VERSION} -X goauthentik.io/platform/pkg/meta.BuildHash=${VERSION_HASH}
GO_BUILD_FLAGS = -ldflags "${_LD_FLAGS}" -v ${AK_GO_BUILD_FLAGS}
RUST_BUILD_FLAGS =
TME := docker exec authentik-platform_devcontainer-test-machine-1
define lint_shellcheck
find $(1) -type f -name '*.sh' -exec "shellcheck" "--format=gcc" {} \;
endef
define sentry_upload_symbols
npx @sentry/cli debug-files upload \
--auth-token ${SENTRY_AUTH_TOKEN} \
--include-sources \
--org authentik-security-inc \
--project platform \
$(1)
endef
define go_generate_resources
go tool goversioninfo \
-icon="${TOP}/cmd/agent_local/package/windows/resources/icon.ico" \
-company="Authentik Security Inc." \
-copyright="2025 Authentik Security Inc." \
-file-version=${VERSION} \
-product-version=${VERSION} \
-comment="$(1)" \
-description="$(1)" \
-product-name="$(1)" \
-skip-versioninfo \
-64
endef
define nfpm_package
VERSION=${VERSION} VERSION_HASH_SHORT=${VERSION_HASH_SHORT} ARCH=${ARCH} \
go tool github.com/goreleaser/nfpm/v2/cmd/nfpm \
package \
-p deb \
-t ${TOP}/bin/${TARGET} \
-f $(1)
VERSION=${VERSION} VERSION_HASH_SHORT=${VERSION_HASH_SHORT} ARCH=${ARCH} \
go tool github.com/goreleaser/nfpm/v2/cmd/nfpm \
package \
-p rpm \
-t ${TOP}/bin/${TARGET} \
-f $(1)
endef
define _target_template
.PHONY: $(1)/%
$(1)/%:
"$(MAKE)" -C "${TOP}/$(1)" $$*
endef