@echo "[*] Checking for the ability to compile x86 code..."
@echo 'main() { __asm__("xorb %al, %al"); }'|$(CC) -w -x c - -o .test ||( echo;echo"Oops, looks like your compiler can't generate x86 code."; echo;echo"Don't panic! You can use the LLVM or QEMU mode, but see docs/INSTALL first.";echo"(To ignore this error, set AFL_NO_X86=1 and try again.)"; echo;exit1)
@rm -f .test
@echo "[+] Everything seems to be working, ready to compile."
else
test_x86:
@echo "[!] Note: skipping x86 compilation checks (AFL_NO_X86 set)."
endif
afl-gcc:afl-gcc.c$(COMM_HDR)|test_x86
$(CC)$(CFLAGS)$@.c -o $@$(LDFLAGS)
set -e;for i in afl-g++ afl-clang afl-clang++;do ln -sf afl-gcc $$i;done
afl-as:afl-as.cafl-as.h$(COMM_HDR)|test_x86
$(CC)$(CFLAGS)$@.c -o $@$(LDFLAGS)
ln -sf afl-as as
afl-fuzz:afl-fuzz.c$(COMM_HDR)|test_x86
$(CC)$(CFLAGS)$@.c -o $@$(LDFLAGS)
afl-showmap:afl-showmap.c$(COMM_HDR)|test_x86
$(CC)$(CFLAGS)$@.c -o $@$(LDFLAGS)
afl-tmin:afl-tmin.c$(COMM_HDR)|test_x86
$(CC)$(CFLAGS)$@.c -o $@$(LDFLAGS)
afl-analyze:afl-analyze.c$(COMM_HDR)|test_x86
$(CC)$(CFLAGS)$@.c -o $@$(LDFLAGS)
afl-gotcpu:afl-gotcpu.c$(COMM_HDR)|test_x86
$(CC)$(CFLAGS)$@.c -o $@$(LDFLAGS)
ifndefAFL_NO_X86
test_build:afl-gccafl-asafl-showmap
@echo "[*] Testing the CC wrapper and instrumentation output..."
@cmp -s .test-instr0 .test-instr1;DR="$$?"; rm -f .test-instr0 .test-instr1;if["$$DR"="0"];then echo;echo"Oops, the instrumentation does not seem to be behaving correctly!"; echo;echo"Please ping <lcamtuf@google.com> to troubleshoot the issue."; echo;exit 1;fi
@echo "[+] All right, the instrumentation seems to be working!"
else
test_build:afl-gccafl-asafl-showmap
@echo "[!] Note: skipping build tests (you may need to use LLVM or QEMU mode)."
endif
all_done:test_build
@if [ ! "`which clang 2>/dev/null`"=""];thenecho"[+] LLVM users: see llvm_mode/README.llvm for a faster alternative to afl-gcc.";fi
@echo "[+] All done! Be sure to review README - it's pretty short and useful."
@if ["`uname`"="Darwin"];thenprintf"\nWARNING: Fuzzing on MacOS X is slow because of the unusually high overhead of\nfork() on this OS. Consider using Linux or *BSD. You can also use VirtualBox\n(virtualbox.org) to put AFL inside a Linux or *BSD VM.\n\n";fi
@! tty <&1 >/dev/null ||printf"\033[0;30mNOTE: If you can read this, your terminal probably uses white background.\nThis will make the UI hard to read. See docs/status_screen.txt for advice.\033[0m\n" 2>/dev/null