about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDominik Maier <domenukk@gmail.com>2020-04-19 12:30:58 +0200
committerDominik Maier <domenukk@gmail.com>2020-04-19 12:30:58 +0200
commitbaec99079f5bb47b762c4facc0e881a63658a385 (patch)
treea16194507d8b10c3f05bd4d054f94a43dc15ffdd
parent16a5e6bf16616389d3821414547d0402f3502e73 (diff)
downloadafl++-baec99079f5bb47b762c4facc0e881a63658a385.tar.gz
make clean removes unicornafl dir if not in git
-rw-r--r--GNUmakefile20
1 files changed, 18 insertions, 2 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 8c71f0e6..ce3f0aae 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -151,6 +151,11 @@ ifdef NO_PYTHON
 	PYFLAGS=
 endif
 
+IN_GIT=1
+ifeq "$(shell git status 2>/dev/null)" ""
+  IN_GIT=0
+endif
+
 ifdef STATIC
   $(info Compiling static version of binaries)
   # Disable python for static compilation to simplify things
@@ -404,7 +409,18 @@ all_done: test_build
 
 .NOTPARALLEL: clean
 
-clean:
+ifeq "$(IN_GIT)" "1"
+# In git, unicornafl is a submodules, clean recursively
+clean_unicorn:
+	$(MAKE) -C unicorn_mode/unicornafl clean || true
+
+else
+# Else we remove the folder
+clean_unicorn:
+	rm -rf unicorn_mode/unicornafl
+endif
+
+clean: clean_unicorn
 	rm -f $(PROGS) libradamsa.so afl-fuzz-document afl-as as afl-g++ afl-clang afl-clang++ *.o src/*.o *~ a.out core core.[1-9][0-9]* *.stackdump .test .test1 .test2 test-instr .test-instr0 .test-instr1 qemu_mode/qemu-3.1.1.tar.xz afl-qemu-trace afl-gcc-fast afl-gcc-pass.so afl-gcc-rt.o afl-g++-fast ld *.so *.8 test/unittests/*.o test/unittests/unit_maybe_alloc test/unittests/preallocable
 	rm -rf out_dir qemu_mode/qemu-3.1.1 *.dSYM */*.dSYM
 	-$(MAKE) -C llvm_mode clean
@@ -416,7 +432,7 @@ clean:
 	$(MAKE) -C qemu_mode/unsigaction clean
 	$(MAKE) -C qemu_mode/libcompcov clean
 	$(MAKE) -C src/third_party/libradamsa/ clean
-	$(MAKE) -C unicorn_mode/unicornafl clean || true
+
 
 distrib: all radamsa
 	-$(MAKE) -C llvm_mode