Skip to content

Commit

Permalink
Allow the copy-offload tester tool to be cross-compiled
Browse files Browse the repository at this point in the history
Signed-off-by: Dean Roehrich <[email protected]>
  • Loading branch information
roehrich-hpe committed Dec 13, 2024
1 parent 8823691 commit 87d84d9
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@
# Ignore build and test binaries.
bin/
testbin/
rpms/
crossbin/

# Daemon executables & libraries
daemons/compute/server/nnf-dm
daemons/compute/client-c/client
daemons/compute/client-c/client.a
daemons/compute/server/server
daemons/compute/client-go/client-go
daemons/lib-copy-offload/**/*.[ao]
daemons/lib-copy-offload/**/tester
daemons/copy-offload-testing/certs

*.swp
*.swo
*~
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ nnf-dm
.version
config/begin/*
rpms/
crossbin/

# Test binary, build with `go test -c`
*.test
Expand Down
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ build-copy-offload-with: $(LOCALBIN)
build-copy-offload-with: fmt vet ## Build standalone copy-offload daemon
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o bin/nnf-copy-offload daemons/copy-offload/cmd/main.go

CROSS_PLATFORM ?= linux/amd64
.PHONY: build-copy-offload-tester-cross
build-copy-offload-tester-cross: $(CROSSBIN)
build-copy-offload-tester-cross: ## Build standalone tester binary for $CROSS_PLATFORM
${CONTAINER_TOOL} build --platform=$(CROSS_PLATFORM) --output=type=local,dest=$(CROSSBIN) --no-cache -f daemons/lib-copy-offload/test-tool/Dockerfile.xplatform .

.PHONY: build-copy-offload-docker-local
build-copy-offload-docker-local: GOARCH = $(shell go env GOARCH)
build-copy-offload-docker-local: build-copy-offload-docker-with
Expand Down Expand Up @@ -296,6 +302,17 @@ clean-rpmbin:
rm -rf $(RPMBIN); \
fi

## Location to place cross-compiled tools
CROSSBIN ?= $(shell pwd)/crossbin
$(CROSSBIN):
mkdir $(CROSSBIN)

.PHONY: clean-crossbin
clean-crossbin:
if [[ -d $(CROSSBIN) ]]; then \
rm -rf $(CROSSBIN); \
fi

## Tool Binaries
KUSTOMIZE_IMAGE_TAG ?= ./hack/make-kustomization2.sh
KUSTOMIZE ?= $(LOCALBIN)/kustomize
Expand Down
5 changes: 2 additions & 3 deletions daemons/lib-copy-offload/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

CC = /usr/bin/gcc
AR = /usr/bin/ar
CC ?= /usr/bin/gcc
AR ?= /usr/bin/ar
CFLAGS = -Wall -Werror -g -I/opt/homebrew/include -I/opt/homebrew/opt/curl/include
LDFLAGS = -lcurl -L/opt/homebrew/lib -L/opt/homebrew/opt/curl/lib
xLDFLAGS = -lcrypto -lcurl -L/opt/homebrew/lib -L/opt/homebrew/opt/curl/lib
ARFLAGS = rcs

all: libcopyoffload.a tester
Expand Down

0 comments on commit 87d84d9

Please sign in to comment.