aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/fuzz/Makefile
blob: 0f6ef2cc44855c70a7fb8e5d548fbc7bf39f0b67 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (C) 2018-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.

FUZZERS := config uapi stringlist cmd set setconf

all: $(FUZZERS)

CFLAGS ?= -O3 -march=native -g
CFLAGS += -fsanitize=fuzzer -fsanitize=address -std=gnu11 -idirafter ../uapi -D_GNU_SOURCE
CC := clang

config: config.c ../config.c ../encoding.c
	$(CC) $(CFLAGS) -o $@ $<

uapi: uapi.c ../ipc.c ../curve25519.c ../encoding.c
	$(CC) $(CFLAGS) -o $@ $<

stringlist: stringlist.c ../ipc.c ../curve25519.c ../encoding.c
	$(CC) $(CFLAGS) -o $@ $<

cmd: cmd.c $(wildcard ../*.c)
	$(CC) $(CFLAGS) -D'RUNSTATEDIR="/var/empty"' -D'main(a,b)=wg_main(a,b)' -o $@ $^

set: set.c ../set.c ../ipc.c ../encoding.c ../curve25519.c ../config.c
	$(CC) $(CFLAGS) -o $@ $<

setconf: setconf.c ../setconf.c ../ipc.c ../encoding.c ../curve25519.c ../config.c
	$(CC) $(CFLAGS) -o $@ $<

clean:
	$(RM) $(FUZZERS)

.PHONY: all clean