X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Farchitecture.h;h=5446c04235f3f0465fe64c93f62fc31ce6fdfc4e;hb=4acfb2913d021b37e89465183d8226f4c95f72f9;hp=a205e5389998b854a6401dc83302095c2927a9b2;hpb=0f5283a54fd188072eca23fbd980a43c6c869913;p=builder.git diff --git a/source/architecture.h b/source/architecture.h index a205e53..5446c04 100644 --- a/source/architecture.h +++ b/source/architecture.h @@ -1,42 +1,62 @@ -/* $Id$ - -This file is part of builder -Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #ifndef ARCHITECTURE_H_ #define ARCHITECTURE_H_ #include -#include "misc.h" +#include "buildinfo.h" +#include "pattern.h" class Builder; +// XXX Add lib/exe prefix/suffix fields. Some archs may need multiple alternatives, how to handle this? class Architecture { public: class Loader: public Msp::DataFile::Loader { - public: - Loader(Architecture &); - Architecture &get_object() { return arch; } private: Architecture &arch; - void tool(const std::string &t, const std::string &p); + public: + Loader(Architecture &); + Architecture &get_object() { return arch; } }; - Architecture(Builder &b, const std::string &n); - void set_tool(const std::string &t, const std::string &p); - std::string get_tool(const std::string &t) const; - const std::string &get_name() const { return name; } - const std::string &get_prefix() const { return prefix; } + typedef std::list PatternList; + private: - Builder &builder; + Builder &builder; + std::string type; + std::string cpu; + std::string system; + unsigned bits; std::string name; - std::string prefix; - StringMap tools; + bool native; + std::string cross_prefix; + PatternList sharedlib_patterns; + PatternList staticlib_patterns; + PatternList executable_patterns; + +public: + Architecture(Builder &b, const std::string &spec); + + const std::string &get_name() const { return name; } + const std::string &get_system() const { return system; } + unsigned get_bits() const { return bits; } + const std::string &get_cpu() const { return cpu; } + bool match_name(const std::string &) const; + bool is_native() const { return native; } + bool is_cross() const { return !cross_prefix.empty(); } + + void set_cross_prefix(const std::string &); + const std::string &get_cross_prefix() const { return cross_prefix; } + + const PatternList &get_shared_library_patterns() const { return sharedlib_patterns; } + const PatternList &get_static_library_patterns() const { return staticlib_patterns; } + const PatternList &get_executable_patterns() const { return executable_patterns; } + +private: + std::string resolve_alias(const std::string &) const; + void parse_specification(const std::string &); }; typedef std::map ArchMap;