/* * Copyright (C) 2007-2010 Xagasoft, All rights reserved. * * This file is part of the libbu++ library and is released under the * terms of the license contained in the file LICENSE. */ /** * This is the default.bld file for libbu++, it pretty much handles everything * libbu++ related, kinda' cool, eh? It can completely replace the old build * and actually does a better job with a number of things. */ CXXFLAGS += "-ggdb -W -Wall -I."; action "default" { build: [targets("header-links"), "libbu++.a", targets("tools")]; } action "pkg" { build: targets("pkg"); } action "all" { build: [targets("header-links"), "libbu++.a", targets("tools"), targets("tests")]; } target files("src/*.h").replace("src/", "bu/") { tag "header-links"; display "symlink"; input OUTPUT.replace("bu/","src/"); profile "build" { execute("mkdir -p $(dirname ${OUTPUT}); ln -s ../${INPUT} ${OUTPUT}"); } } target files("src/compat/*.h").replace("src/", "bu/") { tag "header-links"; display "symlink"; input OUTPUT.replace("bu/","src/"); profile "build" { execute("mkdir -p $(dirname ${OUTPUT}); ln -s ../../${INPUT} ${OUTPUT}"); } } target "libbu++.a" { input files("src/*.cpp", "src/compat/*.cpp"); rule "lib"; CXXFLAGS += "-I. -fPIC"; } // // Tools // target files("src/tools/*.cpp").replace("src/tools/","").replace(".cpp","") { input "src/tools/${OUTPUT}.cpp"; rule "exe"; requires "libbu++.a"; tag "tools"; CXXFLAGS += "-I."; LDFLAGS += "-L. -lbu++"; } // // General Tests // target files("src/tests/*.cpp").replace("src/","").replace(".cpp","") { input "src/${OUTPUT}.cpp"; rule "exe"; requires "libbu++.a"; tag ["tests", "general tests"]; CXXFLAGS += "-I."; LDFLAGS += "-L. -lbu++"; } // Some tests need extra libs and whatnot, that goes here. target "tests/bzip2" { LDFLAGS += "-lbz2"; } target ["tests/itoserver", "tests/socketblock", "tests/itoheap", "tests/itoqueue1", "tests/itoqueue2"] { LDFLAGS += "-lpthread"; } // // Unit tests // target files("src/unit/*.unit").replace("src/","").replace(".unit","") { input "src/${OUTPUT}.unit"; rule "exe"; requires "libbu++.a"; tag ["tests", "unit tests"]; CXXFLAGS += "-I."; LDFLAGS += "-L. -lbu++"; } target "libbu++-r$(svnversion "-n").tar.bz2" { input [ "LICENSE", "build.conf", "Doxyfile", files("*.bld"), "support/vim/syntax/taf.vim", "support/vim/ftdetect/taf.vim", "support/vim/ftplugin/taf.vim", files("*.sh"), files("src/*.cpp"), files("src/*.h"), files("src/tests/*.cpp"), files("src/tests*.h"), files("src/tools/*.cpp"), files("src/tools/*.h"), files("src/unit/*.unit"), files("src/doxy/*.dox"), files("src/compat/*.cpp"), files("src/compat/*.h") ]; rule "tarball"; tag "pkg"; } rule "tarball" { input matches("LICENSE", "*.cpp", "*.h", "*.conf", "*.bld", "Doxyfile", "*.vim", "*.sh"); profile "build" { OUTDIR = OUTPUT.replace(".tar.bz2",""); execute("tar --transform=\"s@^@${OUTDIR}/@\" -c ${INPUT} |" " bzip2 -9 > ${OUTPUT}"); } } rule "unit" { input "*.unit"; output INPUT.replace(".unit", ".cpp"); profile "build" { execute("./mkunit.sh \"${INPUT}\" \"${OUTPUT}\""); } }