dae/Makefile

35 lines
1013 B
Makefile
Raw Normal View History

2023-01-23 18:54:21 +07:00
#
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright (c) since 2022, mzz2017 (mzz@tuta.io). All rights reserved.
#
# The development version of clang is distributed as the 'clang' binary,
# while stable/released versions have a version number attached.
# Pin the default clang to a stable version.
2023-01-27 01:10:27 +07:00
CLANG ?= clang-14
2023-01-23 18:54:21 +07:00
STRIP ?= llvm-strip
2023-01-27 01:10:27 +07:00
#CFLAGS := -O2 -g -Wall -Werror $(CFLAGS)
CFLAGS := -O2 -Wall -Werror $(CFLAGS)
# Get version from .git.
date=$(shell git log -1 --format="%cd" --date=short | sed s/-//g)
count=$(shell git rev-list --count HEAD)
commit=$(shell git rev-parse --short HEAD)
ifeq ($(wildcard .git/.),)
version=unstable-0.nogit
else
version=unstable-$(date).r$(count).$(commit)
endif
2023-01-23 18:54:21 +07:00
2023-01-23 19:01:24 +07:00
.PHONY: ebpf dae
dae: ebpf
2023-01-27 01:10:27 +07:00
go build -ldflags "-s -w -X github.com/v2rayA/dae/cmd.Version=$(version)" .
2023-01-23 18:54:21 +07:00
# $BPF_CLANG is used in go:generate invocations.
2023-01-23 19:01:24 +07:00
ebpf: export BPF_CLANG := $(CLANG)
ebpf: export BPF_STRIP := $(STRIP)
ebpf: export BPF_CFLAGS := $(CFLAGS)
ebpf:
go generate ./component/control/...