fix makefile

This commit is contained in:
yusing 2025-01-22 06:14:02 +08:00
parent b984386bab
commit 495c2c7390
2 changed files with 10 additions and 7 deletions

View file

@ -17,14 +17,14 @@ RUN --mount=type=cache,target="/go/pkg/mod" \
ENV GOCACHE=/root/.cache/go-build
ARG VERSION
ENV VERSION=${VERSION}
COPY Makefile /src/
COPY cmd /src/cmd
COPY internal /src/internal
COPY pkg /src/pkg
ARG VERSION
ENV VERSION=${VERSION}
ARG BUILD_FLAGS
ENV BUILD_FLAGS=${BUILD_FLAGS}

View file

@ -5,7 +5,7 @@ export GOOS = linux
LDFLAGS = -X github.com/yusing/go-proxy/pkg.version=${VERSION}
ifeq ($(trace), 1)
GODOXY_TRACE=1
GODOXY_TRACE ?= 1
endif
ifeq ($(debug), 1)
@ -14,10 +14,11 @@ ifeq ($(debug), 1)
BUILD_FLAGS = ''
else ifeq ($(pprof), 1)
CGO_ENABLED = 1
GODEBUG=gctrace=1 inittrace=1 schedtrace=3000
GORACE=log_path=logs/pprof strip_path_prefix=$(shell pwd)/
BUILD_FLAGS = -race -gcflags=all="-N -l" -tags pprof
GODEBUG = gctrace=1 inittrace=1 schedtrace=3000
GORACE = log_path=logs/pprof strip_path_prefix=$(shell pwd)/
BUILD_FLAGS = -race -gcflags=all='-N -l' -tags pprof
DOCKER_TAG = pprof
VERSION += -pprof
else
CGO_ENABLED = 0
LDFLAGS += -s -w
@ -25,6 +26,8 @@ else
DOCKER_TAG = latest
endif
BUILD_FLAGS += -ldflags='$(LDFLAGS)'
export CGO_ENABLED
export GODOXY_DEBUG
export GODOXY_TRACE