From dd912517108fcfbd3c8c70516804a66e1cc8d9f5 Mon Sep 17 00:00:00 2001 From: rkervella Date: Fri, 4 Nov 2022 16:14:06 -0700 Subject: [PATCH] Add debug target --- Makefile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Makefile b/Makefile index 241531873b..1017d72ea0 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,15 @@ LDFLAGS = -ldflags "-s -w \ -X $(CLIENT_ASSETS_PKG).DefaultArmoryPublicKey=$(ARMORY_PUB_KEY) \ -X $(CLIENT_ASSETS_PKG).DefaultArmoryRepoURL=$(ARMORY_REPO_URL)" +# Debug builds can't be stripped (-s -w flags) +LDFLAGS_DEBUG = -ldflags "-X $(VERSION_PKG).Version=$(VERSION) \ + -X \"$(VERSION_PKG).GoVersion=$(GO_VERSION)\" \ + -X $(VERSION_PKG).CompiledAt=$(COMPILED_AT) \ + -X $(VERSION_PKG).GithubReleasesURL=$(RELEASES_URL) \ + -X $(VERSION_PKG).GitCommit=$(GIT_COMMIT) \ + -X $(VERSION_PKG).GitDirty=$(GIT_DIRTY) \ + -X $(CLIENT_ASSETS_PKG).DefaultArmoryPublicKey=$(ARMORY_PUB_KEY) \ + -X $(CLIENT_ASSETS_PKG).DefaultArmoryRepoURL=$(ARMORY_REPO_URL)" SED_INPLACE := sed -i STATIC_TARGET := linux @@ -146,6 +155,11 @@ pb: protoc -I protobuf/ protobuf/dnspb/dns.proto --go_out=paths=source_relative:protobuf/ protoc -I protobuf/ protobuf/rpcpb/services.proto --go_out=paths=source_relative:protobuf/ --go-grpc_out=protobuf/ --go-grpc_opt=paths=source_relative +.PHONY: debug +debug: clean + $(ENV) $(GO) build -mod=vendor $(TAGS),server $(LDFLAGS_DEBUG) -o sliver-server$(ARTIFACT_SUFFIX) ./server + $(ENV) $(GO) build -mod=vendor $(TAGS),client $(LDFLAGS_DEBUG) -o sliver-client$(ARTIFACT_SUFFIX) ./client + validate-go-version: @if [ $(GO_MAJOR_VERSION) -gt $(MIN_SUPPORTED_GO_MAJOR_VERSION) ]; then \ exit 0 ;\