Add PREFIX make variable to control command output

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2021-09-06 13:45:46 +02:00
parent 35c6559013
commit 923344d376
6 changed files with 9 additions and 16 deletions

View File

@ -53,9 +53,12 @@ DOCKER_TARGETS := $(patsubst %,docker-%, $(TARGETS))
GOOS ?= linux GOOS ?= linux
binaries: cmds binaries: cmds
ifneq ($(PREFIX),)
cmd-%: COMMAND_BUILD_OPTIONS = -o $(PREFIX)/$(*)
endif
cmds: $(CMD_TARGETS) cmds: $(CMD_TARGETS)
$(CMD_TARGETS): cmd-%: $(CMD_TARGETS): cmd-%:
GOOS=$(GOOS) go build -ldflags "-s -w" $(MODULE)/cmd/$(*) GOOS=$(GOOS) go build -ldflags "-s -w" $(COMMAND_BUILD_OPTIONS) $(MODULE)/cmd/$(*)
build: build:
GOOS=$(GOOS) go build ./... GOOS=$(GOOS) go build ./...

View File

@ -40,9 +40,7 @@ RUN mkdir -p $DIST_DIR /dist
WORKDIR $GOPATH/src/nvidia-container-toolkit WORKDIR $GOPATH/src/nvidia-container-toolkit
COPY . . COPY . .
RUN make cmds && \ RUN make PREFIX=${DIST_DIR} cmds
mv ./nvidia-container-toolkit $DIST_DIR/nvidia-container-toolkit && \
mv ./nvidia-container-runtime $DIST_DIR/nvidia-container-runtime
COPY config/config.toml.amzn $DIST_DIR/config.toml COPY config/config.toml.amzn $DIST_DIR/config.toml

View File

@ -40,9 +40,7 @@ RUN mkdir -p $DIST_DIR /dist
WORKDIR $GOPATH/src/nvidia-container-toolkit WORKDIR $GOPATH/src/nvidia-container-toolkit
COPY . . COPY . .
RUN make cmds && \ RUN make PREFIX=${DIST_DIR} cmds
mv ./nvidia-container-toolkit $DIST_DIR/nvidia-container-toolkit && \
mv ./nvidia-container-runtime $DIST_DIR/nvidia-container-runtime
COPY config/config.toml.centos $DIST_DIR/config.toml COPY config/config.toml.centos $DIST_DIR/config.toml

View File

@ -48,9 +48,7 @@ RUN mkdir -p $DIST_DIR /dist
WORKDIR $GOPATH/src/nvidia-container-toolkit WORKDIR $GOPATH/src/nvidia-container-toolkit
COPY . . COPY . .
RUN make cmds && \ RUN make PREFIX=${DIST_DIR} cmds
mv ./nvidia-container-toolkit $DIST_DIR/nvidia-container-toolkit && \
mv ./nvidia-container-runtime $DIST_DIR/nvidia-container-runtime
COPY config/config.toml.debian $DIST_DIR/config.toml COPY config/config.toml.debian $DIST_DIR/config.toml

View File

@ -39,9 +39,7 @@ RUN mkdir -p $DIST_DIR /dist
WORKDIR $GOPATH/src/nvidia-container-toolkit WORKDIR $GOPATH/src/nvidia-container-toolkit
COPY . . COPY . .
RUN make cmds && \ RUN make PREFIX=${DIST_DIR} cmds
mv ./nvidia-container-toolkit $DIST_DIR/nvidia-container-toolkit && \
mv ./nvidia-container-runtime $DIST_DIR/nvidia-container-runtime
# Hook for Project Atomic's fork of Docker: https://github.com/projectatomic/docker/tree/docker-1.13.1-rhel#add-dockerhooks-exec-custom-hooks-for-prestartpoststop-containerspatch # Hook for Project Atomic's fork of Docker: https://github.com/projectatomic/docker/tree/docker-1.13.1-rhel#add-dockerhooks-exec-custom-hooks-for-prestartpoststop-containerspatch
COPY oci-nvidia-hook $DIST_DIR/oci-nvidia-hook COPY oci-nvidia-hook $DIST_DIR/oci-nvidia-hook

View File

@ -46,9 +46,7 @@ RUN mkdir -p $DIST_DIR /dist
WORKDIR $GOPATH/src/nvidia-container-toolkit WORKDIR $GOPATH/src/nvidia-container-toolkit
COPY . . COPY . .
RUN make cmds && \ RUN make PREFIX=${DIST_DIR} cmds
mv ./nvidia-container-toolkit $DIST_DIR/nvidia-container-toolkit && \
mv ./nvidia-container-runtime $DIST_DIR/nvidia-container-runtime
COPY config/config.toml.ubuntu $DIST_DIR/config.toml COPY config/config.toml.ubuntu $DIST_DIR/config.toml