github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/Makefile (about)

     1  # Copyright 2017 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  # There are 3 OS/arch pairs:
     5  #  - HOSTOS/HOSTARCH: pair where syz-manager will run.
     6  #  - TARGETOS/TARGETVMARCH: pair of the target OS under test.
     7  #  - TARGETOS/TARGETARCH: pair of the target test process.
     8  #
     9  # The last 2 differ for e.g. amd64 OS and 386 test processes (compat syscall testing).
    10  # All pairs default to the current machine. All but BUILD can be overriden.
    11  #
    12  # For example, to test linux/amd64 on linux/amd64, you just run:
    13  #    make
    14  # To test linux/arm64 from darwin/amd64 host, run:
    15  #    make HOSTOS=darwin HOSTARCH=amd64 TARGETOS=linux TARGETARCH=arm64
    16  # To test x86 compat syscalls, run:
    17  #    make TARGETVMARCH=amd64 TARGETARCH=386
    18  #
    19  # There is one special case for extracting constants for Android
    20  # (you don't need this unless you update system call descriptions):
    21  #    make extract TARGETOS=android SOURCEDIR=/path/to/android/checkout
    22  
    23  define newline
    24  
    25  
    26  endef
    27  
    28  RED := $(shell tput setaf 1)
    29  RESET := $(shell tput sgr0)
    30  ifndef SYZ_ENV
    31  $(warning $(RED)run command via tools/syz-env for best compatibility, see:$(RESET))
    32  $(warning $(RED)https://github.com/google/syzkaller/blob/master/docs/contributing.md#using-syz-env$(RESET))
    33  endif
    34  
    35  ENV := $(subst \n,$(newline),$(shell CI=$(CI)\
    36  	SOURCEDIR=$(SOURCEDIR) HOSTOS=$(HOSTOS) HOSTARCH=$(HOSTARCH) \
    37  	TARGETOS=$(TARGETOS) TARGETARCH=$(TARGETARCH) TARGETVMARCH=$(TARGETVMARCH) \
    38  	SYZ_CLANG=$(SYZ_CLANG) \
    39  	go run tools/syz-make/make.go))
    40  # Uncomment in case of emergency.
    41  # $(info $(ENV))
    42  $(eval $(ENV))
    43  ifneq ("$(SYZERROR)", "")
    44  $(error $(SYZERROR))
    45  endif
    46  ifeq ("$(NCORES)", "")
    47  $(error syz-make failed)
    48  endif
    49  ifeq ("$(MAKELEVEL)", "0")
    50  	MAKEFLAGS += -j$(NCORES) --no-print-directory
    51  endif
    52  
    53  GO := go
    54  HOSTGO := go
    55  # By default, build all Go binaries as static. We don't need cgo and it is
    56  # known to cause problems at least on Android emulator.
    57  CGO_ENABLED ?= 0
    58  export CGO_ENABLED
    59  TARGETGOOS := $(TARGETOS)
    60  TARGETGOARCH := $(TARGETVMARCH)
    61  export GO111MODULE=on
    62  export GOBIN=$(shell pwd -P)/bin
    63  
    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 without these flags.
    76  GOFLAGS := "-ldflags=-s -w -X github.com/google/syzkaller/prog.GitRevision=$(REV) -X 'github.com/google/syzkaller/prog.gitRevisionDate=$(GITREVDATE)'"
    77  
    78  GOHOSTFLAGS ?= $(GOFLAGS)
    79  GOTARGETFLAGS ?= $(GOFLAGS)
    80  ifneq ("$(GOTAGS)", "")
    81  	GOHOSTFLAGS += "-tags=$(GOTAGS)"
    82  endif
    83  GOTARGETFLAGS += "-tags=syz_target syz_os_$(TARGETOS) syz_arch_$(TARGETVMARCH) $(GOTAGS)"
    84  
    85  ifeq ("$(TARGETOS)", "test")
    86  	TARGETGOOS := $(HOSTOS)
    87  	TARGETGOARCH := $(HOSTARCH)
    88  endif
    89  
    90  ifeq ("$(TARGETOS)", "fuchsia")
    91  	TARGETGOOS := $(HOSTOS)
    92  	TARGETGOARCH := $(HOSTARCH)
    93  endif
    94  
    95  ifeq ("$(TARGETOS)", "trusty")
    96  	TARGETGOOS := $(HOSTOS)
    97  	TARGETGOARCH := $(HOSTARCH)
    98  endif
    99  
   100  .PHONY: all clean host target \
   101  	manager runtest fuzzer executor \
   102  	ci hub \
   103  	execprog mutate prog2c trace2syz repro upgrade db \
   104  	usbgen symbolize cover kconf syz-build crush \
   105  	bin/syz-extract bin/syz-fmt \
   106  	extract generate generate_go generate_rpc generate_sys \
   107  	format format_go format_cpp format_sys \
   108  	tidy test test_race \
   109  	check_copyright check_language check_whitespace check_links check_diff check_commits check_shebang \
   110  	presubmit presubmit_aux presubmit_build presubmit_arch_linux presubmit_arch_freebsd \
   111  	presubmit_arch_netbsd presubmit_arch_openbsd presubmit_arch_darwin presubmit_arch_windows \
   112  	presubmit_arch_executor presubmit_dashboard presubmit_race presubmit_race_dashboard presubmit_old
   113  
   114  all: host target
   115  host: manager runtest repro mutate prog2c db upgrade
   116  target: fuzzer execprog executor
   117  
   118  executor: descriptions
   119  ifeq ($(TARGETOS),fuchsia)
   120  	# Dont build syz-executor for fuchsia.
   121  else
   122  ifneq ("$(BUILDOS)", "$(NATIVEBUILDOS)")
   123  	$(info ************************************************************************************)
   124  	$(info Executor will not be built)
   125  	$(info Building executor for ${TARGETOS} is not supported on ${BUILDOS})
   126  	$(info ************************************************************************************)
   127  else
   128  ifneq ("$(NO_CROSS_COMPILER)", "")
   129  	$(info ************************************************************************************)
   130  	$(info Executor will not be built)
   131  	$(info Native cross-compiler is missing/broken:)
   132  	$(info $(NO_CROSS_COMPILER))
   133  	$(info ************************************************************************************)
   134  else
   135  	mkdir -p ./bin/$(TARGETOS)_$(TARGETARCH)
   136  	$(CC) -o ./bin/$(TARGETOS)_$(TARGETARCH)/syz-executor$(EXE) executor/executor.cc \
   137  		$(ADDCFLAGS) $(CFLAGS) -DGOOS_$(TARGETOS)=1 -DGOARCH_$(TARGETARCH)=1 \
   138  		-DHOSTGOOS_$(HOSTOS)=1 -DGIT_REVISION=\"$(REV)\"
   139  endif
   140  endif
   141  endif
   142  
   143  # .descriptions is a stub file that serves as a substitute for all files generated by syz-sysgen:
   144  # sys/*/gen/*.go, executor/defs.h, executor/syscalls.h
   145  # syz-sysgen generates them all at once, so we can't make each of them an independent target.
   146  .PHONY: descriptions
   147  descriptions:
   148  	go list -f '{{.Stale}}' ./sys/syz-sysgen | grep -q false || go install ./sys/syz-sysgen
   149  	$(MAKE) .descriptions
   150  
   151  .descriptions: sys/*/*.txt sys/*/*.const bin/syz-sysgen
   152  	bin/syz-sysgen
   153  	touch .descriptions
   154  
   155  manager: descriptions
   156  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-manager github.com/google/syzkaller/syz-manager
   157  
   158  runtest: descriptions
   159  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-runtest github.com/google/syzkaller/tools/syz-runtest
   160  
   161  fuzzer: descriptions
   162  	GOOS=$(TARGETGOOS) GOARCH=$(TARGETGOARCH) $(GO) build $(GOTARGETFLAGS) -o ./bin/$(TARGETOS)_$(TARGETVMARCH)/syz-fuzzer$(EXE) github.com/google/syzkaller/syz-fuzzer
   163  
   164  execprog: descriptions
   165  	GOOS=$(TARGETGOOS) GOARCH=$(TARGETGOARCH) $(GO) build $(GOTARGETFLAGS) -o ./bin/$(TARGETOS)_$(TARGETVMARCH)/syz-execprog$(EXE) github.com/google/syzkaller/tools/syz-execprog
   166  
   167  ci: descriptions
   168  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-ci github.com/google/syzkaller/syz-ci
   169  
   170  hub: descriptions
   171  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-hub github.com/google/syzkaller/syz-hub
   172  
   173  repro: descriptions
   174  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-repro github.com/google/syzkaller/tools/syz-repro
   175  
   176  mutate: descriptions
   177  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-mutate github.com/google/syzkaller/tools/syz-mutate
   178  
   179  prog2c: descriptions
   180  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-prog2c github.com/google/syzkaller/tools/syz-prog2c
   181  
   182  crush: descriptions
   183  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-crush github.com/google/syzkaller/tools/syz-crush
   184  
   185  reporter: descriptions
   186  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-reporter github.com/google/syzkaller/tools/syz-reporter
   187  
   188  db: descriptions
   189  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-db github.com/google/syzkaller/tools/syz-db
   190  
   191  upgrade: descriptions
   192  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-upgrade github.com/google/syzkaller/tools/syz-upgrade
   193  
   194  trace2syz: descriptions
   195  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-trace2syz github.com/google/syzkaller/tools/syz-trace2syz
   196  
   197  expand: descriptions
   198  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-expand github.com/google/syzkaller/tools/syz-expand
   199  
   200  usbgen:
   201  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-usbgen github.com/google/syzkaller/tools/syz-usbgen
   202  
   203  symbolize:
   204  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-symbolize github.com/google/syzkaller/tools/syz-symbolize
   205  cover:
   206  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-cover github.com/google/syzkaller/tools/syz-cover
   207  kconf:
   208  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-kconf github.com/google/syzkaller/tools/syz-kconf
   209  syz-build:
   210  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-build github.com/google/syzkaller/tools/syz-build
   211  
   212  bisect: descriptions
   213  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-bisect github.com/google/syzkaller/tools/syz-bisect
   214  
   215  verifier: descriptions
   216  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-verifier github.com/google/syzkaller/syz-verifier
   217  
   218  runner:  descriptions
   219  	GOOS=$(TARGETGOOS) GOARCH=$(TARGETGOARCH) $(GO) build $(GOTARGETFLAGS) -o ./bin/$(TARGETOS)_$(TARGETVMARCH)/syz-runner$(EXE) github.com/google/syzkaller/syz-runner
   220  
   221  # `extract` extracts const files from various kernel sources, and may only
   222  # re-generate parts of files.
   223  extract: bin/syz-extract
   224  ifeq ($(TARGETOS),fuchsia)
   225  	$(MAKE) generate_fidl TARGETARCH=amd64
   226  	$(MAKE) generate_fidl TARGETARCH=arm64
   227  else
   228  endif
   229  	bin/syz-extract -build -os=$(TARGETOS) -sourcedir=$(SOURCEDIR) $(FILES)
   230  
   231  bin/syz-extract:
   232  	GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o $@ ./sys/syz-extract
   233  
   234  # `generate` does *not* depend on any kernel sources, and generates everything
   235  # in one pass, for all arches. It can be run on a bare syzkaller checkout.
   236  generate:
   237  	$(MAKE) descriptions
   238  	$(MAKE) generate_go
   239  	$(MAKE) generate_rpc
   240  	$(MAKE) format
   241  
   242  generate_go: format_cpp
   243  	$(GO) generate ./executor ./pkg/ifuzz ./pkg/build
   244  	$(GO) generate ./vm/proxyapp
   245  
   246  generate_rpc:
   247  	flatc -o pkg/flatrpc --warnings-as-errors --gen-object-api --filename-suffix "" --go --gen-onefile --go-namespace flatrpc pkg/flatrpc/flatrpc.fbs
   248  	flatc -o pkg/flatrpc --warnings-as-errors --gen-object-api --filename-suffix "" --cpp --scoped-enums pkg/flatrpc/flatrpc.fbs
   249  	$(GO) fmt ./pkg/flatrpc/flatrpc.go
   250  
   251  generate_fidl:
   252  ifeq ($(TARGETOS),fuchsia)
   253  	$(HOSTGO) generate ./sys/fuchsia
   254  	$(MAKE) format_sys
   255  else
   256  endif
   257  
   258  generate_trace2syz:
   259  	(cd tools/syz-trace2syz/parser; ragel -Z -G2 -o lex.go straceLex.rl)
   260  	(cd tools/syz-trace2syz/parser; goyacc -o strace.go -p Strace -v="" strace.y)
   261  
   262  format: format_go format_cpp format_sys
   263  
   264  format_go:
   265  	$(GO) fmt ./...
   266  
   267  format_cpp:
   268  	clang-format --style=file -i executor/*.cc executor/*.h \
   269  		executor/android/android_seccomp.h \
   270  		tools/kcovtrace/*.c tools/kcovfuzzer/*.c tools/fops_probe/*.cc
   271  
   272  format_sys: bin/syz-fmt
   273  	bin/syz-fmt all
   274  
   275  bin/syz-fmt:
   276  	$(HOSTGO) build $(GOHOSTFLAGS) -o $@ ./tools/syz-fmt
   277  
   278  configs: kconf
   279  	bin/syz-kconf -config dashboard/config/linux/main.yml -sourcedir $(SOURCEDIR)
   280  
   281  tidy: descriptions
   282  	clang-tidy -quiet -header-filter=executor/[^_].* -warnings-as-errors=* \
   283  		-checks=-*,misc-definitions-in-headers,bugprone-macro-parentheses,clang-analyzer-*,-clang-analyzer-security.insecureAPI*,-clang-analyzer-optin.performance* \
   284  		-extra-arg=-DGOOS_$(TARGETOS)=1 -extra-arg=-DGOARCH_$(TARGETARCH)=1 \
   285  		-extra-arg=-DHOSTGOOS_$(HOSTOS)=1 -extra-arg=-DGIT_REVISION=\"$(REV)\" \
   286  		--extra-arg=-I. --extra-arg=-Iexecutor/_include \
   287  		executor/*.cc
   288  
   289  ifdef CI
   290    LINT-FLAGS := --out-format github-actions
   291  endif
   292  
   293  lint:
   294  	# This should install the command from our vendor dir.
   295  	CGO_ENABLED=1 $(HOSTGO) install github.com/golangci/golangci-lint/cmd/golangci-lint
   296  	CGO_ENABLED=1 $(HOSTGO) build -buildmode=plugin -o bin/syz-linter.so ./tools/syz-linter
   297  	bin/golangci-lint run $(LINT-FLAGS) ./...
   298  
   299  presubmit:
   300  	$(MAKE) presubmit_aux
   301  	$(MAKE) presubmit_build
   302  	$(MAKE) presubmit_arch_linux
   303  	$(MAKE) presubmit_arch_freebsd
   304  	$(MAKE) presubmit_arch_netbsd
   305  	$(MAKE) presubmit_arch_openbsd
   306  	$(MAKE) presubmit_arch_darwin
   307  	$(MAKE) presubmit_arch_windows
   308  	$(MAKE) presubmit_arch_executor
   309  	$(MAKE) presubmit_race
   310  	$(MAKE) presubmit_race_dashboard
   311  
   312  presubmit_aux:
   313  	$(MAKE) generate
   314  	$(MAKE) -j100 check_commits check_diff check_copyright check_language check_whitespace check_links check_shebang tidy
   315  
   316  presubmit_build: descriptions
   317  	# Run go build before lint for better error messages if build is broken.
   318  	# This does not check build of test files, but running go test takes too long (even for building).
   319  	$(GO) build ./...
   320  	$(MAKE) lint
   321  	SYZ_SKIP_DEV_APPSERVER_TESTS=1 $(MAKE) test
   322  
   323  presubmit_arch_linux: descriptions
   324  	HOSTOS=linux HOSTARCH=amd64 $(MAKE) host
   325  	TARGETOS=linux TARGETARCH=amd64 TARGETVMARCH=amd64 $(MAKE) target
   326  	TARGETOS=linux TARGETARCH=386 TARGETVMARCH=386 $(MAKE) target
   327  	TARGETOS=linux TARGETARCH=arm64 TARGETVMARCH=arm64 $(MAKE) target
   328  	TARGETOS=linux TARGETARCH=arm TARGETVMARCH=arm $(MAKE) target
   329  	TARGETOS=linux TARGETARCH=mips64le TARGETVMARCH=mips64le $(MAKE) target
   330  	TARGETOS=linux TARGETARCH=ppc64le TARGETVMARCH=ppc64le $(MAKE) target
   331  	TARGETOS=linux TARGETARCH=riscv64 TARGETVMARCH=riscv64 $(MAKE) target
   332  	TARGETOS=linux TARGETARCH=s390x TARGETVMARCH=s390x $(MAKE) target
   333  
   334  presubmit_arch_freebsd: descriptions
   335  	HOSTOS=freebsd HOSTARCH=amd64 $(MAKE) host
   336  	TARGETOS=freebsd TARGETARCH=amd64 TARGETVMARCH=amd64 $(MAKE) target
   337  	TARGETOS=freebsd TARGETARCH=386 TARGETVMARCH=386 $(MAKE) target
   338  	TARGETOS=freebsd TARGETARCH=arm64 TARGETVMARCH=arm64 $(MAKE) target
   339  	TARGETOS=freebsd TARGETARCH=riscv64 TARGETVMARCH=riscv64 $(MAKE) target
   340  
   341  presubmit_arch_netbsd: descriptions
   342  	HOSTOS=netbsd HOSTARCH=amd64 $(MAKE) host
   343  	TARGETOS=netbsd TARGETARCH=amd64 TARGETVMARCH=amd64 $(MAKE) target
   344  
   345  presubmit_arch_openbsd: descriptions
   346  	HOSTOS=openbsd HOSTARCH=amd64 $(MAKE) host
   347  	TARGETOS=openbsd TARGETARCH=amd64 TARGETVMARCH=amd64 $(MAKE) target
   348  
   349  presubmit_arch_darwin: descriptions
   350  	HOSTOS=darwin HOSTARCH=amd64 $(MAKE) host
   351  
   352  presubmit_arch_windows: descriptions
   353  	TARGETOS=windows TARGETARCH=amd64 TARGETVMARCH=amd64 $(MAKE) target
   354  
   355  presubmit_arch_executor: descriptions
   356  	TARGETOS=linux TARGETARCH=amd64 TARGETVMARCH=amd64 SYZ_CLANG=yes $(MAKE) executor
   357  	TARGETOS=fuchsia TARGETARCH=amd64 TARGETVMARCH=amd64 $(MAKE) executor
   358  	TARGETOS=fuchsia TARGETARCH=arm64 TARGETVMARCH=arm64 $(MAKE) executor
   359  	TARGETOS=test TARGETARCH=64 TARGETVMARCH=64 $(MAKE) executor
   360  	TARGETOS=test TARGETARCH=64_fork TARGETVMARCH=64_fork $(MAKE) executor
   361  	TARGETOS=test TARGETARCH=32_shmem TARGETVMARCH=32_shmem $(MAKE) executor
   362  	TARGETOS=test TARGETARCH=32_fork_shmem TARGETVMARCH=32_fork_shmem $(MAKE) executor
   363  	TARGETOS=test TARGETARCH=64 TARGETVMARCH=64 $(MAKE) executor
   364  	TARGETOS=test TARGETARCH=64_fork TARGETVMARCH=64_fork $(MAKE) executor
   365  	TARGETOS=test TARGETARCH=32_shmem TARGETVMARCH=32_shmem $(MAKE) executor
   366  	TARGETOS=test TARGETARCH=32_fork_shmem TARGETVMARCH=32_fork_shmem $(MAKE) executor
   367  
   368  presubmit_dashboard: descriptions
   369  	SYZ_CLANG=yes $(GO) test -short -vet=off -coverprofile=.coverage.txt ./dashboard/app
   370  
   371  presubmit_race: descriptions
   372  	# -race requires cgo
   373  	CGO_ENABLED=1 $(GO) test -race; if test $$? -ne 2; then \
   374  	CGO_ENABLED=1 SYZ_SKIP_DEV_APPSERVER_TESTS=1 $(GO) test -race -short -vet=off -bench=.* -benchtime=.2s ./... ;\
   375  	fi
   376  
   377  presubmit_race_dashboard: descriptions
   378  	# -race requires cgo
   379  	CGO_ENABLED=1 $(GO) test -race; if test $$? -ne 2; then \
   380  	CGO_ENABLED=1 $(GO) test -race -short -vet=off -bench=.* -benchtime=.2s ./dashboard/app/... ;\
   381  	fi
   382  
   383  presubmit_old: descriptions
   384  	# Binaries we can compile in syz-old-env. 386 is broken, riscv64 is missing.
   385  	TARGETARCH=amd64 TARGETVMARCH=amd64 $(MAKE) target
   386  	TARGETARCH=arm64 TARGETVMARCH=arm64 $(MAKE) target
   387  	TARGETARCH=arm TARGETVMARCH=arm $(MAKE) target
   388  	TARGETARCH=ppc64le TARGETVMARCH=ppc64le $(MAKE) target
   389  	TARGETARCH=mips64le TARGETVMARCH=mips64le $(MAKE) target
   390  	TARGETARCH=s390x TARGETVMARCH=s390x $(MAKE) target
   391  
   392  test: descriptions
   393  	$(GO) test -short -coverprofile=.coverage.txt ./...
   394  
   395  clean:
   396  	rm -rf ./bin .descriptions executor/defs.h executor/syscalls.h
   397  	find sys/*/gen -type f -not -name empty.go -delete
   398  
   399  # For a tupical Ubuntu/Debian distribution.
   400  # We use "|| true" for apt-get install because packages are all different on different distros.
   401  # Also see tools/syz-env for container approach.
   402  install_prerequisites:
   403  	uname -a
   404  	sudo apt-get update
   405  	sudo apt-get install -y -q libc6-dev-i386 linux-libc-dev \
   406  		gcc-aarch64-linux-gnu gcc-arm-linux-gnueabi gcc-powerpc64le-linux-gnu gcc-mips64el-linux-gnuabi64 || true
   407  	sudo apt-get install -y -q g++-aarch64-linux-gnu || true
   408  	sudo apt-get install -y -q g++-powerpc64le-linux-gnu || true
   409  	sudo apt-get install -y -q g++-arm-linux-gnueabi || true
   410  	sudo apt-get install -y -q g++-mips64el-linux-gnuabi64 || true
   411  	sudo apt-get install -y -q g++-s390x-linux-gnu || true
   412  	sudo apt-get install -y -q g++-riscv64-linux-gnu || true
   413  	sudo apt-get install -y -q g++ || true
   414  	[ -z "$(shell which python)" -a -n "$(shell which python3)" ] && sudo apt-get install -y -q python-is-python3 || true
   415  	sudo apt-get install -y -q clang-tidy || true
   416  	sudo apt-get install -y -q clang clang-format ragel
   417  	sudo apt-get install -y -q flatbuffers-compiler libflatbuffers-dev
   418  	GO111MODULE=off go get -u golang.org/x/tools/cmd/goyacc
   419  
   420  check_copyright:
   421  	./tools/check-copyright.sh
   422  
   423  check_language:
   424  	./tools/check-language.sh
   425  
   426  check_whitespace:
   427  	./tools/check-whitespace.sh
   428  
   429  check_commits:
   430  	./tools/check-commits.sh
   431  
   432  check_links:
   433  	python ./tools/check_links.py $$(pwd) $$(find . -name '*.md' | grep -v "./vendor/")
   434  
   435  # Check that the diff is empty. This is meant to be executed after generating
   436  # and formatting the code to make sure that everything is committed.
   437  check_diff:
   438  	@if [ "$(shell git --no-pager diff --name-only)" != "" ]; then \
   439  		git --no-pager diff; \
   440  		git --no-pager diff --name-only | \
   441  			sed "s#.*#&:1:1: The file is not formatted/regenerated. Run 'make generate' and include it into the commit.#g"; \
   442  		false; \
   443  	fi
   444  
   445  check_shebang:
   446  	./tools/check-shebang.sh