/* * Copyright (C) 2007-2023 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."; // Deep memory checks #CXXFLAGS += "-fsanitize=address -fno-omit-frame-pointer"; #LDFLAGS += "-fsanitize=address -fno-omit-frame-pointer"; //CXXFLAGS += "-pg"; //LDFLAGS += "-pg"; action "default" { build: ["header-links", "libbu++.a", targets("tools")]; } action "lib" { build: ["header-links", "libbu++.a"]; } action "pkg" { build: targets("pkg"); } action "all" { build: ["header-links", "libbu++.a", targets("tools"), targets("tests")]; } action "tests" { build: 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 [".git", "version"]; } target "src/signals.h" { input "gensigs.bld"; display "generate"; profile "build" { genSigs( OUTPUT ); } } target "autoconfig" { rule "exe"; input "autoconfig.cpp"; } for base in ["stable", "unstable", "experimental"] do { target files("src/${base}/*.h").replace("src/${base}/", "bu/") { tag "header-links"; display "symlink"; input OUTPUT.replace("bu/","src/${base}/"); profile "build" { DIR = OUTPUT.dirName(); execute("mkdir -p ${DIR}; ln -s ../${INPUT} ${OUTPUT}"); } } } target ["bu/config.h", "bu/autoconfig.h", "bu/version.h", "bu/signals.h"] { tag "header-links"; display "symlink"; input OUTPUT.replace("bu/","src/"); profile "build" { DIR = OUTPUT.dirName(); execute("mkdir -p ${DIR}; ln -s ../${INPUT} ${OUTPUT}"); } } target files("src/compat/*.h").replace("src/", "bu/") { tag "header-links"; display "symlink"; input OUTPUT.replace("bu/","src/"); profile "build" { DIR = OUTPUT.dirName(); execute("mkdir -p ${DIR}; ln -s ../../${INPUT} ${OUTPUT}"); } } target "header-links" { input targets("header-links"); display "symlinks"; profile "build" { condition always; } } target "libbu++.a" { input files("src/stable/*.cpp", "src/unstable/*.cpp", "src/experimental/*.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++ -lpthread"; } 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 -lpthread"; } target "bin2cpp" { LDFLAGS += "-lz -lbz2 -llzma"; } // // 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++ -lpthread"; } // Some tests need extra libs and whatnot, that goes here. target ["tests/bzip2", "tests/streamstack"] { LDFLAGS += "-lbz2"; } target ["tests/deflate", "tests/enc"] { LDFLAGS += "-lz"; } target ["tests/lzma"] { LDFLAGS += "-llzma"; } target ["tests/threadid"] { 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++ -lpthread"; } rule "unit" { input "*.unit"; output INPUT.replace(".unit", ".cpp"); profile "build" { execute("./mkunit \"${INPUT}\" \"${OUTPUT}\""); } }