Skip to content

Instantly share code, notes, and snippets.

@thorrr
Last active January 2, 2016 15:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thorrr/8321820 to your computer and use it in GitHub Desktop.
Save thorrr/8321820 to your computer and use it in GitHub Desktop.
Makefile for building cling from source. Works on win32 cygwin, need to modify the exename variable to make it work on Linux
cling-version := 45925
install-dir := $(shell pwd)/cling
exename := $(install-dir)/bin/cling.exe
.PHONY: all clean exe clang cling repl crepl cpprepl
all: exe
clean:
rm ./lastKnownGood
cd ./llvm && make clean
cd ./llvm/tools/clang && make clean
cd ./llvm/tools/cling && make clean
rm -rf ./build
lastKnownGood:
svn co --depth files -r $(cling-version) http://root.cern.ch/svn/root/trunk/interpreter/cling &&\
cp ./cling/LastKnownGoodLLVMSVNRevision.txt ./lastKnownGood &&\
rm -rf ./cling
llvm: lastKnownGood
lkg=`cat lastKnownGood` &&\
svn co -r "$$lkg" http://llvm.org/svn/llvm-project/llvm/trunk $@
clang: llvm/tools/clang
llvm/tools/clang: | lastKnownGood
lkg=`cat lastKnownGood` &&\
cd ./llvm/tools && \
svn co -r "$$lkg" http://llvm.org/svn/llvm-project/cfe/trunk clang
cling: llvm/tools/cling
llvm/tools/cling: | lastKnownGood
cd ./llvm/tools && \
svn co -r $(cling-version) http://root.cern.ch/svn/root/trunk/interpreter/cling/ && \
cd ../ && \
cat tools/cling/patches/*.diff | patch -p0
build:
mkdir build
build/Makefile: llvm | clang cling build #phony targets and directories should be order-only
cd ./build &&\
../llvm/configure --prefix=$(install-dir) --enable-optimized --enable-targets=host-only CC=gcc CXX=g++ #--build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
exe: $(exename)
$(exename): build/Makefile
cd ./build &&\
$(MAKE) && $(MAKE) install
repl: cpprepl
crepl: exe
$(exename)
cpprepl: exe
$(exename) -I /usr/lib/gcc/i686-pc-cygwin/4.8.2/include/c++/ -I /usr/lib/gcc/i686-pc-cygwin/4.8.2/include/c++/i686-pc-cygwin/
cpp11repl: exe
$(exename) -Wc++11-extensions -std=c++11 -I /usr/lib/gcc/i686-pc-cygwin/4.8.2/include/c++/ -I /usr/lib/gcc/i686-pc-cygwin/4.8.2/include/c++/i686-pc-cygwin/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment