From a8ec8c8bb9db41572ab4122f603531376c82399d Mon Sep 17 00:00:00 2001 From: Hamza El-Saawy <84944216+helsaawy@users.noreply.github.com> Date: Thu, 4 May 2023 16:07:42 -0400 Subject: [PATCH] Remove godeps from makefile (#1750) Go already relies on its own internal caching, and replicating that in make adds unnecessary complexity, and is error prone, since the makefile doesn't recognize if new files are added, and isn't aware of build constraints. Remove `*.gomake` and `*.godeps` portion of makefile and invoke go directly. Remove `hack/gomakedeps.sh` file Signed-off-by: Hamza El-Saawy --- Makefile | 18 ++---------------- hack/gomakedeps.sh | 20 -------------------- 2 files changed, 2 insertions(+), 36 deletions(-) delete mode 100755 hack/gomakedeps.sh diff --git a/Makefile b/Makefile index 742c76d8..d8eb30b8 100644 --- a/Makefile +++ b/Makefile @@ -94,23 +94,9 @@ out/delta.tar.gz: bin/init bin/vsockexec bin/cmd/gcs bin/cmd/gcstools bin/cmd/ho tar -zcf $@ -C rootfs . rm -rf rootfs --include deps/cmd/gcs.gomake --include deps/cmd/gcstools.gomake --include deps/cmd/hooks/wait-paths.gomake --include deps/cmd/tar2ext4.gomake --include deps/internal/tools/snp-report.gomake - -# Implicit rule for includes that define Go targets. -%.gomake: $(SRCROOT)/Makefile +bin/cmd/gcs bin/cmd/gcstools bin/cmd/hooks/wait-paths bin/cmd/tar2ext4 bin/internal/tools/snp-report: @mkdir -p $(dir $@) - @/bin/echo $(@:deps/%.gomake=bin/%): $(SRCROOT)/hack/gomakedeps.sh > $@.new - @/bin/echo -e '\t@mkdir -p $$(dir $$@) $(dir $@)' >> $@.new - @/bin/echo -e '\t$$(GO_BUILD) -o $$@.new $$(SRCROOT)/$$(@:bin/%=%)' >> $@.new - @/bin/echo -e '\tGO="$(GO)" $$(SRCROOT)/hack/gomakedeps.sh $$@ $$(SRCROOT)/$$(@:bin/%=%) $$(GO_FLAGS) $$(GO_FLAGS_EXTRA) > $(@:%.gomake=%.godeps).new' >> $@.new - @/bin/echo -e '\tmv $(@:%.gomake=%.godeps).new $(@:%.gomake=%.godeps)' >> $@.new - @/bin/echo -e '\tmv $$@.new $$@' >> $@.new - @/bin/echo -e '-include $(@:%.gomake=%.godeps)' >> $@.new - mv $@.new $@ + GOOS=linux $(GO_BUILD) -o $@ $(SRCROOT)/$(@:bin/%=%) bin/vsockexec: vsockexec/vsockexec.o vsockexec/vsock.o @mkdir -p bin diff --git a/hack/gomakedeps.sh b/hack/gomakedeps.sh deleted file mode 100755 index 730a6eaf..00000000 --- a/hack/gomakedeps.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# Creates Makefile rules that enumerate all the input files -# for the Go package provided on the command line. - -set -e - -GO="${GO:-go}" -target_bin="$1" -target_pkg="$2" -shift 2 -fmt=$(cat <