2017-07-27 14:59:09 +00:00
|
|
|
# Copyright 2017 syzkaller project authors. All rights reserved.
|
2015-10-12 15:15:57 +00:00
|
|
|
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
|
|
|
|
|
2018-06-05 15:14:47 +00:00
|
|
|
# There are 3 OS/arch pairs:
|
2017-09-19 09:00:40 +00:00
|
|
|
# - HOSTOS/HOSTARCH: pair where syz-manager will run.
|
|
|
|
# - TARGETOS/TARGETVMARCH: pair of the target OS under test.
|
|
|
|
# - TARGETOS/TARGETARCH: pair of the target test process.
|
|
|
|
#
|
|
|
|
# The last 2 differ for e.g. amd64 OS and 386 test processes (compat syscall testing).
|
|
|
|
# All pairs default to the current machine. All but BUILD can be overriden.
|
|
|
|
#
|
|
|
|
# For example, to test linux/amd64 on linux/amd64, you just run:
|
|
|
|
# make
|
|
|
|
# To test linux/arm64 from darwin/amd64 host, run:
|
|
|
|
# make HOSTOS=darwin HOSTARCH=amd64 TARGETOS=linux TARGETARCH=arm64
|
|
|
|
# To test x86 compat syscalls, run:
|
|
|
|
# make TARGETVMARCH=amd64 TARGETARCH=386
|
|
|
|
#
|
2017-12-19 14:22:08 +00:00
|
|
|
# There is one special case for extracting constants for Android
|
|
|
|
# (you don't need this unless you update system call descriptions):
|
|
|
|
# make extract TARGETOS=android SOURCEDIR=/path/to/android/checkout
|
2017-09-19 09:00:40 +00:00
|
|
|
|
2018-06-05 15:14:47 +00:00
|
|
|
define newline
|
2017-09-19 09:00:40 +00:00
|
|
|
|
2018-05-04 17:51:44 +00:00
|
|
|
|
2018-06-05 15:14:47 +00:00
|
|
|
endef
|
2020-04-29 13:31:23 +00:00
|
|
|
ENV := $(subst \n,$(newline),$(shell TRAVIS=$(TRAVIS)\
|
2018-06-05 15:14:47 +00:00
|
|
|
SOURCEDIR=$(SOURCEDIR) HOSTOS=$(HOSTOS) HOSTARCH=$(HOSTARCH) \
|
|
|
|
TARGETOS=$(TARGETOS) TARGETARCH=$(TARGETARCH) TARGETVMARCH=$(TARGETVMARCH) \
|
|
|
|
go run tools/syz-env/env.go))
|
2019-12-20 13:19:12 +00:00
|
|
|
# Uncomment in case of emergency.
|
|
|
|
# $(info $(ENV))
|
2018-06-05 15:14:47 +00:00
|
|
|
$(eval $(ENV))
|
2020-04-29 13:31:23 +00:00
|
|
|
ifneq ("$(SYZERROR)", "")
|
|
|
|
$(error $(SYZERROR))
|
|
|
|
endif
|
2018-06-05 15:14:47 +00:00
|
|
|
ifeq ("$(NCORES)", "")
|
|
|
|
$(error syz-env failed)
|
2017-09-19 09:00:40 +00:00
|
|
|
endif
|
2018-06-05 15:14:47 +00:00
|
|
|
MAKEFLAGS += " -j$(NCORES) "
|
|
|
|
export MAKEFLAGS
|
2017-09-19 09:00:40 +00:00
|
|
|
|
2018-06-05 15:14:47 +00:00
|
|
|
GO := go
|
2018-06-30 15:20:17 +00:00
|
|
|
HOSTGO := go
|
2018-02-15 02:16:27 +00:00
|
|
|
# By default, build all Go binaries as static. We don't need cgo and it is
|
|
|
|
# known to cause problems at least on Android emulator.
|
2019-10-11 15:10:11 +00:00
|
|
|
CGO_ENABLED ?= 0
|
|
|
|
export CGO_ENABLED
|
2018-07-05 11:04:37 +00:00
|
|
|
TARGETGOOS := $(TARGETOS)
|
|
|
|
TARGETGOARCH := $(TARGETVMARCH)
|
2018-02-15 02:16:27 +00:00
|
|
|
|
2017-09-19 09:00:40 +00:00
|
|
|
GITREV=$(shell git rev-parse HEAD)
|
2017-12-20 20:21:19 +00:00
|
|
|
ifeq ("$(shell git diff --shortstat)", "")
|
2017-09-19 09:00:40 +00:00
|
|
|
REV=$(GITREV)
|
|
|
|
else
|
|
|
|
REV=$(GITREV)+
|
|
|
|
endif
|
2019-03-22 17:38:28 +00:00
|
|
|
GITREVDATE=$(shell git log -n 1 --format="%ad")
|
2017-09-19 09:00:40 +00:00
|
|
|
|
|
|
|
# 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 without these flags.
|
2020-02-21 09:22:07 +00:00
|
|
|
GOFLAGS := "-ldflags=-s -w -X github.com/google/syzkaller/prog.GitRevision=$(REV) -X 'github.com/google/syzkaller/prog.gitRevisionDate=$(GITREVDATE)'"
|
2019-03-22 17:38:28 +00:00
|
|
|
|
2018-08-02 17:07:22 +00:00
|
|
|
GOHOSTFLAGS := $(GOFLAGS)
|
|
|
|
GOTARGETFLAGS := $(GOFLAGS)
|
2017-09-19 09:00:40 +00:00
|
|
|
ifneq ("$(GOTAGS)", "")
|
2018-08-02 17:07:22 +00:00
|
|
|
GOHOSTFLAGS += "-tags=$(GOTAGS)"
|
|
|
|
endif
|
|
|
|
GOTARGETFLAGS += "-tags=syz_target syz_os_$(TARGETOS) syz_arch_$(TARGETVMARCH) $(GOTAGS)"
|
|
|
|
|
2018-08-03 17:48:30 +00:00
|
|
|
ifeq ("$(TARGETOS)", "test")
|
|
|
|
TARGETGOOS := $(HOSTOS)
|
|
|
|
TARGETGOARCH := $(HOSTARCH)
|
|
|
|
endif
|
|
|
|
|
2018-08-02 17:07:22 +00:00
|
|
|
ifeq ("$(TARGETOS)", "akaros")
|
|
|
|
TARGETGOOS := $(HOSTOS)
|
|
|
|
TARGETGOARCH := $(HOSTARCH)
|
2016-01-25 09:57:56 +00:00
|
|
|
endif
|
|
|
|
|
2019-08-20 01:23:15 +00:00
|
|
|
ifeq ("$(TARGETOS)", "fuchsia")
|
|
|
|
TARGETGOOS := $(HOSTOS)
|
|
|
|
TARGETGOARCH := $(HOSTARCH)
|
|
|
|
endif
|
|
|
|
|
2018-11-08 01:52:06 +00:00
|
|
|
ifeq ("$(TARGETOS)", "trusty")
|
|
|
|
TARGETGOOS := $(HOSTOS)
|
|
|
|
TARGETGOARCH := $(HOSTARCH)
|
|
|
|
endif
|
|
|
|
|
2017-09-19 09:00:40 +00:00
|
|
|
.PHONY: all host target \
|
2018-07-25 14:45:57 +00:00
|
|
|
manager runtest fuzzer executor \
|
2017-07-27 14:59:09 +00:00
|
|
|
ci hub \
|
2018-12-06 15:25:37 +00:00
|
|
|
execprog mutate prog2c trace2syz stress repro upgrade db \
|
2020-04-29 15:57:32 +00:00
|
|
|
bin/syz-extract bin/syz-fmt \
|
2018-05-04 17:51:44 +00:00
|
|
|
extract generate generate_go generate_sys \
|
|
|
|
format format_go format_cpp format_sys \
|
2020-02-18 15:02:42 +00:00
|
|
|
tidy test test_race check_copyright check_links check_diff \
|
2018-05-04 17:51:44 +00:00
|
|
|
arch arch_darwin_amd64_host arch_linux_amd64_host \
|
|
|
|
arch_freebsd_amd64_host arch_netbsd_amd64_host \
|
|
|
|
arch_linux_amd64_target arch_linux_386_target \
|
2019-11-19 11:12:54 +00:00
|
|
|
arch_linux_arm64_target arch_linux_arm_target arch_linux_ppc64le_target arch_linux_mips64le_target \
|
2019-05-22 16:36:58 +00:00
|
|
|
arch_freebsd_amd64_target arch_freebsd_386_target \
|
|
|
|
arch_netbsd_amd64_target arch_windows_amd64_target \
|
2018-07-20 18:26:05 +00:00
|
|
|
arch_test presubmit presubmit_parallel clean
|
2015-10-12 15:15:57 +00:00
|
|
|
|
2017-09-19 09:00:40 +00:00
|
|
|
all: host target
|
2020-04-18 12:36:05 +00:00
|
|
|
host: manager runtest repro mutate prog2c db upgrade
|
|
|
|
target: fuzzer execprog stress executor
|
2015-10-12 15:15:57 +00:00
|
|
|
|
2020-04-29 15:57:32 +00:00
|
|
|
executor: descriptions
|
2019-01-24 10:28:55 +00:00
|
|
|
ifneq ("$(BUILDOS)", "$(NATIVEBUILDOS)")
|
2018-11-17 19:20:17 +00:00
|
|
|
$(info ************************************************************************************)
|
2020-04-29 13:31:23 +00:00
|
|
|
$(info Executor will not be built)
|
|
|
|
$(info Building executor for ${TARGETOS} is not supported on ${BUILDOS})
|
2018-11-17 19:20:17 +00:00
|
|
|
$(info ************************************************************************************)
|
2019-01-24 10:28:55 +00:00
|
|
|
else
|
|
|
|
ifneq ("$(NO_CROSS_COMPILER)", "")
|
|
|
|
$(info ************************************************************************************)
|
2020-04-29 13:31:23 +00:00
|
|
|
$(info Executor will not be built)
|
|
|
|
$(info Native cross-compiler is missing/broken:)
|
|
|
|
$(info $(NO_CROSS_COMPILER))
|
2019-01-24 10:28:55 +00:00
|
|
|
$(info ************************************************************************************)
|
|
|
|
else
|
|
|
|
mkdir -p ./bin/$(TARGETOS)_$(TARGETARCH)
|
|
|
|
$(CC) -o ./bin/$(TARGETOS)_$(TARGETARCH)/syz-executor$(EXE) executor/executor.cc \
|
2019-03-07 19:36:03 +00:00
|
|
|
$(ADDCFLAGS) $(CFLAGS) -DGOOS_$(TARGETOS)=1 -DGOARCH_$(TARGETARCH)=1 \
|
|
|
|
-DHOSTGOOS_$(HOSTOS)=1 -DGIT_REVISION=\"$(REV)\"
|
2019-01-24 10:28:55 +00:00
|
|
|
endif
|
2018-11-17 19:20:17 +00:00
|
|
|
endif
|
2017-05-26 13:32:26 +00:00
|
|
|
|
2020-04-29 15:57:32 +00:00
|
|
|
# .descriptions is a stub file that serves as a substitute for all files generated by syz-sysgen:
|
|
|
|
# sys/*/gen/*.go, executor/defs.h, executor/syscalls.h
|
|
|
|
# syz-sysgen generates them all at once, so we can't make each of them an independent target.
|
|
|
|
.PHONY: descriptions
|
|
|
|
descriptions:
|
2020-05-01 05:08:01 +00:00
|
|
|
export GOBIN="$(realpath .)/bin"; go list -f '{{.Stale}}' ./sys/syz-sysgen | grep -q false || go install ./sys/syz-sysgen
|
2020-04-29 15:57:32 +00:00
|
|
|
$(MAKE) .descriptions
|
|
|
|
|
|
|
|
.descriptions: sys/*/*.txt sys/*/*.const bin/syz-sysgen
|
|
|
|
bin/syz-sysgen
|
|
|
|
touch .descriptions
|
|
|
|
|
|
|
|
manager: descriptions
|
2018-08-02 17:07:22 +00:00
|
|
|
GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-manager github.com/google/syzkaller/syz-manager
|
2015-10-12 15:15:57 +00:00
|
|
|
|
2020-04-29 15:57:32 +00:00
|
|
|
runtest: descriptions
|
2018-07-25 14:45:57 +00:00
|
|
|
GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-runtest github.com/google/syzkaller/tools/syz-runtest
|
|
|
|
|
2020-04-29 15:57:32 +00:00
|
|
|
fuzzer: descriptions
|
2018-08-02 17:07:22 +00:00
|
|
|
GOOS=$(TARGETGOOS) GOARCH=$(TARGETGOARCH) $(GO) build $(GOTARGETFLAGS) -o ./bin/$(TARGETOS)_$(TARGETVMARCH)/syz-fuzzer$(EXE) github.com/google/syzkaller/syz-fuzzer
|
2015-10-12 15:15:57 +00:00
|
|
|
|
2020-04-29 15:57:32 +00:00
|
|
|
execprog: descriptions
|
2018-08-02 17:07:22 +00:00
|
|
|
GOOS=$(TARGETGOOS) GOARCH=$(TARGETGOARCH) $(GO) build $(GOTARGETFLAGS) -o ./bin/$(TARGETOS)_$(TARGETVMARCH)/syz-execprog$(EXE) github.com/google/syzkaller/tools/syz-execprog
|
2015-12-21 12:38:27 +00:00
|
|
|
|
2020-04-29 15:57:32 +00:00
|
|
|
ci: descriptions
|
2018-08-02 17:07:22 +00:00
|
|
|
GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-ci github.com/google/syzkaller/syz-ci
|
2017-06-19 15:23:03 +00:00
|
|
|
|
2020-04-29 15:57:32 +00:00
|
|
|
hub: descriptions
|
2018-08-02 17:07:22 +00:00
|
|
|
GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-hub github.com/google/syzkaller/syz-hub
|
2017-06-29 14:01:03 +00:00
|
|
|
|
2020-04-29 15:57:32 +00:00
|
|
|
repro: descriptions
|
2018-08-02 17:07:22 +00:00
|
|
|
GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-repro github.com/google/syzkaller/tools/syz-repro
|
2015-12-23 18:19:45 +00:00
|
|
|
|
2020-04-29 15:57:32 +00:00
|
|
|
mutate: descriptions
|
2018-08-02 17:07:22 +00:00
|
|
|
GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-mutate github.com/google/syzkaller/tools/syz-mutate
|
2015-12-21 12:38:27 +00:00
|
|
|
|
2020-04-29 15:57:32 +00:00
|
|
|
prog2c: descriptions
|
2018-08-02 17:07:22 +00:00
|
|
|
GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-prog2c github.com/google/syzkaller/tools/syz-prog2c
|
2015-12-21 12:38:27 +00:00
|
|
|
|
2020-04-29 15:57:32 +00:00
|
|
|
stress: descriptions
|
2018-08-02 17:07:22 +00:00
|
|
|
GOOS=$(TARGETGOOS) GOARCH=$(TARGETGOARCH) $(GO) build $(GOTARGETFLAGS) -o ./bin/$(TARGETOS)_$(TARGETVMARCH)/syz-stress$(EXE) github.com/google/syzkaller/tools/syz-stress
|
2015-12-21 12:38:27 +00:00
|
|
|
|
2020-04-29 15:57:32 +00:00
|
|
|
db: descriptions
|
2018-08-02 17:07:22 +00:00
|
|
|
GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-db github.com/google/syzkaller/tools/syz-db
|
2017-06-13 17:39:39 +00:00
|
|
|
|
2020-04-29 15:57:32 +00:00
|
|
|
upgrade: descriptions
|
2018-08-02 17:07:22 +00:00
|
|
|
GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-upgrade github.com/google/syzkaller/tools/syz-upgrade
|
2015-12-28 11:49:19 +00:00
|
|
|
|
2020-04-29 15:57:32 +00:00
|
|
|
trace2syz: descriptions
|
2018-12-06 15:25:37 +00:00
|
|
|
GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-trace2syz github.com/google/syzkaller/tools/syz-trace2syz
|
|
|
|
|
2019-04-11 13:44:07 +00:00
|
|
|
usbgen:
|
|
|
|
GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-usbgen github.com/google/syzkaller/tools/syz-usbgen
|
|
|
|
|
2020-04-29 15:57:32 +00:00
|
|
|
expand: descriptions
|
2019-09-23 13:34:59 +00:00
|
|
|
GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o ./bin/syz-expand github.com/google/syzkaller/tools/syz-expand
|
|
|
|
|
2018-09-29 01:15:56 +00:00
|
|
|
# `extract` extracts const files from various kernel sources, and may only
|
|
|
|
# re-generate parts of files.
|
2016-08-26 05:09:25 +00:00
|
|
|
extract: bin/syz-extract
|
2018-09-29 01:15:56 +00:00
|
|
|
ifeq ($(TARGETOS),fuchsia)
|
|
|
|
$(MAKE) generate_fidl TARGETARCH=amd64
|
|
|
|
$(MAKE) generate_fidl TARGETARCH=arm64
|
|
|
|
else
|
|
|
|
endif
|
2018-05-18 07:48:49 +00:00
|
|
|
bin/syz-extract -build -os=$(TARGETOS) -sourcedir=$(SOURCEDIR) $(FILES)
|
2020-04-29 15:57:32 +00:00
|
|
|
|
2017-06-17 11:17:11 +00:00
|
|
|
bin/syz-extract:
|
2018-08-02 17:07:22 +00:00
|
|
|
GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(HOSTGO) build $(GOHOSTFLAGS) -o $@ ./sys/syz-extract
|
2016-08-26 05:09:25 +00:00
|
|
|
|
2018-09-29 01:15:56 +00:00
|
|
|
# `generate` does *not* depend on any kernel sources, and generates everything
|
|
|
|
# in one pass, for all arches. It can be run on a bare syzkaller checkout.
|
2020-04-29 15:57:32 +00:00
|
|
|
generate: descriptions generate_go
|
2017-06-13 17:39:21 +00:00
|
|
|
$(MAKE) format
|
2018-05-04 17:51:44 +00:00
|
|
|
|
2020-04-29 15:57:32 +00:00
|
|
|
generate_go: format_cpp
|
2018-11-22 13:27:37 +00:00
|
|
|
$(GO) generate ./pkg/csource ./executor ./pkg/ifuzz ./pkg/build ./pkg/html
|
2018-05-04 17:51:44 +00:00
|
|
|
|
2018-09-05 19:45:17 +00:00
|
|
|
generate_fidl:
|
2018-09-29 01:15:56 +00:00
|
|
|
ifeq ($(TARGETOS),fuchsia)
|
|
|
|
$(HOSTGO) generate ./sys/fuchsia
|
2018-09-05 19:45:17 +00:00
|
|
|
$(MAKE) format_sys
|
2018-09-29 01:15:56 +00:00
|
|
|
else
|
|
|
|
endif
|
2018-09-05 19:45:17 +00:00
|
|
|
|
2018-12-06 15:25:37 +00:00
|
|
|
generate_trace2syz:
|
|
|
|
(cd tools/syz-trace2syz/parser; ragel -Z -G2 -o lex.go straceLex.rl)
|
|
|
|
(cd tools/syz-trace2syz/parser; goyacc -o strace.go -p Strace -v="" strace.y)
|
|
|
|
|
2018-05-04 17:51:44 +00:00
|
|
|
format: format_go format_cpp format_sys
|
|
|
|
|
|
|
|
format_go:
|
2018-09-05 09:34:56 +00:00
|
|
|
$(GO) fmt ./...
|
2018-05-04 17:51:44 +00:00
|
|
|
|
|
|
|
format_cpp:
|
2019-12-03 10:34:27 +00:00
|
|
|
clang-format --style=file -i executor/*.cc executor/*.h \
|
2020-03-11 11:09:17 +00:00
|
|
|
executor/android/android_seccomp.h \
|
2019-12-03 10:34:27 +00:00
|
|
|
tools/kcovtrace/*.c tools/kcovfuzzer/*.c tools/fops_probe/*.cc
|
2018-05-04 17:51:44 +00:00
|
|
|
|
|
|
|
format_sys: bin/syz-fmt
|
2018-11-17 19:46:48 +00:00
|
|
|
bin/syz-fmt all
|
2018-05-04 17:51:44 +00:00
|
|
|
|
2017-08-18 09:14:20 +00:00
|
|
|
bin/syz-fmt:
|
2018-09-29 01:15:56 +00:00
|
|
|
$(HOSTGO) build $(GOHOSTFLAGS) -o $@ ./tools/syz-fmt
|
2016-08-28 12:59:48 +00:00
|
|
|
|
2017-06-13 15:21:33 +00:00
|
|
|
tidy:
|
2017-06-14 10:56:42 +00:00
|
|
|
# A single check is enabled for now. But it's always fixable and proved to be useful.
|
2019-03-21 11:30:53 +00:00
|
|
|
clang-tidy -quiet -header-filter=.* -checks=-*,misc-definitions-in-headers -warnings-as-errors=* \
|
|
|
|
-extra-arg=-DGOOS_$(TARGETOS)=1 -extra-arg=-DGOARCH_$(TARGETARCH)=1 \
|
|
|
|
executor/*.cc
|
2017-06-14 10:56:42 +00:00
|
|
|
# Just check for compiler warnings.
|
|
|
|
$(CC) executor/test_executor.cc -c -o /dev/null -Wparentheses -Wno-unused -Wall
|
2017-06-13 15:21:33 +00:00
|
|
|
|
2019-04-23 13:58:23 +00:00
|
|
|
lint:
|
|
|
|
golangci-lint run ./...
|
|
|
|
|
2018-09-19 09:14:54 +00:00
|
|
|
arch: arch_darwin_amd64_host arch_linux_amd64_host arch_freebsd_amd64_host \
|
|
|
|
arch_netbsd_amd64_host arch_openbsd_amd64_host \
|
2018-05-04 17:51:44 +00:00
|
|
|
arch_linux_amd64_target arch_linux_386_target \
|
2019-11-19 11:12:54 +00:00
|
|
|
arch_linux_arm64_target arch_linux_arm_target arch_linux_ppc64le_target arch_linux_mips64le_target \
|
2019-05-22 16:36:58 +00:00
|
|
|
arch_freebsd_amd64_target arch_freebsd_386_target \
|
|
|
|
arch_netbsd_amd64_target arch_openbsd_amd64_target \
|
2018-09-19 09:14:54 +00:00
|
|
|
arch_windows_amd64_target arch_test
|
2017-07-27 14:59:09 +00:00
|
|
|
|
2018-05-04 17:51:44 +00:00
|
|
|
arch_darwin_amd64_host:
|
2017-09-19 09:00:40 +00:00
|
|
|
env HOSTOS=darwin HOSTARCH=amd64 $(MAKE) host
|
2018-05-04 17:51:44 +00:00
|
|
|
|
|
|
|
arch_linux_amd64_host:
|
2017-09-19 09:00:40 +00:00
|
|
|
env HOSTOS=linux HOSTARCH=amd64 $(MAKE) host
|
2018-05-04 17:51:44 +00:00
|
|
|
|
|
|
|
arch_linux_amd64_target:
|
2017-09-19 09:00:40 +00:00
|
|
|
env TARGETOS=linux TARGETARCH=amd64 $(MAKE) target
|
2018-05-04 17:51:44 +00:00
|
|
|
|
|
|
|
arch_linux_386_target:
|
2019-05-07 12:14:38 +00:00
|
|
|
env TARGETOS=linux TARGETARCH=386 $(MAKE) target
|
2018-05-04 17:51:44 +00:00
|
|
|
|
|
|
|
arch_linux_arm64_target:
|
|
|
|
env TARGETOS=linux TARGETARCH=arm64 $(MAKE) target
|
|
|
|
|
|
|
|
arch_linux_arm_target:
|
2019-05-07 11:23:39 +00:00
|
|
|
env TARGETOS=linux TARGETARCH=arm $(MAKE) target
|
2018-05-04 17:51:44 +00:00
|
|
|
|
2019-11-19 11:12:54 +00:00
|
|
|
arch_linux_mips64le_target:
|
|
|
|
env TARGETOS=linux TARGETARCH=mips64le $(MAKE) target
|
|
|
|
|
2018-05-04 17:51:44 +00:00
|
|
|
arch_linux_ppc64le_target:
|
|
|
|
env TARGETOS=linux TARGETARCH=ppc64le $(MAKE) target
|
|
|
|
|
|
|
|
arch_freebsd_amd64_host:
|
|
|
|
env HOSTOS=freebsd HOSTARCH=amd64 $(MAKE) host
|
|
|
|
|
|
|
|
arch_freebsd_amd64_target:
|
2017-10-23 08:19:56 +00:00
|
|
|
env TARGETOS=freebsd TARGETARCH=amd64 $(MAKE) target
|
2018-05-04 17:51:44 +00:00
|
|
|
|
2019-05-22 16:36:58 +00:00
|
|
|
arch_freebsd_386_target:
|
|
|
|
env TARGETOS=freebsd TARGETARCH=386 $(MAKE) target
|
|
|
|
|
2018-05-04 17:51:44 +00:00
|
|
|
arch_netbsd_amd64_host:
|
|
|
|
env HOSTOS=netbsd HOSTARCH=amd64 $(MAKE) host
|
|
|
|
|
|
|
|
arch_netbsd_amd64_target:
|
2017-10-23 08:19:56 +00:00
|
|
|
env TARGETOS=netbsd TARGETARCH=amd64 $(MAKE) target
|
2017-07-27 14:59:09 +00:00
|
|
|
|
2018-09-19 09:14:54 +00:00
|
|
|
arch_openbsd_amd64_host:
|
|
|
|
env HOSTOS=openbsd HOSTARCH=amd64 $(MAKE) host
|
|
|
|
|
|
|
|
arch_openbsd_amd64_target:
|
|
|
|
env TARGETOS=openbsd TARGETARCH=amd64 $(MAKE) target
|
|
|
|
|
2018-05-04 17:51:44 +00:00
|
|
|
arch_windows_amd64_target:
|
2018-11-17 19:20:17 +00:00
|
|
|
env TARGETOS=windows TARGETARCH=amd64 $(MAKE) target
|
2018-05-04 17:51:44 +00:00
|
|
|
|
2018-07-20 18:26:05 +00:00
|
|
|
arch_test:
|
|
|
|
env TARGETOS=test TARGETARCH=64 $(MAKE) executor
|
|
|
|
env TARGETOS=test TARGETARCH=64_fork $(MAKE) executor
|
2019-05-15 08:12:35 +00:00
|
|
|
env TARGETOS=test TARGETARCH=32_shmem $(MAKE) executor
|
|
|
|
env TARGETOS=test TARGETARCH=32_fork_shmem $(MAKE) executor
|
2018-07-20 18:26:05 +00:00
|
|
|
|
2020-04-29 15:57:32 +00:00
|
|
|
presubmit: descriptions
|
2017-07-27 14:59:09 +00:00
|
|
|
$(MAKE) generate
|
2017-11-20 16:23:36 +00:00
|
|
|
$(MAKE) check_diff
|
2020-02-18 15:02:42 +00:00
|
|
|
$(MAKE) check_copyright
|
|
|
|
$(MAKE) check_links
|
2019-05-15 08:12:35 +00:00
|
|
|
$(MAKE) lint
|
2020-05-01 10:44:15 +00:00
|
|
|
# We used to run presubmit_parallel instead of the following,
|
|
|
|
# but currently it OOMs on CI (see #1699).
|
|
|
|
# $(MAKE) presubmit_parallel
|
|
|
|
$(MAKE) test
|
|
|
|
$(MAKE) arch_linux_amd64_host
|
|
|
|
$(MAKE) arch_freebsd_amd64_host
|
|
|
|
$(MAKE) arch_netbsd_amd64_host
|
|
|
|
$(MAKE) arch_openbsd_amd64_host
|
|
|
|
$(MAKE) arch_linux_amd64_target
|
|
|
|
$(MAKE) arch_linux_arm64_target
|
|
|
|
$(MAKE) arch_freebsd_amd64_target
|
|
|
|
$(MAKE) arch_netbsd_amd64_target
|
|
|
|
$(MAKE) arch_openbsd_amd64_target
|
|
|
|
$(MAKE) arch_test
|
2016-08-28 14:33:32 +00:00
|
|
|
echo LGTM
|
2015-10-12 15:15:57 +00:00
|
|
|
|
2020-02-18 15:02:42 +00:00
|
|
|
presubmit_parallel: test test_race arch
|
2018-05-04 17:51:44 +00:00
|
|
|
|
2020-04-29 15:57:32 +00:00
|
|
|
test: descriptions
|
|
|
|
ifeq ("$(TRAVIS)$(shell go version | grep 1.13)", "true")
|
2020-05-02 11:05:47 +00:00
|
|
|
# Collect coverage report for codecov.io when testing Go 1.14 on travis (uploaded in .travis.yml).
|
2018-12-31 11:51:07 +00:00
|
|
|
env CGO_ENABLED=1 $(GO) test -short -coverprofile=coverage.txt ./...
|
2018-12-31 12:14:11 +00:00
|
|
|
else
|
|
|
|
# Executor tests use cgo.
|
|
|
|
env CGO_ENABLED=1 $(GO) test -short ./...
|
2018-12-31 11:51:07 +00:00
|
|
|
endif
|
2018-05-04 17:51:44 +00:00
|
|
|
|
2020-04-29 15:57:32 +00:00
|
|
|
test_race: descriptions
|
2019-01-14 17:24:22 +00:00
|
|
|
env CGO_ENABLED=1 $(GO) test -race; if test $$? -ne 2; then \
|
|
|
|
env CGO_ENABLED=1 $(GO) test -race -short -bench=.* -benchtime=.2s ./... ;\
|
2018-10-29 05:42:42 +00:00
|
|
|
fi
|
2018-05-04 17:51:44 +00:00
|
|
|
|
2017-07-27 14:59:09 +00:00
|
|
|
clean:
|
2020-04-29 15:57:32 +00:00
|
|
|
rm -rf ./bin .descriptions sys/*/gen executor/defs.h executor/syscalls.h
|
2017-09-25 06:47:15 +00:00
|
|
|
|
2018-03-20 12:26:51 +00:00
|
|
|
# For a tupical Ubuntu/Debian distribution.
|
2018-05-12 08:10:02 +00:00
|
|
|
# We use "|| true" for apt-get install because packages are all different on different distros,
|
2019-05-15 08:12:35 +00:00
|
|
|
# and we want to install at least golangci-lint on Travis CI.
|
2017-09-25 06:47:15 +00:00
|
|
|
install_prerequisites:
|
2018-05-13 09:34:03 +00:00
|
|
|
uname -a
|
|
|
|
sudo apt-get update
|
2018-04-02 17:38:11 +00:00
|
|
|
sudo apt-get install -y -q libc6-dev-i386 linux-libc-dev \
|
2019-11-19 11:12:54 +00:00
|
|
|
gcc-aarch64-linux-gnu gcc-arm-linux-gnueabi gcc-powerpc64le-linux-gnu gcc-mips64el-linux-gnuabi64 || true
|
2018-05-18 07:48:49 +00:00
|
|
|
sudo apt-get install -y -q g++-aarch64-linux-gnu || true
|
|
|
|
sudo apt-get install -y -q g++-powerpc64le-linux-gnu || true
|
2019-04-12 13:15:18 +00:00
|
|
|
sudo apt-get install -y -q g++-arm-linux-gnueabi || true
|
2019-11-19 11:12:54 +00:00
|
|
|
sudo apt-get install -y -q g++-mips64el-linux-gnuabi64 || true
|
2019-06-25 11:55:46 +00:00
|
|
|
sudo apt-get install -y -q ragel clang-format
|
2019-07-30 12:13:04 +00:00
|
|
|
go get -u golang.org/x/tools/cmd/goyacc \
|
|
|
|
github.com/dvyukov/go-fuzz/go-fuzz-build
|
2020-04-25 21:14:59 +00:00
|
|
|
# Runs golangci-lint when go is new enough. Old versions get a
|
|
|
|
# free pass (except on CI which has newer go version).
|
|
|
|
if [ "$$(go version)" \> "go version go1.12" ]; then \
|
|
|
|
GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.25.0 ; \
|
|
|
|
else \
|
|
|
|
ln -sf /bin/true $$(go env GOPATH)/bin/golangci-lint ; \
|
|
|
|
fi
|
2017-10-26 16:48:54 +00:00
|
|
|
|
2020-02-18 15:02:42 +00:00
|
|
|
check_copyright:
|
|
|
|
./tools/check-copyright.sh
|
|
|
|
|
2017-10-26 16:48:54 +00:00
|
|
|
check_links:
|
|
|
|
python ./tools/check_links.py $$(pwd) $$(ls ./*.md; find ./docs/ -name '*.md')
|
2017-11-20 16:23:36 +00:00
|
|
|
|
|
|
|
# Check that the diff is empty. This is meant to be executed after generating
|
|
|
|
# and formatting the code to make sure that everything is committed.
|
|
|
|
check_diff:
|
|
|
|
DIFF="$(shell git diff --name-only)"; test -z "$$DIFF"
|