Skip to content

Commit

Permalink
Remove unused hard link targets in Makefile
Browse files Browse the repository at this point in the history
We use $BINARY_NAME-$ARCH format in Calico builds and packaging
containers. The hard link targets in Makefile are not used and can be
removed. When building multiarchs, new links without $ARCH in the
binary name will overwrite existing ones which may cause unexpected
behaviors.
  • Loading branch information
hjiawei committed Sep 16, 2023
1 parent 8c5c84f commit 615c19f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 50 deletions.
12 changes: 4 additions & 8 deletions confd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,14 @@ clean:
###############################################################################
# Building the binary
###############################################################################
build: bin/confd
build: bin/confd-$(ARCH)
build-all: $(addprefix sub-build-,$(VALIDARCHES))
sub-build-%:
$(MAKE) build ARCH=$*

bin/confd-$(ARCH): $(SRC_FILES)
$(call build_static_cgo_boring_binary, $(PACKAGE_NAME), $@)

bin/confd: bin/confd-$(ARCH)
ifeq ($(ARCH),amd64)
ln -f bin/confd-$(ARCH) bin/confd
endif
ln -sf confd-$(ARCH) bin/confd

###############################################################################
# Unit Tests
Expand All @@ -49,7 +45,7 @@ UPDATE_EXPECTED_DATA?=false

.PHONY: test-kdd
## Run template tests against KDD
test-kdd: bin/confd bin/kubectl bin/bird bin/bird6 bin/calico-node bin/calicoctl bin/typha run-k8s-apiserver
test-kdd: bin/confd-$(ARCH) bin/kubectl bin/bird bin/bird6 bin/calico-node bin/calicoctl bin/typha run-k8s-apiserver
-git clean -fx etc/calico/confd
mkdir -p tests/logs
docker run --rm --net=host \
Expand Down Expand Up @@ -82,7 +78,7 @@ test-kdd: bin/confd bin/kubectl bin/bird bin/bird6 bin/calico-node bin/calicoctl

.PHONY: test-etcd
## Run template tests against etcd
test-etcd: bin/confd bin/etcdctl bin/bird bin/bird6 bin/calico-node bin/kubectl bin/calicoctl run-etcd run-k8s-apiserver
test-etcd: bin/confd-$(ARCH) bin/etcdctl bin/bird bin/bird6 bin/calico-node bin/kubectl bin/calicoctl run-etcd run-k8s-apiserver
-git clean -fx etc/calico/confd
mkdir -p tests/logs
docker run --rm --net=host \
Expand Down
12 changes: 1 addition & 11 deletions felix/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ clean-generated:
###############################################################################
# Building the binary
###############################################################################
BUILD_TARGETS:=bin/calico-felix
BUILD_TARGETS:=bin/calico-felix-$(ARCH)

ifeq ($(ARCH), $(filter $(ARCH),amd64 arm64))
# Currently CGO can be enabled in ARM64 and AMD64 builds.
Expand All @@ -155,9 +155,6 @@ build-all: $(addprefix sub-build-,$(VALIDARCHES))
sub-build-%:
$(MAKE) build ARCH=$*

bin/calico-felix: bin/calico-felix-$(ARCH)
ln -f bin/calico-felix-$(ARCH) bin/calico-felix

libbpf: $(LIBBPF_A)
$(LIBBPF_A): $(shell find bpf-gpl/include/libbpf -type f ! -name "*.a")
mkdir -p bpf-gpl/include/libbpf/src/$(ARCH)
Expand Down Expand Up @@ -569,9 +566,6 @@ cover-report: combined.coverprofile
column -t | \
grep -v '100\.0%'"

bin/calico-felix.transfer-url: bin/calico-felix
$(DOCKER_GO_BUILD) sh -c 'curl --upload-file bin/calico-felix https://transfer.sh/calico-felix > $@'

# Cross-compile Felix for Windows
bin/calico-felix.exe: $(SRC_FILES)
@echo Building felix for Windows...
Expand All @@ -581,10 +575,6 @@ bin/calico-felix.exe: $(SRC_FILES)
( ldd $@ 2>&1 | grep -q "Not a valid dynamic program\|not a dynamic executable" || \
( echo "Error: $@ was not statically linked"; false ) )'

.PHONY: patch-script
patch-script: bin/calico-felix.transfer-url
$(DOCKER_GO_BUILD) bash -c 'utils/make-patch-script.sh $$(cat bin/calico-felix.transfer-url)'

## Generate a diagram of Felix's internal calculation graph.
docs/calc.pdf: docs/calc.dot
cd docs/ && dot -Tpdf calc.dot -o calc.pdf
Expand Down
21 changes: 0 additions & 21 deletions felix/utils/make-patch-script.sh

This file was deleted.

11 changes: 1 addition & 10 deletions typha/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,11 @@ clean:
###############################################################################
# Building the binary
###############################################################################
build: $(BINDIR)/calico-typha
build: $(BINDIR)/calico-typha-$(ARCH)
build-all: $(addprefix sub-build-,$(VALIDARCHES))
sub-build-%:
$(MAKE) build ARCH=$*

$(BINDIR)/calico-typha: $(BINDIR)/calico-typha-$(ARCH)
ln -f $(BINDIR)/calico-typha-$(ARCH) $(BINDIR)/calico-typha

$(BINDIR)/wrapper: $(BINDIR)/wrapper-$(ARCH)
ln -f $(BINDIR)/wrapper-$(ARCH) $(BINDIR)/wrapper

$(BINDIR)/wrapper-$(ARCH): $(SRC_FILES) $(LOCAL_BUILD_DEP)
ifeq ($(ARCH), amd64)
ifeq ($(FIPS), true)
Expand Down Expand Up @@ -281,9 +275,6 @@ cover-report: combined.coverprofile
column -t | \
grep -v '100\.0%'"

$(BINDIR)/calico-typha.transfer-url: $(BINDIR)/calico-typha-$(ARCH)
$(DOCKER_RUN) $(CALICO_BUILD) sh -c 'curl --upload-file $(BINDIR)/calico-typha-$(ARCH) https://transfer.sh/calico-typha > $@'

# Install or update the tools used by the build
.PHONY: update-tools
update-tools:
Expand Down

0 comments on commit 615c19f

Please sign in to comment.