@@ -32,11 +32,38 @@ $(warning $(RED)run command via tools/syz-env for best compatibility, see:$(RESE
3232$(warning $(RED ) https ://github.com/google/syzkaller/blob/master/docs/contributing.md# using-syz-env$(RESET))
3333endif
3434
35+ GITREV =$(shell git rev-parse HEAD)
36+ ifeq ("$(shell git diff --shortstat) ", "")
37+ REV=$(GITREV)
38+ else
39+ REV=$(GITREV)+
40+ endif
41+ GITREVDATE =$(shell git log -n 1 --format="% cd" --date=format:% Y% m% d-% H% M% S)
42+
43+ # Don't generate symbol table and DWARF debug info.
44+ # Reduces build time and binary sizes considerably.
45+ # That's only needed if you use gdb or nm.
46+ # If you need that, build manually with DEBUG=true env.
47+ GLFLAGS :=
48+ GGFLAGS :=
49+ ifeq ("$(DEBUG ) ", "true")
50+ GGFLAGS := -gcflags="all=-N -l"
51+ else
52+ GLFLAGS := -s -w
53+ endif
54+ GOFLAGS := -ldflags="$(GLFLAGS ) -X github.com/google/syzkaller/prog.GitRevision=$(REV ) -X github.com/google/syzkaller/prog.gitRevisionDate=$(GITREVDATE ) " $(GGFLAGS )
55+ ifneq ("$(GOTAGS ) ", "")
56+ GOFLAGS += " -tags=$(GOTAGS)"
57+ endif
58+
59+ GOHOSTFLAGS ?= $(GOFLAGS )
60+ GOTARGETFLAGS ?= $(GOFLAGS )
61+
3562ENV := $(subst \n,$(newline ) ,$(shell CI=$(CI ) \
3663 SOURCEDIR=$(SOURCEDIR ) HOSTOS=$(HOSTOS ) HOSTARCH=$(HOSTARCH ) \
3764 TARGETOS=$(TARGETOS ) TARGETARCH=$(TARGETARCH ) TARGETVMARCH=$(TARGETVMARCH ) \
3865 SYZ_CLANG=$(SYZ_CLANG ) \
39- go run tools/syz-make/make.go) )
66+ go run $( GOHOSTFLAGS ) tools/syz-make/make.go) )
4067# Uncomment in case of emergency.
4168# $(info $(ENV))
4269$(eval $(ENV))
@@ -61,33 +88,6 @@ TARGETGOARCH := $(TARGETVMARCH)
6188export GO111MODULE =on
6289export GOBIN =$(shell pwd -P) /bin
6390
64- GITREV =$(shell git rev-parse HEAD)
65- ifeq ("$(shell git diff --shortstat) ", "")
66- REV=$(GITREV)
67- else
68- REV=$(GITREV)+
69- endif
70- GITREVDATE =$(shell git log -n 1 --format="% cd" --date=format:% Y% m% d-% H% M% S)
71-
72- # Don't generate symbol table and DWARF debug info.
73- # Reduces build time and binary sizes considerably.
74- # That's only needed if you use gdb or nm.
75- # If you need that, build manually with DEBUG=true env.
76- GLFLAGS :=
77- GGFLAGS :=
78- ifeq ("$(DEBUG ) ", "true")
79- GGFLAGS := -gcflags="all=-N -l"
80- else
81- GLFLAGS := -s -w
82- endif
83- GOFLAGS := -ldflags="$(GLFLAGS ) -X github.com/google/syzkaller/prog.GitRevision=$(REV ) -X github.com/google/syzkaller/prog.gitRevisionDate=$(GITREVDATE ) " $(GGFLAGS )
84- ifneq ("$(GOTAGS ) ", "")
85- GOFLAGS += " -tags=$(GOTAGS)"
86- endif
87-
88- GOHOSTFLAGS ?= $(GOFLAGS )
89- GOTARGETFLAGS ?= $(GOFLAGS )
90-
9191ifeq ("$(TARGETOS ) ", "test")
9292 TARGETGOOS := $(HOSTOS)
9393 TARGETGOARCH := $(HOSTARCH)
@@ -150,7 +150,7 @@ endif
150150# syz-sysgen generates them all at once, so we can't make each of them an independent target.
151151.PHONY : descriptions
152152descriptions :
153- go list -f ' {{.Stale}}' ./sys/syz-sysgen | grep -q false || go install ./sys/syz-sysgen
153+ go list -f ' {{.Stale}}' $( GOHOSTFLAGS ) ./sys/syz-sysgen | grep -q false || go install $( GOHOSTFLAGS ) ./sys/syz-sysgen
154154 $(MAKE ) .descriptions
155155
156156.descriptions : sys/* /* .txt sys/* /* .const bin/syz-sysgen
0 commit comments