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 <hamzaelsaawy@microsoft.com>
This commit is contained in:
Hamza El-Saawy 2023-05-04 16:07:42 -04:00 коммит произвёл GitHub
Родитель d1b45c5f02
Коммит a8ec8c8bb9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 2 добавлений и 36 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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 <<EOF
{{ if not .Standard }}
$target_bin: {{\$dir := .Dir}}{{ range .GoFiles }}{{\$dir}}/{{.}} {{end}}
{{if .Module}}$target_bin: {{.Module.GoMod}}{{end}}
{{end}}
EOF
)
"$GO" list "$@" -f '{{ .ImportPath }} {{ join .Deps "\n" }}' "$target_pkg" |
xargs "$GO" list "$@" -find -f "$fmt"