diff options
| author | Stefan Wiehler <me@sephalon.net> | 2025-08-08 17:42:58 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-08-12 13:49:33 +0000 |
| commit | ada7557073de86aa26dc6304bceeae76f212486a (patch) | |
| tree | 3fe84e4b1b6a038629d19a41e6fc58eef2679871 /Makefile | |
| parent | c06e8995d711b5a8d8fbd771826fcbfdac6f110f (diff) | |
Makefile: consider GOHOSTFLAGS for ENV variable and descriptions target
When building with the Yocto go-mod class, the -modcacherw flag appended
to GOHOSTFLAGS must be considered in all build steps to make the go
cache writeable (deletable).
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 58 |
1 files changed, 29 insertions, 29 deletions
@@ -32,11 +32,38 @@ $(warning $(RED)run command via tools/syz-env for best compatibility, see:$(RESE $(warning $(RED)https://github.com/google/syzkaller/blob/master/docs/contributing.md#using-syz-env$(RESET)) endif +GITREV=$(shell git rev-parse HEAD) +ifeq ("$(shell git diff --shortstat)", "") + REV=$(GITREV) +else + REV=$(GITREV)+ +endif +GITREVDATE=$(shell git log -n 1 --format="%cd" --date=format:%Y%m%d-%H%M%S) + +# Don't generate symbol table and DWARF debug info. +# Reduces build time and binary sizes considerably. +# That's only needed if you use gdb or nm. +# If you need that, build manually with DEBUG=true env. +GLFLAGS := +GGFLAGS := +ifeq ("$(DEBUG)", "true") + GGFLAGS := -gcflags="all=-N -l" +else + GLFLAGS := -s -w +endif +GOFLAGS := -ldflags="$(GLFLAGS) -X github.com/google/syzkaller/prog.GitRevision=$(REV) -X github.com/google/syzkaller/prog.gitRevisionDate=$(GITREVDATE)" $(GGFLAGS) +ifneq ("$(GOTAGS)", "") + GOFLAGS += " -tags=$(GOTAGS)" +endif + +GOHOSTFLAGS ?= $(GOFLAGS) +GOTARGETFLAGS ?= $(GOFLAGS) + ENV := $(subst \n,$(newline),$(shell CI=$(CI)\ SOURCEDIR=$(SOURCEDIR) HOSTOS=$(HOSTOS) HOSTARCH=$(HOSTARCH) \ TARGETOS=$(TARGETOS) TARGETARCH=$(TARGETARCH) TARGETVMARCH=$(TARGETVMARCH) \ SYZ_CLANG=$(SYZ_CLANG) \ - go run tools/syz-make/make.go)) + go run $(GOHOSTFLAGS) tools/syz-make/make.go)) # Uncomment in case of emergency. # $(info $(ENV)) $(eval $(ENV)) @@ -61,33 +88,6 @@ TARGETGOARCH := $(TARGETVMARCH) export GO111MODULE=on export GOBIN=$(shell pwd -P)/bin -GITREV=$(shell git rev-parse HEAD) -ifeq ("$(shell git diff --shortstat)", "") - REV=$(GITREV) -else - REV=$(GITREV)+ -endif -GITREVDATE=$(shell git log -n 1 --format="%cd" --date=format:%Y%m%d-%H%M%S) - -# Don't generate symbol table and DWARF debug info. -# Reduces build time and binary sizes considerably. -# That's only needed if you use gdb or nm. -# If you need that, build manually with DEBUG=true env. -GLFLAGS := -GGFLAGS := -ifeq ("$(DEBUG)", "true") - GGFLAGS := -gcflags="all=-N -l" -else - GLFLAGS := -s -w -endif -GOFLAGS := -ldflags="$(GLFLAGS) -X github.com/google/syzkaller/prog.GitRevision=$(REV) -X github.com/google/syzkaller/prog.gitRevisionDate=$(GITREVDATE)" $(GGFLAGS) -ifneq ("$(GOTAGS)", "") - GOFLAGS += " -tags=$(GOTAGS)" -endif - -GOHOSTFLAGS ?= $(GOFLAGS) -GOTARGETFLAGS ?= $(GOFLAGS) - ifeq ("$(TARGETOS)", "test") TARGETGOOS := $(HOSTOS) TARGETGOARCH := $(HOSTARCH) @@ -150,7 +150,7 @@ endif # syz-sysgen generates them all at once, so we can't make each of them an independent target. .PHONY: descriptions descriptions: - go list -f '{{.Stale}}' ./sys/syz-sysgen | grep -q false || go install ./sys/syz-sysgen + go list -f '{{.Stale}}' $(GOHOSTFLAGS) ./sys/syz-sysgen | grep -q false || go install $(GOHOSTFLAGS) ./sys/syz-sysgen $(MAKE) .descriptions .descriptions: sys/*/*.txt sys/*/*.const bin/syz-sysgen |
