diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-09-25 15:40:58 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-09-25 15:40:58 +0200 |
| commit | e2f1c7ed36b35111ae7f2c6d6dbe43d50ffddd90 (patch) | |
| tree | 51fa595b4cff54c136208cdee2bf5879d62c4542 /Makefile | |
| parent | af442a22d956464e7df703b290fa49d78dda3dfa (diff) | |
Makefile: add fuchsia support
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 54 |
1 files changed, 34 insertions, 20 deletions
@@ -28,6 +28,7 @@ HOSTARCH ?= $(BUILDARCH) TARGETOS ?= $(HOSTOS) TARGETARCH ?= $(HOSTARCH) TARGETVMARCH ?= $(TARGETARCH) +GO := go ifeq ("$(TARGETARCH)", "amd64") CC = "x86_64-linux-gnu-gcc" @@ -76,6 +77,19 @@ ifeq ("$(TARGETOS)", "android") CFLAGS = -I $(NDK)/sources/cxx-stl/llvm-libc++/include --sysroot=$(NDK)/platforms/android-$(ANDROID_API)/arch-$(ANDROIDARCH) -O1 -g -Wall -static endif +ifeq ("$(TARGETOS)", "fuchsia") + # SOURCEDIR should point to fuchsia checkout. + GO = $(SOURCEDIR)/buildtools/go + CC = $(SOURCEDIR)/buildtools/linux-x64/clang/bin/clang++ + export CGO_ENABLED=1 + NOSTATIC = 1 + ifeq ("$(TARGETARCH)", "amd64") + ADDCFLAGS = --target=x86_64-fuchsia -lfdio -lzircon --sysroot $(SOURCEDIR)/out/build-zircon/build-zircon-pc-x86-64/sysroot + else ifeq ("$(TARGETARCH)", "arm64") + ADDCFLAGS = --target=aarch64-fuchsia -lfdio -lzircon --sysroot $(SOURCEDIR)/out/build-zircon/build-zircon-pc-x86-64/sysroot + endif +endif + GITREV=$(shell git rev-parse HEAD) ifeq ($(`git diff --shortstat`), "") REV=$(GITREV) @@ -108,11 +122,11 @@ endif all: host target host: - GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) go install ./syz-manager + GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(GO) install ./syz-manager $(MAKE) manager repro mutate prog2c db upgrade target: - GOOS=$(TARGETOS) GOARCH=$(TARGETVMARCH) go install ./syz-fuzzer + GOOS=$(TARGETOS) GOARCH=$(TARGETVMARCH) $(GO) install ./syz-fuzzer $(MAKE) fuzzer execprog stress executor # executor uses stacks of limited size, so no jumbo frames. @@ -123,57 +137,57 @@ executor: $(ADDCFLAGS) $(CFLAGS) -DGIT_REVISION=\"$(REV)\" manager: - GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) go build $(GOFLAGS) -o ./bin/syz-manager github.com/google/syzkaller/syz-manager + GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(GO) build $(GOFLAGS) -o ./bin/syz-manager github.com/google/syzkaller/syz-manager fuzzer: - GOOS=$(TARGETOS) GOARCH=$(TARGETVMARCH) go build $(GOFLAGS) -o ./bin/$(TARGETOS)_$(TARGETVMARCH)/syz-fuzzer github.com/google/syzkaller/syz-fuzzer + GOOS=$(TARGETOS) GOARCH=$(TARGETVMARCH) $(GO) build $(GOFLAGS) -o ./bin/$(TARGETOS)_$(TARGETVMARCH)/syz-fuzzer github.com/google/syzkaller/syz-fuzzer execprog: - GOOS=$(TARGETOS) GOARCH=$(TARGETVMARCH) go build $(GOFLAGS) -o ./bin/$(TARGETOS)_$(TARGETVMARCH)/syz-execprog github.com/google/syzkaller/tools/syz-execprog + GOOS=$(TARGETOS) GOARCH=$(TARGETVMARCH) $(GO) build $(GOFLAGS) -o ./bin/$(TARGETOS)_$(TARGETVMARCH)/syz-execprog github.com/google/syzkaller/tools/syz-execprog ci: - GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) go build $(GOFLAGS) -o ./bin/syz-ci github.com/google/syzkaller/syz-ci + GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(GO) build $(GOFLAGS) -o ./bin/syz-ci github.com/google/syzkaller/syz-ci hub: - GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) go build $(GOFLAGS) -o ./bin/syz-hub github.com/google/syzkaller/syz-hub + GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(GO) build $(GOFLAGS) -o ./bin/syz-hub github.com/google/syzkaller/syz-hub repro: - GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) go build $(GOFLAGS) -o ./bin/syz-repro github.com/google/syzkaller/tools/syz-repro + GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(GO) build $(GOFLAGS) -o ./bin/syz-repro github.com/google/syzkaller/tools/syz-repro mutate: - GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) go build $(GOFLAGS) -o ./bin/syz-mutate github.com/google/syzkaller/tools/syz-mutate + GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(GO) build $(GOFLAGS) -o ./bin/syz-mutate github.com/google/syzkaller/tools/syz-mutate prog2c: - GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) go build $(GOFLAGS) -o ./bin/syz-prog2c github.com/google/syzkaller/tools/syz-prog2c + GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(GO) build $(GOFLAGS) -o ./bin/syz-prog2c github.com/google/syzkaller/tools/syz-prog2c stress: - GOOS=$(TARGETOS) GOARCH=$(TARGETVMARCH) go build $(GOFLAGS) -o ./bin/$(TARGETOS)_$(TARGETVMARCH)/syz-stress github.com/google/syzkaller/tools/syz-stress + GOOS=$(TARGETOS) GOARCH=$(TARGETVMARCH) $(GO) build $(GOFLAGS) -o ./bin/$(TARGETOS)_$(TARGETVMARCH)/syz-stress github.com/google/syzkaller/tools/syz-stress db: - GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) go build $(GOFLAGS) -o ./bin/syz-db github.com/google/syzkaller/tools/syz-db + GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(GO) build $(GOFLAGS) -o ./bin/syz-db github.com/google/syzkaller/tools/syz-db upgrade: - GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) go build $(GOFLAGS) -o ./bin/syz-upgrade github.com/google/syzkaller/tools/syz-upgrade + GOOS=$(HOSTOS) GOARCH=$(HOSTARCH) $(GO) build $(GOFLAGS) -o ./bin/syz-upgrade github.com/google/syzkaller/tools/syz-upgrade extract: bin/syz-extract bin/syz-extract -build -os=$(TARGETOS) -sourcedir=$(SOURCEDIR) bin/syz-extract: - go build $(GOFLAGS) -o $@ ./sys/syz-extract + $(GO) build $(GOFLAGS) -o $@ ./sys/syz-extract generate: bin/syz-sysgen bin/syz-sysgen - go generate ./pkg/csource ./executor ./pkg/ifuzz ./pkg/kernel + $(GO) generate ./pkg/csource ./executor ./pkg/ifuzz ./pkg/kernel $(MAKE) format bin/syz-sysgen: - go build $(GOFLAGS) -o $@ ./sys/syz-sysgen + $(GO) build $(GOFLAGS) -o $@ ./sys/syz-sysgen format: bin/syz-fmt - go fmt ./... + $(GO) fmt ./... clang-format --style=file -i executor/*.cc executor/*.h tools/kcovtrace/*.c bin/syz-fmt sys/linux bin/syz-fmt sys/fuchsia bin/syz-fmt: - go build $(GOFLAGS) -o $@ ./tools/syz-fmt + $(GO) build $(GOFLAGS) -o $@ ./tools/syz-fmt tidy: # A single check is enabled for now. But it's always fixable and proved to be useful. @@ -182,8 +196,8 @@ tidy: $(CC) executor/test_executor.cc -c -o /dev/null -Wparentheses -Wno-unused -Wall test: - go test -short ./... - go test -short -race ./... + $(GO) test -short ./... + $(GO) test -short -race ./... arch: env HOSTOS=darwin HOSTARCH=amd64 $(MAKE) host |
