From 671f31019d4018554d672c78ff08172d2a3ad71e Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 2 Apr 2025 05:12:30 -0700 Subject: Makefile: simplify Go generation Make fidlgen non special and run go generate for all packages. This will avoid stale go:generate commands, and missed packages (like we had for pkg/ifuzz/{x86,arm64} for years). --- sys/fuchsia/fidlgen/main.go | 15 +++++++++------ sys/fuchsia/init.go | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'sys') diff --git a/sys/fuchsia/fidlgen/main.go b/sys/fuchsia/fidlgen/main.go index 937ef62d1..ab2bcf0cd 100644 --- a/sys/fuchsia/fidlgen/main.go +++ b/sys/fuchsia/fidlgen/main.go @@ -19,17 +19,20 @@ import ( ) func main() { + targetOS := os.Getenv("TARGETOS") targetArch := os.Getenv("TARGETARCH") - target := targets.Get(targets.Fuchsia, targetArch) - if target == nil { - tool.Failf("unknown TARGETARCH %s", targetArch) - } - arch := target.KernelHeaderArch - sourceDir := os.Getenv("SOURCEDIR") + if targetOS != targets.Fuchsia || sourceDir == "" { + return + } if !osutil.IsExist(sourceDir) { tool.Failf("cannot find SOURCEDIR %s", sourceDir) } + target := targets.Get(targetOS, targetArch) + if target == nil { + tool.Failf("unknown TARGETARCH %s", targetArch) + } + arch := target.KernelHeaderArch fidlgenPath := filepath.Join( sourceDir, diff --git a/sys/fuchsia/init.go b/sys/fuchsia/init.go index 2fbbd4bdf..c3ca8ca9b 100644 --- a/sys/fuchsia/init.go +++ b/sys/fuchsia/init.go @@ -1,7 +1,8 @@ // Copyright 2017 syzkaller project authors. All rights reserved. // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. -//go:generate go run fidlgen/main.go +//go:generate bash -c "TARGETARCH=amd64 go run fidlgen/main.go" +//go:generate bash -c "TARGETARCH=arm64 go run fidlgen/main.go" package fuchsia -- cgit mrf-deployment