diff options
author | Dan Liew <daniel.liew@imperial.ac.uk> | 2017-03-30 09:59:44 +0100 |
---|---|---|
committer | Dan Liew <daniel.liew@imperial.ac.uk> | 2017-03-30 14:11:38 +0100 |
commit | 08e79adeb0c732de443eb81122594d03c39248b3 (patch) | |
tree | df416f9774b140c7f9347c0eee8d3a95b18815a2 /runtime | |
parent | 0eb13665f0b0fb7d6a3d3015d1a1413236966339 (diff) | |
download | klee-08e79adeb0c732de443eb81122594d03c39248b3.tar.gz |
[CMake] Fix #631
This fixes a bug in the bitcode build system where the build would fail if the build directory was a symbolic link (i.e. create a symbolic link for the root of the build tree and try to do the build in that directory). The problem was that `DIR_SUFFIX` implicitly assumed that there was only one way to refer to the build tree which is an incorrect assumption in the presence of symbolic links. This has been fixed by using the `$(realpath)` GNU make built in to resolve all symbolic links. An additional sanity check has been added to check that `SRC_DIR` exists.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/Makefile.cmake.bitcode.rules | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/runtime/Makefile.cmake.bitcode.rules b/runtime/Makefile.cmake.bitcode.rules index 8261ce99..2737eb80 100644 --- a/runtime/Makefile.cmake.bitcode.rules +++ b/runtime/Makefile.cmake.bitcode.rules @@ -70,8 +70,15 @@ else all:: build_at_level # Compute the directory to find sources -DIR_SUFFIX := $(subst $(RUNTIME_CMAKE_BINARY_DIR),,$(CURRENT_DIR)) +# Note: Use of $(realpath) is to resolve any symlinks +DIR_SUFFIX := $(subst $(realpath $(RUNTIME_CMAKE_BINARY_DIR)),,$(realpath $(CURRENT_DIR))) SRC_DIR := $(abspath $(ROOT_SRC)/$(DIR_SUFFIX)) +# Sanity check +ifeq ($(realpath $(SRC_DIR)),) +$(error SRC_DIR "$(SRC_DIR)" does not exist) +endif + +# Compute the directory to put build files LOCAL_BUILD_DIR := $(abspath $(ROOT_OBJ)/$(DIR_SUFFIX)) C_SRCS := $(shell echo $(SRC_DIR)/*.c) |