2015-10-12 15:15:57 +00:00
|
|
|
# Copyright 2015 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.
|
|
|
|
|
2016-01-25 09:57:56 +00:00
|
|
|
NOSTATIC ?= 0
|
|
|
|
ifeq ($(NOSTATIC), 0)
|
|
|
|
STATIC_FLAG=-static
|
|
|
|
endif
|
|
|
|
|
2017-06-13 17:39:39 +00:00
|
|
|
.PHONY: all format tidy clean manager fuzzer executor execprog mutate prog2c stress extract generate repro db
|
2015-10-12 15:15:57 +00:00
|
|
|
|
2016-09-05 10:52:02 +00:00
|
|
|
all:
|
2016-10-07 17:07:05 +00:00
|
|
|
go install ./syz-manager ./syz-fuzzer
|
2016-09-05 10:52:02 +00:00
|
|
|
$(MAKE) manager
|
|
|
|
$(MAKE) fuzzer
|
2016-10-18 19:07:40 +00:00
|
|
|
$(MAKE) execprog
|
2016-09-05 10:52:02 +00:00
|
|
|
$(MAKE) executor
|
2015-10-12 15:15:57 +00:00
|
|
|
|
2017-06-13 17:39:39 +00:00
|
|
|
all-tools: execprog mutate prog2c stress repro upgrade db
|
2015-12-21 12:38:27 +00:00
|
|
|
|
2017-05-31 18:24:45 +00:00
|
|
|
# executor uses stacks of limited size, so no jumbo frames.
|
2016-01-25 09:57:56 +00:00
|
|
|
executor:
|
2017-05-31 18:24:45 +00:00
|
|
|
$(CC) -o ./bin/syz-executor executor/executor.cc -pthread -Wall -Wframe-larger-than=8192 -Werror -O1 -g $(STATIC_FLAG) $(CFLAGS)
|
2016-01-25 09:57:56 +00:00
|
|
|
|
2017-05-26 13:32:26 +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.
|
|
|
|
GOFLAGS="-ldflags=-s -w"
|
|
|
|
|
2015-12-17 15:06:33 +00:00
|
|
|
manager:
|
2017-05-26 13:32:26 +00:00
|
|
|
go build $(GOFLAGS) -o ./bin/syz-manager github.com/google/syzkaller/syz-manager
|
2015-10-12 15:15:57 +00:00
|
|
|
|
2015-12-17 15:06:33 +00:00
|
|
|
fuzzer:
|
2017-05-26 13:32:26 +00:00
|
|
|
go build $(GOFLAGS) -o ./bin/syz-fuzzer github.com/google/syzkaller/syz-fuzzer
|
2015-10-12 15:15:57 +00:00
|
|
|
|
2015-12-21 12:38:27 +00:00
|
|
|
execprog:
|
2017-05-26 13:32:26 +00:00
|
|
|
go build $(GOFLAGS) -o ./bin/syz-execprog github.com/google/syzkaller/tools/syz-execprog
|
2015-12-21 12:38:27 +00:00
|
|
|
|
2015-12-23 18:19:45 +00:00
|
|
|
repro:
|
2017-05-26 13:32:26 +00:00
|
|
|
go build $(GOFLAGS) -o ./bin/syz-repro github.com/google/syzkaller/tools/syz-repro
|
2015-12-23 18:19:45 +00:00
|
|
|
|
2015-12-21 12:38:27 +00:00
|
|
|
mutate:
|
2017-05-26 13:32:26 +00:00
|
|
|
go build $(GOFLAGS) -o ./bin/syz-mutate github.com/google/syzkaller/tools/syz-mutate
|
2015-12-21 12:38:27 +00:00
|
|
|
|
|
|
|
prog2c:
|
2017-05-26 13:32:26 +00:00
|
|
|
go build $(GOFLAGS) -o ./bin/syz-prog2c github.com/google/syzkaller/tools/syz-prog2c
|
2015-12-21 12:38:27 +00:00
|
|
|
|
|
|
|
stress:
|
2017-05-26 13:32:26 +00:00
|
|
|
go build $(GOFLAGS) -o ./bin/syz-stress github.com/google/syzkaller/tools/syz-stress
|
2015-12-21 12:38:27 +00:00
|
|
|
|
2017-06-13 17:39:39 +00:00
|
|
|
db:
|
|
|
|
go build $(GOFLAGS) -o ./bin/syz-db github.com/google/syzkaller/tools/syz-db
|
|
|
|
|
2015-12-28 11:49:19 +00:00
|
|
|
upgrade:
|
2017-05-26 13:32:26 +00:00
|
|
|
go build $(GOFLAGS) -o ./bin/syz-upgrade github.com/google/syzkaller/tools/syz-upgrade
|
2015-12-28 11:49:19 +00:00
|
|
|
|
2016-08-26 05:09:25 +00:00
|
|
|
extract: bin/syz-extract
|
|
|
|
LINUX=$(LINUX) LINUXBLD=$(LINUXBLD) ./extract.sh
|
2017-01-23 16:24:05 +00:00
|
|
|
bin/syz-extract: syz-extract/*.go sysparser/*.go
|
2017-05-26 13:32:26 +00:00
|
|
|
go build $(GOFLAGS) -o $@ ./syz-extract
|
2016-08-26 05:09:25 +00:00
|
|
|
|
|
|
|
generate: bin/syz-sysgen
|
|
|
|
bin/syz-sysgen
|
2017-06-14 11:05:05 +00:00
|
|
|
go generate ./csource ./executor ./syz-gce ./pkg/ifuzz ./pkg/kernel
|
2017-06-13 17:39:21 +00:00
|
|
|
$(MAKE) format
|
2016-09-19 14:26:39 +00:00
|
|
|
bin/syz-sysgen: sysgen/*.go sysparser/*.go
|
2017-05-26 13:32:26 +00:00
|
|
|
go build $(GOFLAGS) -o $@ ./sysgen
|
2015-12-24 13:40:46 +00:00
|
|
|
|
2015-10-12 15:15:57 +00:00
|
|
|
format:
|
2015-11-10 19:32:03 +00:00
|
|
|
go fmt ./...
|
2017-01-20 10:55:19 +00:00
|
|
|
clang-format --style=file -i executor/*.cc executor/*.h tools/kcovtrace/*.c
|
2016-08-28 12:59:48 +00:00
|
|
|
|
2017-06-13 15:21:33 +00:00
|
|
|
# A single check is enabled for now. But it's always fixable and proved to be useful.
|
|
|
|
tidy:
|
|
|
|
clang-tidy -quiet -header-filter=.* -checks=-*,misc-definitions-in-headers -warnings-as-errors=* executor/*.cc
|
|
|
|
|
2016-08-28 12:59:48 +00:00
|
|
|
presubmit:
|
|
|
|
$(MAKE) generate
|
|
|
|
$(MAKE) format
|
2016-10-18 19:07:40 +00:00
|
|
|
$(MAKE) executor
|
2016-08-28 12:59:48 +00:00
|
|
|
ARCH=amd64 go install ./...
|
|
|
|
ARCH=arm64 go install ./...
|
|
|
|
ARCH=ppc64le go install ./...
|
|
|
|
go test -short ./...
|
2016-08-28 14:33:32 +00:00
|
|
|
echo LGTM
|
2015-10-12 15:15:57 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf ./bin/
|