about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorDan Liew <daniel.liew@imperial.ac.uk>2017-03-30 10:24:40 +0100
committerDan Liew <daniel.liew@imperial.ac.uk>2017-03-30 14:12:23 +0100
commit6a70f100c67ce9a0c2cd52d4af8fb9a7cfce22e2 (patch)
tree10600ef0de8c676cd9ca2912d4859e019b7bd19d
parentec3ac104af50e07f3430a35b3ffae0c340fcb78f (diff)
downloadklee-6a70f100c67ce9a0c2cd52d4af8fb9a7cfce22e2.tar.gz
[CMake] Add the `clean_runtime` top level target to provide an easy way
to clean the runtime build.

Unfortuantely there is no way to have the `clean` target trigger the
`clean_runtime` target unfortunately.
-rw-r--r--README-CMake.md1
-rw-r--r--runtime/CMakeLists.txt10
2 files changed, 9 insertions, 2 deletions
diff --git a/README-CMake.md b/README-CMake.md
index c2893004..2d438546 100644
--- a/README-CMake.md
+++ b/README-CMake.md
@@ -7,6 +7,7 @@ its autoconf/Makefile based build system.
 
 * `check` - Build and run all tests.
 * `clean` - Clean the build tree. Note this won't clean the runtime build.
+* `clean_runtime` - Clean the runtime build tree.
 * `docs` - Build documentation
 * `edit_cache` - Show cmake/ccmake/cmake-gui interface for chaning configure options.
 * `help` - Show list of top level targets
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index c980a27a..c90cbda0 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -114,8 +114,14 @@ ExternalProject_Add_Step(BuildKLEERuntimes RuntimeBuild
   ${EXTERNAL_PROJECT_ADD_STEP_USES_TERMINAL_ARG}
 )
 
-# FIXME: Invoke `make clean` in the bitcode build system
-# when the `clean` target is invoked.
+# Target for cleaning the bitcode build system
+# FIXME: Invoke `make clean` does not invoke this target. It's also weird
+# that `ExternalProject` provides no way to do a clean.
+add_custom_target(clean_runtime
+  COMMAND ${ENV_BINARY} MAKEFLAGS="" ${MAKE_BINARY} -f Makefile.cmake.bitcode clean
+  WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+  ${ADD_CUSTOM_COMMAND_USES_TERMINAL_ARG}
+)
 
 ###############################################################################
 # Runtime install