#include "gnuarchiver.h"
#include "gnuccompiler.h"
#include "gnucxxcompiler.h"
#include "gnulinker.h"
#include "installedfile.h"
#include "gnuarchiver.h"
#include "gnuccompiler.h"
#include "gnucxxcompiler.h"
#include "gnulinker.h"
#include "installedfile.h"
GetOpt getopt;
getopt.add_option('a', "analyze", analyze_mode, GetOpt::REQUIRED_ARG).set_help("Perform dependency analysis.", "MODE");
GetOpt getopt;
getopt.add_option('a', "analyze", analyze_mode, GetOpt::REQUIRED_ARG).set_help("Perform dependency analysis.", "MODE");
- getopt.add_option('b', "build", build, GetOpt::NO_ARG).set_help("Perform build even if doing analysis.");
+ getopt.add_option('b', "build", build, GetOpt::NO_ARG).set_help("Perform build even if also doing something else.");
getopt.add_option('c', "clean", clean, GetOpt::NO_ARG).set_help("Clean buildable targets.");
getopt.add_option('f', "file", build_file, GetOpt::REQUIRED_ARG).set_help("Read build instructions from FILE.", "FILE");
getopt.add_option('h', "help", help, GetOpt::NO_ARG).set_help("Print this message.");
getopt.add_option('c', "clean", clean, GetOpt::NO_ARG).set_help("Clean buildable targets.");
getopt.add_option('f', "file", build_file, GetOpt::REQUIRED_ARG).set_help("Read build instructions from FILE.", "FILE");
getopt.add_option('h', "help", help, GetOpt::NO_ARG).set_help("Print this message.");
for(list<string>::const_iterator i=log_channels.begin(); i!=log_channels.end(); ++i)
{
vector<string> parts = split(*i, ',');
for(list<string>::const_iterator i=log_channels.begin(); i!=log_channels.end(); ++i)
{
vector<string> parts = split(*i, ',');
- load_build_file((FS::get_sys_data_dir(argv[0], "builder")/"builderrc").str());
- load_build_file((FS::get_user_data_dir("builder")/"rc").str());
+ list<FS::Path> start_files;
+ start_files.push_back(FS::get_sys_data_dir(argv[0], "builder")/"builderrc");
+ start_files.push_back(FS::get_user_data_dir("builder")/"rc");
+ for(list<FS::Path>::const_iterator i=start_files.begin(); i!=start_files.end(); ++i)
+ if(FS::exists(*i))
+ load_build_file(*i);
toolchain.add_tool(new Copy(*this));
toolchain.add_tool(new Tar(*this));
toolchain.add_tool(new PkgConfigGenerator(*this));
toolchain.add_tool(new Copy(*this));
toolchain.add_tool(new Tar(*this));
toolchain.add_tool(new PkgConfigGenerator(*this));
list<string> package_details;
for(PackageManager::PackageMap::const_iterator i=packages.begin(); i!=packages.end(); ++i)
{
list<string> package_details;
for(PackageManager::PackageMap::const_iterator i=packages.begin(); i!=packages.end(); ++i)
{
- logger.log("summary", format("%d active packages, %d targets", package_details.size(), targets.size()));
+ logger.log("summary", format("%d active packages, %d targets", package_details.size(), build_graph.get_targets().size()));
for(list<string>::const_iterator i=package_details.begin(); i!=package_details.end(); ++i)
logger.log("packages", *i);
for(list<string>::const_iterator i=package_details.begin(); i!=package_details.end(); ++i)
logger.log("packages", *i);
void Builder::problem(const string &p, const string &d)
{
problems.push_back(Problem(p, d));
}
void Builder::problem(const string &p, const string &d)
{
problems.push_back(Problem(p, d));
}
-void Builder::add_target(Target *t)
-{
- targets.insert(TargetMap::value_type(t->get_name(), t));
-}
-
-void Builder::add_primary_target(Target &t)
-{
- get_target("world")->add_dependency(t);
-
- if(t.get_package()==main_pkg && t.get_component() && t.get_component()->is_default())
- get_target("default")->add_dependency(t);
-}
-
IO::BufferedFile in(fn.str());
logger.log("files", format("Reading %s", fn));
IO::BufferedFile in(fn.str());
logger.log("files", format("Reading %s", fn));
- Target *world = new VirtualTarget(*this, "world");
-
- Target *def_tgt = new VirtualTarget(*this, "default");
- world->add_dependency(*def_tgt);
-
- Target *install = new VirtualTarget(*this, "install");
- world->add_dependency(*install);
+ package_manager.get_main_package().prepare();
- Target *tarballs = new VirtualTarget(*this, "tarballs");
- world->add_dependency(*tarballs);
-
- main_pkg->prepare();
-
- // Make the cmdline target depend on all targets mentioned on the command line
- Target *cmdline = new VirtualTarget(*this, "cmdline");
- for(list<string>::iterator i=cmdline_targets.begin(); i!=cmdline_targets.end(); ++i)
+ // Add targets from command line as goals
+ for(NameList::iterator i=cmdline_targets.begin(); i!=cmdline_targets.end(); ++i)
- Target *cmdline = get_target("cmdline");
-
- unsigned total = 0;
- for(map<string, Target *>::const_iterator i=targets.begin(); i!=targets.end(); ++i)
- if(i->second->is_buildable() && i->second->needs_rebuild())
- ++total;
+ unsigned total = build_graph.count_rebuild_targets();
- const PackageList &requires = main_pkg->get_required_packages();
- for(PackageList::const_iterator i=requires.begin(); i!=requires.end(); ++i)
+ const Package::Requirements &requires = main_pkg.get_required_packages();
+ for(Package::Requirements::const_iterator i=requires.begin(); i!=requires.end(); ++i)
void Builder::Loader::package(const string &n)
{
SourcePackage *pkg = new SourcePackage(obj, n, get_source());
void Builder::Loader::package(const string &n)
{
SourcePackage *pkg = new SourcePackage(obj, n, get_source());