]> rtime.felk.cvut.cz Git - boost-statechart-viewer.git/commitdiff
Allow building with local (debug) or system llvm
authorMichal Sojka <sojka@compile.felk.cvut.cz>
Fri, 25 Mar 2011 12:47:50 +0000 (13:47 +0100)
committerMichal Sojka <sojka@compile.felk.cvut.cz>
Fri, 25 Mar 2011 12:47:50 +0000 (13:47 +0100)
iconfigure script now behaves like this: If llvm and clang directories
contain llvm sources, then these will be compiled in debug mode and used
to build visualizer. Otherwise, system instalation of llvm is used.

Makefile
configure
src/Makefile

index fd698ecec42effdf545f4a73b11ca579f53c28f6..9f9a321ae637c27015be24214248e4d3a4ea66f4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,23 @@
-#LLVM_SRC=llvm
-
 -include config.local
 
 # Use our version of clang (even without installing)
 LLVM_BIN= $(CURDIR)/_install/bin
 
-LLVM_CONFIG := $(shell $(LLVM_BIN)/llvm-config --cxxflags --ldflags --libs jit core)
+LLVM_CONFIG := $(LLVM_BIN)/llvm-config
+
+export LLVM_CONFIG
+
+all: llvm src examples
+
+.PHONY: llvm src examples
+
+llvm: _install/lib/libclang.so
+
+_install/lib/libclang.so:
+       $(MAKE) -C llvm/_build install
+
+src: llvm
+       $(MAKE) -C src
+
+examples: src
+       $(MAKE) -C examples
\ No newline at end of file
index f21d34c0b47baf6920cbffac3cfca439c1da0dfd..c070f6d69dbaae09c870b114393539995fefa1ac 100755 (executable)
--- a/configure
+++ b/configure
@@ -3,13 +3,22 @@
 cd $(dirname $0)
 TOP=$PWD
 
-ln -sf ../../clang llvm/tools/clang
-mkdir -p llvm/_build
-cd llvm/_build
-../configure --prefix=$TOP/_install
-
-cat <<EOF
-To compile LLVM run the following comands:
-cd $PWD
-make install
+if [ -x llvm/configure ]; then
+    echo "Will build llvm and clang from sources" 
+    ln -sf ../../clang llvm/tools/clang
+    mkdir -p llvm/_build
+    (
+       cd llvm/_build
+       ../configure --prefix=$TOP/_install --disable-optimized --enable-debug-runtime --enable-debug-symbols
+    )
+    LLVM_CONFIG=$TOP/_install/bin/llvm-config
+else
+    echo "Using system-wide llvm and clang"
+    LLVM_CONFIG=llvm-config
+fi
+
+cat <<EOF > $TOP/Makefile.config
+LLVM_CONFIG := $LLVM_CONFIG
 EOF
+
+echo "Now run make to compile everything"
index a3926cac2c15481b53e2e025592f96ef0f127c3b..cd8ffb02da749af0eba43b76030d9a633e032949 100644 (file)
@@ -1,7 +1,9 @@
-LLVM_CONFIG := $(shell llvm-config --cxxflags --ldflags --libs jit core)
+include ../Makefile.config
+
+LLVM_FLAGS := $(shell $(LLVM_CONFIG) --cxxflags --ldflags --libs jit core)
 
 visualizer: visualizer.cpp commandlineopt.h stringoper.h
-       $(CXX) $< -o $@ -g -lclangParse -lclangFrontend -lclangSerialization \
+       $(CXX) $< -o $@ -g -O0 -lclangParse -lclangFrontend -lclangSerialization \
        -lclangDriver -lclangCodeGen -lclangSema -lclangChecker \
        -lclangAnalysis -lclangRewrite -lclangAST -lclangLex -lclangBasic \
-       $(LLVM_CONFIG)
+       $(LLVM_FLAGS)