mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-21 15:57:49 +00:00
Add cmds target to makefile to build all go commands
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
6e1436cefb
commit
eb67968911
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,3 +3,5 @@ dist
|
|||||||
*.swo
|
*.swo
|
||||||
/coverage.out
|
/coverage.out
|
||||||
/test/output/
|
/test/output/
|
||||||
|
/nvidia-container-runtime
|
||||||
|
/nvidia-container-toolkit
|
||||||
|
20
Makefile
20
Makefile
@ -37,18 +37,26 @@ BUILDIMAGE ?= $(IMAGE):$(IMAGE_TAG)-devel
|
|||||||
EXAMPLES := $(patsubst ./examples/%/,%,$(sort $(dir $(wildcard ./examples/*/))))
|
EXAMPLES := $(patsubst ./examples/%/,%,$(sort $(dir $(wildcard ./examples/*/))))
|
||||||
EXAMPLE_TARGETS := $(patsubst %,example-%, $(EXAMPLES))
|
EXAMPLE_TARGETS := $(patsubst %,example-%, $(EXAMPLES))
|
||||||
|
|
||||||
CHECK_TARGETS := assert-fmt vet lint ineffassign misspell
|
CMDS := $(patsubst ./cmd/%/,%,$(sort $(dir $(wildcard ./cmd/*/))))
|
||||||
MAKE_TARGETS := binary build all check fmt lint-internal test examples coverage generate $(CHECK_TARGETS)
|
CMD_TARGETS := $(patsubst %,cmd-%, $(CMDS))
|
||||||
|
|
||||||
TARGETS := $(MAKE_TARGETS) $(EXAMPLE_TARGETS)
|
$(info CMD_TARGETS=$(CMD_TARGETS))
|
||||||
|
|
||||||
|
CHECK_TARGETS := assert-fmt vet lint ineffassign misspell
|
||||||
|
MAKE_TARGETS := binary build all check fmt lint-internal test examples cmds coverage generate $(CHECK_TARGETS)
|
||||||
|
|
||||||
|
TARGETS := $(MAKE_TARGETS) $(EXAMPLE_TARGETS) $(CMD_TARGETS)
|
||||||
|
|
||||||
DOCKER_TARGETS := $(patsubst %,docker-%, $(TARGETS))
|
DOCKER_TARGETS := $(patsubst %,docker-%, $(TARGETS))
|
||||||
.PHONY: $(TARGETS) $(DOCKER_TARGETS)
|
.PHONY: $(TARGETS) $(DOCKER_TARGETS)
|
||||||
|
|
||||||
GOOS ?= linux
|
GOOS ?= linux
|
||||||
|
|
||||||
binary:
|
binary: cmd-nvidia-container-toolkit
|
||||||
GOOS=$(GOOS) go build -ldflags "-s -w" -o "$(LIB_NAME)" $(MODULE)/cmd/$(LIB_NAME)
|
|
||||||
|
cmds: $(CMD_TARGETS)
|
||||||
|
$(CMD_TARGETS): cmd-%:
|
||||||
|
GOOS=$(GOOS) go build -ldflags "-s -w" $(MODULE)/cmd/$(*)
|
||||||
|
|
||||||
build:
|
build:
|
||||||
GOOS=$(GOOS) go build ./...
|
GOOS=$(GOOS) go build ./...
|
||||||
@ -95,7 +103,7 @@ vet:
|
|||||||
go vet $(MODULE)/...
|
go vet $(MODULE)/...
|
||||||
|
|
||||||
COVERAGE_FILE := coverage.out
|
COVERAGE_FILE := coverage.out
|
||||||
test: build
|
test: build cmds
|
||||||
go test -v -coverprofile=$(COVERAGE_FILE) $(MODULE)/...
|
go test -v -coverprofile=$(COVERAGE_FILE) $(MODULE)/...
|
||||||
|
|
||||||
coverage: test
|
coverage: test
|
||||||
|
Loading…
Reference in New Issue
Block a user