Skip to content

Commit

Permalink
Makefile: Make lxd-user and lxd-benchmark static binaries (#14205)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomponline authored Oct 4, 2024
2 parents 16f7a5e + e25bc21 commit d7c70e4
Showing 1 changed file with 4 additions and 40 deletions.
44 changes: 4 additions & 40 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ ifeq "$(TAG_SQLITE3)" ""
endif

ifeq "$(GOCOVERDIR)" ""
CC="$(CC)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" go install -v -tags "$(TAG_SQLITE3)" -trimpath $(DEBUG) ./lxd ./lxc-to-lxd ./lxd-user ./lxd-benchmark
CC="$(CC)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" go install -v -tags "$(TAG_SQLITE3)" -trimpath $(DEBUG) ./lxd ./lxc-to-lxd
CGO_ENABLED=0 go install -v -tags netgo -trimpath $(DEBUG) ./lxd-user ./lxd-benchmark
else
CC="$(CC)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" go install -v -tags "$(TAG_SQLITE3)" -trimpath -cover $(DEBUG) ./lxd ./lxc-to-lxd ./lxd-user ./lxd-benchmark
CC="$(CC)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" go install -v -tags "$(TAG_SQLITE3)" -trimpath -cover $(DEBUG) ./lxd ./lxc-to-lxd
CGO_ENABLED=0 go install -v -tags netgo -trimpath -cover $(DEBUG) ./lxd-user ./lxd-benchmark
endif

@echo "LXD built successfully"
Expand Down Expand Up @@ -171,29 +173,6 @@ endif
CGO_ENABLED=0 go install -v -trimpath -tags "agent,netgo,logdebug" ./lxd-agent
@echo "LXD built successfully"

.PHONY: nocache
nocache:
ifeq "$(TAG_SQLITE3)" ""
@echo "Missing custom libsqlite3, run \"make deps\" to setup."
exit 1
endif

CC="$(CC)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" go install -a -v -tags "$(TAG_SQLITE3)" $(DEBUG) ./...
CGO_ENABLED=0 go install -a -v -trimpath -tags netgo ./lxd-migrate
CGO_ENABLED=0 go install -a -v -trimpath -tags agent,netgo ./lxd-agent
@echo "LXD built successfully"

race:
ifeq "$(TAG_SQLITE3)" ""
@echo "Missing custom libsqlite3, run \"make deps\" to setup."
exit 1
endif

CC="$(CC)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" go install -race -v -tags "$(TAG_SQLITE3)" $(DEBUG) ./...
CGO_ENABLED=0 go install -v -trimpath -tags netgo ./lxd-migrate
CGO_ENABLED=0 go install -v -trimpath -tags agent,netgo ./lxd-agent
@echo "LXD built successfully"

.PHONY: check
check: default check-unit
cd test && ./main.sh
Expand Down Expand Up @@ -303,21 +282,6 @@ endif
fi
run-parts --verbose --exit-on-error --regex '.sh' test/lint

.PHONY: staticcheck
staticcheck:
ifeq ($(shell command -v staticcheck),)
(cd / ; go install honnef.co/go/tools/cmd/staticcheck@latest)
endif
# To get advance notice of deprecated function usage, consider running:
# sed -i 's/^go 1\.[0-9]\+$/go 1.18/' go.mod
# before 'make staticcheck'.

# Run staticcheck against all the dirs containing Go files.
staticcheck $$(git ls-files *.go | sed 's|^|./|; s|/[^/]\+\.go$$||' | sort -u)

tags: */*.go
find . -type f -name '*.go' | gotags -L - -f tags

.PHONY: update-auth
update-auth:
go generate ./lxd/auth

0 comments on commit d7c70e4

Please sign in to comment.