3 This file is part of builder
4 Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
14 #include <msp/core/application.h>
15 #include <msp/datafile/loader.h>
16 #include <msp/path/path.h>
26 The main application class. Controls and owns everything. Rules the world.
28 class Builder: public Msp::Application
31 Builder(int, char **);
32 unsigned get_verbose() const { return verbose; }
33 bool get_dry_run() const { return dry_run; }
34 bool get_build_all() const { return build_all; }
35 Package *get_package(const std::string &);
36 Package *get_default_package() const { return default_pkg; }
37 Target *get_target(const std::string &) const;
38 const TargetMap &get_targets() const { return targets; }
39 Target *get_header(const std::string &, const std::string &, const std::string &, const StringList &);
40 Target *get_library(const std::string &, const std::string &, const StringList &, LibMode);
41 const Msp::Path::Path &get_cwd() const { return cwd; }
42 const std::string &get_arch_prefix(const std::string &) const;
43 std::string get_tool(const std::string &, const std::string &);
44 void apply_profile_template(Config &, const std::string &) const;
45 void add_target(Target *);
49 static void usage(const char *, const char *, bool);
51 class Loader: public Msp::DataFile::Loader
54 Loader(Builder &, const Msp::Path::Path &);
59 void package(const std::string &);
62 typedef std::list<Package *> PackageList;
63 typedef std::map<std::string, Package *> PackageMap;
64 typedef std::map<std::string, StringMap> ToolMap;
65 typedef std::map<std::string, StringMap> ProfileTemplateMap;
67 StringList cmdline_targets;
68 StringMap cmdline_options;
80 ToolMap tools; //< arch, tool name -> program name
81 StringMap archs; //< arch -> prefix
82 ProfileTemplateMap profile_tmpl;
91 std::string build_file;
99 int load_build_file(const Msp::Path::Path &);
100 int create_targets();
101 Target *get_header(const Msp::Path::Path &);
102 Target *get_library(const std::string &, const std::string &, const Msp::Path::Path &, LibMode);
103 void update_hash(std::string &, const std::string &);
106 int do_create_makefile();
109 static Msp::Application::RegApp<Builder> reg;