Improve specification of command builds

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2023-08-10 09:11:53 -06:00
parent 5ff899293e
commit 0561c3009a
2 changed files with 16 additions and 21 deletions

View File

@@ -120,13 +120,11 @@ init:
cp -r tftpboot/* $(WWTFTPDIR)/ipxe/ cp -r tftpboot/* $(WWTFTPDIR)/ipxe/
restorecon -r $(WWTFTPDIR) restorecon -r $(WWTFTPDIR)
wwctl: config vendor $(WWCTL_DEPS) wwctl: config vendor $(call godeps,cmd/wwctl/main.go)
cd cmd/wwctl; GOOS=linux go build -mod vendor -tags "$(WW_GO_BUILD_TAGS)" \ GOOS=linux go build -mod vendor -tags "$(WW_GO_BUILD_TAGS)" -o wwctl cmd/wwctl/main.go
-o ../../wwctl
wwclient: config vendor $(WWCLIENT_DEPS) wwclient: config vendor $(call godeps,cmd/wwclient/main.go)
cd cmd/wwclient; CGO_ENABLED=0 GOOS=linux go build -mod vendor -a -ldflags "-extldflags -static" \ CGO_ENABLED=0 GOOS=linux go build -mod vendor -a -ldflags "-extldflags -static" -o wwclient cmd/wwclient/main.go
-o ../../wwclient
.PHONY: man_pages .PHONY: man_pages
man_pages: wwctl $(wildcard docs/man/man5/*.5) man_pages: wwctl $(wildcard docs/man/man5/*.5)
@@ -135,10 +133,18 @@ man_pages: wwctl $(wildcard docs/man/man5/*.5)
gzip --force docs/man/man1/*.1 gzip --force docs/man/man1/*.1
gzip --force --keep docs/man/man5/*.5 gzip --force --keep docs/man/man5/*.5
update_configuration: vendor cmd/update_configuration/update_configuration.go update_configuration: vendor $(call godeps,cmd/update_configuration/update_configuration.go)
cd cmd/update_configuration && go build \ go build -X 'github.com/hpcng/warewulf/internal/pkg/node.ConfigFile=./etc/nodes.conf'" \
-X 'github.com/hpcng/warewulf/internal/pkg/node.ConfigFile=./etc/nodes.conf'"\ -mod vendor -tags "$(WW_GO_BUILD_TAGS)" -o update_configuration cmd/update_configuration/update_configuration.go
-mod vendor -tags "$(WW_GO_BUILD_TAGS)" -o ../../update_configuration
wwapid: $(call godeps,internal/app/api/wwapid/wwapid.go)
go build -o ./wwapid internal/app/api/wwapid/wwapid.go
wwapic: $(call godeps,internal/app/api/wwapic/wwapic.go)
go build -o ./wwapic internal/app/api/wwapic/wwapic.go
wwapird: $(call godeps,internal/app/api/wwapird/wwapird.go)
go build -o ./wwapird internal/app/api/wwapird/wwapird.go
.PHONY: dist .PHONY: dist
dist: vendor config dist: vendor config
@@ -175,15 +181,6 @@ proto:
--go-grpc_out=. \ --go-grpc_out=. \
routes.proto routes.proto
wwapid:
go build -o ./wwapid internal/app/api/wwapid/wwapid.go
wwapic:
go build -o ./wwapic internal/app/api/wwapic/wwapic.go
wwapird:
go build -o ./wwapird internal/app/api/wwapird/wwapird.go
.PHONY: contclean .PHONY: contclean
contclean: contclean:
rm -f Defaults.mk rm -f Defaults.mk

View File

@@ -88,8 +88,6 @@ GOLANGCI_LINT_VERSION := v1.53.2
# helper functions # helper functions
godeps=$(shell go list -deps -f '{{if not .Standard}}{{ $$dep := . }}{{range .GoFiles}}{{$$dep.Dir}}/{{.}} {{end}}{{end}}' $(1) | sed "s%${PWD}/%%g") godeps=$(shell go list -deps -f '{{if not .Standard}}{{ $$dep := . }}{{range .GoFiles}}{{$$dep.Dir}}/{{.}} {{end}}{{end}}' $(1) | sed "s%${PWD}/%%g")
WWCTL_DEPS:=$(call godeps,cmd/wwctl/main.go)
WWCLIENT_DEPS:=$(call godeps,cmd/wwclient/main.go)
# use GOPROXY for older git clients and speed up downloads # use GOPROXY for older git clients and speed up downloads
GOPROXY ?= https://proxy.golang.org GOPROXY ?= https://proxy.golang.org