/* test * Copyright (C) 2007-2011 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. */ include "gensigs.bld"; 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")]; } action "unit" { build: targets("unit tests"); } action "myriadfs" { build: "myriadfs"; } target ["src/autoconfig.h", "src/version.h"] { input "autoconfig"; display "autoconfig"; profile "build" { execute("./autoconfig ${OUTPUT}"); } } target "src/version.h" { input ".svn"; } target "src/signals.h" { input "gensigs.bld"; profile "build" { genSigs( OUTPUT ); } } target "autoconfig" { rule "exe"; input "autoconfig.cpp"; } target [files("src/*.h").replace("src/", "bu/"), "bu/autoconfig.h", "bu/version.h", "bu/signals.h"] { 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++"; } target "viewcsv" { LDFLAGS += "-lncurses"; } target files("src/extra/*.cpp").replace("src/extra/","").replace(".cpp","") { input "src/extra/${OUTPUT}.cpp"; rule "exe"; requires "libbu++.a"; CXXFLAGS += "-I."; LDFLAGS += "-L. -lbu++"; } // // This shouldn't be. Basically, if you set a property on a top level target // that has children it seems like the items should apply to the children. // I'm honestly not 100% sure what the policy should be yet, but this seems like // I shouldn't have to do it this way. // target "src/extra/myriadfs.o" { CXXFLAGS += "-D_FILE_OFFSET_BITS=64"; } target "myriadfs" { LDFLAGS += "-lfuse"; } // // 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", "tests/streamstack"] { LDFLAGS += "-lbz2"; } target ["tests/deflate"] { LDFLAGS += "-lz"; } target ["tests/itoserver", "tests/socketblock", "tests/itoheap", "tests/itoqueue1", "tests/itoqueue2", "tests/conduit"] { 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", "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", "*.unit"); 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 \"${INPUT}\" \"${OUTPUT}\""); } }