Skip to content

Commit

Permalink
fix: patch makefile to use correctly ldflags
Browse files Browse the repository at this point in the history
  • Loading branch information
lanathlor committed Dec 9, 2024
1 parent c735762 commit fb2af2d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PACKAGE=github.com/StamusNetworks/stamusctl/internal/app
LOGGER=github.com/StamusNetworks/stamusctl/internal/logging
PACKAGE=stamus-ctl/internal/app
LOGGER=stamus-ctl/internal/logging

CURRENT_DIR=$(shell pwd)
DIST_DIR=${CURRENT_DIR}/dist
Expand Down Expand Up @@ -29,21 +29,22 @@ override LDFLAGS += \
-X ${PACKAGE}.Arch=${TARGET_ARCH} \
-X ${PACKAGE}.Commit=${GIT_COMMIT} \
-X ${PACKAGE}.Version=${VERSION} \
-X ${LOGGER}.envType=prd
-X ${LOGGER}.envType=prd \
-extldflags=-static

all: cli daemon

cli:
CGO_ENABLED=0 GODEBUG="tarinsecurepath=0,zipinsecurepath=0" go build -v -ldflags '${LDFLAGS}' -ldflags="-extldflags=-static" -o ${DIST_DIR}/${CLI_NAME} ./cmd
CGO_ENABLED=0 GODEBUG="tarinsecurepath=0,zipinsecurepath=0" go build -v -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${CLI_NAME} ./cmd

test-cli:
CGO_ENABLED=0 GODEBUG="tarinsecurepath=0,zipinsecurepath=0" BUILD_MODE=test STAMUS_APP_NAME=stamusctl go build -v -ldflags '${LDFLAGS}' -ldflags="-extldflags=-static" -o ${DIST_DIR}/${CLI_NAME} ./cmd
CGO_ENABLED=0 GODEBUG="tarinsecurepath=0,zipinsecurepath=0" BUILD_MODE=test STAMUS_APP_NAME=stamusctl go build -v -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${CLI_NAME} ./cmd

test:
go test ./internal/models

daemon:
CGO_ENABLED=0 GODEBUG="tarinsecurepath=0,zipinsecurepath=0" go build -v -ldflags '${LDFLAGS}' -ldflags="-extldflags=-static" -o ${DIST_DIR}/${DAEMON_NAME} ./cmd
CGO_ENABLED=0 GODEBUG="tarinsecurepath=0,zipinsecurepath=0" go build -v -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${DAEMON_NAME} ./cmd

daemon-dev:
air run
Expand Down

0 comments on commit fb2af2d

Please sign in to comment.