citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit de5693de88742df3e6fdef0a9e0ab710d3548d8d
parent 70906ce9d8ed29472a7d947e233b0bfe0fd35956
Author: Kyle Milz <kyle@0x30.net>
Date:   Wed, 21 Dec 2016 18:19:12 -0700

src: move the rest of Jamrules.in into configure

Diffstat:
MJamfile | 8+++-----
DJamrules.in | 28----------------------------
Mconfigure | 44++++++++++++++++++++++++++++++++++++++------
3 files changed, 41 insertions(+), 39 deletions(-)

diff --git a/Jamfile b/Jamfile @@ -9,17 +9,15 @@ SubInclude TOP src ; # actions StaticAnalysis { - export CITRUN_SA=1 - ./configure + scan-build ./configure scan-build -o html --use-c++=eg++ jam -j4 - # scan-build -o html -v --use-c++=eg++ jam -j4 } actions TestCoverage { set -e - ./configure - CFLAGS="-coverage -ggdb" LDFLAGS="-coverage" jam -j4 + CFLAGS="-coverage" LDFLAGS="-coverage" ./configure + jam -j4 # Roll libgcov.a into libcitrun.a. ar -M < t/libcitrun_gcov.mri diff --git a/Jamrules.in b/Jamrules.in @@ -1,28 +0,0 @@ -echo ...build C It Run on $(OS)... ; - -CCFLAGS += $(CFLAGS) ; -C++FLAGS += -std=c++11 -fno-exceptions -fno-rtti $(CFLAGS) ; -LINKFLAGS += $(LDFLAGS) ; - -if $(OS) = OPENBSD { - C++ = eg++ ; - LDGROUP_START = -Wl,--start-group ; - LDGROUP_END = -Wl,--end-group ; -} - -if $(OS) = MACOSX { - LINKLIBS on citrun-gl = -framework OpenGL ; -} - -if $(OS) = LINUX { - LINKLIBS on citrun-gl = -lbsd ; - LINKLIBS on citrun-inst = -lbsd ; - LDGROUP_START = -Wl,--start-group ; - LDGROUP_END = -Wl,--end-group ; -} - -if $(CITRUN_SA) { - # scan-build sets these expecting us to pick up the new values. - CC = $(CC) ; - C++ = $(CXX) ; -} diff --git a/configure b/configure @@ -4,7 +4,7 @@ # ░█░░░░░░█░░░█░░░░█▀▄░█░█░█░█ # ░▀▀▀░░░▀▀▀░░▀░░░░▀░▀░▀▀▀░▀░▀ # -# Creates Jamrules from Jamrules.in and output from this script. +# Creates Jamrules. # type pkg-config type llvm-config @@ -18,12 +18,29 @@ type llvm-config # - OpenGLES >= 2.0 gl_pkgs="osmesa glfw3 glew freetype2" -pkg-config --exists $gl_pkgs -cp Jamrules.in Jamrules -cat <<EOF >> Jamrules +should_exit=0 +for pkg in $gl_pkgs; do + if ! pkg-config --exists $pkg; then + echo "$pkg not found" + should_exit=1 + fi +done +test $should_exit -eq 0 || exit 1 + +cat <<EOF > Jamrules +# +# Generated by './configure' on `date` +# +echo ...build C It Run on \$(OS)... ; + +CC = ${CC-cc} ; +C++ = ${CXX-c++} ; + +CCFLAGS += "${CFLAGS-}" ; +C++FLAGS += -std=c++11 -fno-exceptions -fno-rtti ${CFLAGS-} ; +LINKFLAGS += "${LDFLAGS-}" ; -# Automatically generated on `date` CITRUN_SRCDIR = "`pwd`/src" ; GL_CFLAGS = "`pkg-config --cflags glfw3 glew freetype2`" ; @@ -34,6 +51,21 @@ INST_CFLAGS = "`llvm-config --cxxflags`" ; INST_LDFLAGS = "`llvm-config --ldflags`" ; INST_LIBS = "`llvm-config --libs bitreader mcparser transformutils option`" ; INST_LIBS += "`llvm-config --system-libs`" ; + +if \$(OS) = OPENBSD { + LDGROUP_START = -Wl,--start-group ; + LDGROUP_END = -Wl,--end-group ; +} + +if \$(OS) = MACOSX { + LINKLIBS on citrun-gl = -framework OpenGL ; +} + +if \$(OS) = LINUX { + LINKLIBS on citrun-gl citrun-inst = -lbsd ; + LDGROUP_START = -Wl,--start-group ; + LDGROUP_END = -Wl,--end-group ; +} EOF -echo ">> Jamrules created. Now run \`jam\` to build" +echo "...call \`jam\` to build..."