From 0408edd812369582faf4a12b9751d5b39b2e1e0f Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Thu, 29 Apr 2010 11:51:30 +0200 Subject: CWS gnumake2: refactoring, documenation --- solenv/doc/gbuild/doxygen.cfg | 4 +- solenv/doc/gbuild/solenv/gbuild/alllangres.mk | 90 +++++++++++++++++++++++ solenv/doc/gbuild/solenv/gbuild/helper.mk | 42 +++++++++++ solenv/doc/gbuild/solenv/gbuild/library.mk | 5 ++ solenv/doc/gbuild/solenv/gbuild/linktarget.mk | 36 ++++----- solenv/doc/gbuild/solenv/gbuild/package.mk | 30 ++++++++ solenv/doc/gbuild/solenv/gbuild/sdi.mk | 23 ++++++ solenv/doc/gbuild/solenv/gbuild/static_library.mk | 5 ++ solenv/doc/gbuild/solenv/gbuild/types.mk | 80 +++++++++++++------- 9 files changed, 269 insertions(+), 46 deletions(-) create mode 100644 solenv/doc/gbuild/solenv/gbuild/alllangres.mk create mode 100644 solenv/doc/gbuild/solenv/gbuild/helper.mk create mode 100644 solenv/doc/gbuild/solenv/gbuild/package.mk create mode 100644 solenv/doc/gbuild/solenv/gbuild/sdi.mk (limited to 'solenv/doc') diff --git a/solenv/doc/gbuild/doxygen.cfg b/solenv/doc/gbuild/doxygen.cfg index 86b35a6c5443..2345b58d5c30 100644 --- a/solenv/doc/gbuild/doxygen.cfg +++ b/solenv/doc/gbuild/doxygen.cfg @@ -170,7 +170,7 @@ SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. -TAB_SIZE = 8 +TAB_SIZE = 4 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". @@ -587,7 +587,7 @@ FILE_PATTERNS = *.mk # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. -RECURSIVE = NO +RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a diff --git a/solenv/doc/gbuild/solenv/gbuild/alllangres.mk b/solenv/doc/gbuild/solenv/gbuild/alllangres.mk new file mode 100644 index 000000000000..da55c114b983 --- /dev/null +++ b/solenv/doc/gbuild/solenv/gbuild/alllangres.mk @@ -0,0 +1,90 @@ +#include + +namespace gb +{ + class SrsTarget; + class ResTarget; + class AllLangResTarget; + + class SrsPartTarget : public Target, public HasDependencies, public UsesRsc + { + private: + /// SrsPartTarget do not need to be explicitly constructed. + + /// They are a helper class for the SrsTarget class. + /// They are named after the path of their source file (without + /// file extension) from the root of their source repository. + SrsPartTarget(String name); + friend class SrsTarget; + + /// Platformdependant command to generate the dependencies for the srs target. + static const Command command_dep( + String srsname, + Path sourcefile, + List include, + List defs); + }; + + class SrsTarget : public Target, public HasDependencies, public IsCleanable + { + public: + /// Sets defines for srs processing. + /// \$\$(DEFS) contains the current flags and can be used, if + /// just a few need to be modified. + void set_defs(List defs); + /// Sets the include paths for srs processing. + /// \$\$(INCLUDE) contains the current paths and can be used, if + /// just a few need to be modified. + void set_include(List include); + /// Adds a SrsPartTarget to be processed. + void add_file(SrsPartTarget part); + /// Adds multiple SrsPartTarget s to be processed. + void add_files(List parts); + private: + /// SrsPartTarget do not need to be explicitly constructed. + + /// They are a helper class for the ResTarget class. + SrsTarget(String name); + friend class ResTarget; + + List DEFS; + List INCLUDE + List PARTS; + static const List DEFAULTDEFS; + }; + + class ResTarget : public Target, public IsCleanable, public HasSrs + { + public: + void add_file(Path file); + void add_files(List files); + private: + /// ResTarget do not need to be explicitly constructed. + + /// They are a helper class for the AllLangResTarget class. + ResTarget(String name, String library, Language lang, Path reslocation); + friend class AllLangResTarget; + + String LIBRARY; + Language LANGUAGE; + Path RESLOCATION; + }; + + class AllLangResTarget : public Target, public IsCleanable, public HasSrs + { + public: + AllLangResTarget(String name); + /// Sets the location where resources are to be found. reslocation is a path relative to the default_images directory. + /// Resources will be found in reslocation itself and in the subdirectories res/ and imglst/ of it and again in subdirectories + /// of those named as the language of the processed resource. In addition, resources are found in the res/ directory directly + /// below default_images and the subdirectory of it named as the language of the processed resource. + void set_reslocation(Path reslocation); + private: + /// Sets the languages for which to create resources. + static void set_langs(List langs); + + /// The list of languages that need to be build. + static List LANGS; + }; +} +/* vim: set filetype=cpp : */ diff --git a/solenv/doc/gbuild/solenv/gbuild/helper.mk b/solenv/doc/gbuild/solenv/gbuild/helper.mk new file mode 100644 index 000000000000..3fa666b857a8 --- /dev/null +++ b/solenv/doc/gbuild/solenv/gbuild/helper.mk @@ -0,0 +1,42 @@ +#include + +String NEWLINE; +String COMMA; + +namespace gb +{ + using namespace types; + + class Helper + { + public: + /// Abbreviates the common directory roots in a command + static Command abbreviate_dirs(Command c); + /// Announces the start/end of an task. + static void announce(String announcement); + /// Creates the default get_clean_target() function for the type. + static void make_clean_target(TargetType t); + /// Creates the default get_clean_target() function for the types. + static void make_clean_targets(List ts); + /// Creates the default get_dep_target() function for the type. + static void make_dep_target(TargetType t); + /// Creates the default get_dep_target() function for the types. + static void make_dep_targets(List ts); + /// Creates the default get_dep_target() function for the type modifying the \$(OUTDIR). + static void make_outdir_clean_target(TargetType t); + /// Creates the default get_dep_target() function for types modifying the \$(OUTDIR). + static void make_outdir_clean_targets(List ts); + /// Returns the clean target of a target modifying the \$(OUTDIR). + static Path get_outdir_clean_target(Path target); + + /// The path to a zero length file. + static const Path NULLFILE; + /// The path to the misc directory for temporary files etc. + static const Path MISC; + /// The path to a phony target, that is always outdated. + static const Path PHONY; + /// Internally used dummy file. + static const Path MISCDUMMY; + }; +} +/* vim: set filetype=cpp : */ diff --git a/solenv/doc/gbuild/solenv/gbuild/library.mk b/solenv/doc/gbuild/solenv/gbuild/library.mk index 152578074ce5..85e1f6141a0f 100644 --- a/solenv/doc/gbuild/solenv/gbuild/library.mk +++ b/solenv/doc/gbuild/solenv/gbuild/library.mk @@ -10,6 +10,11 @@ namespace gb { public: Library(String name) {}; + /// Returns how the library is named in the filesystem on the current platform. + /// Library filename schemes are defined in solenv/gbuild/libnames.mk (with some platformdependant hacks in solenv/gbuild/platform/*.mk. + + /// This function needs to be defined in solenv/gbuild/target_names.mk so that it is available to everywhere. + Path get_filename(); private: /// private helper function for the constructor diff --git a/solenv/doc/gbuild/solenv/gbuild/linktarget.mk b/solenv/doc/gbuild/solenv/gbuild/linktarget.mk index d1cf369d1974..1cef68c1a21b 100644 --- a/solenv/doc/gbuild/solenv/gbuild/linktarget.mk +++ b/solenv/doc/gbuild/solenv/gbuild/linktarget.mk @@ -20,25 +20,25 @@ namespace gb /// CObjects do not need to be explicitly constructed. /// They are named after the path of their source file (without /// file extension) from the root of their source repository. - CObject(String name) {}; - friend LinkTarget; + CObject(String name); + friend class LinkTarget; - /// Platformdependant command to compile a plain C object. + /// Platformdependent command to compile a plain C object. static const Command command( Path objectfile, String name, Path sourcefile, List defs, List cxxflags, - List include); - /// Platformdependant command to generate plain C object dependancies. + List include); + /// Platformdependent command to generate plain C object dependencies. static const Command command_dep( Path depfile, String name, Path sourcefile, List defs, List cxxflags, - List include); + List include); }; /// CxxObjects are never used standalone. They only exist as part of a @@ -46,40 +46,40 @@ namespace gb class CxxObject : public HasSource, public HasDependencies, public Target { public: - Path get_source() {}; + Path get_source(); private: /// CxxObjects do not need to be explicitly constructed. /// They are named after the path of their source file (without /// file extension) from the root of their source repository. - CxxObject(String name) {}; - friend LinkTarget; + CxxObject(String name); + friend class LinkTarget; - /// Platformdependant command to compile a C++ object. + /// Platformdependent command to compile a C++ object. static const Command command( Path objectfile, String name, Path sourcefile, List defs, List cxxflags, - List include); - /// Platformdependant command to generate C++ object dependancies. + List include); + /// Platformdependent command to generate C++ object dependencies. static const Command command_dep( Path objectfile, String name, Path sourcefile, List defs, List cxxflags, - List include); + List include); }; class LinkTarget : public IsCleanable, public HasDependencies, public IsLinking, public DeliversHeaders, public HasCompileSettings, public Target { public: - LinkTarget(String name) {}; + LinkTarget(String name); private: - void get_external_headers_check() {}; - void add_internal_headers(const List& internal_headers) {}; + void get_external_headers_check(); + void add_internal_headers(const List& internal_headers); /// @warning Evil Hack: SELF is set to the name of the LinkTarget /// in the constructor. If SELF is not set to the LinkTarget name in @@ -103,7 +103,7 @@ namespace gb List TARGETTYPE_FLAGS; Path DLLTARGET; - /// Platformdependant command for linking. + /// Platformdependent command for linking. static const Command command ( Path linktargetfile, String linktargetname, @@ -112,7 +112,7 @@ namespace gb List linked_static_libs, List cobjects, List cxxobjects); - /// Command to collect all dependancies of this LinkTarget. + /// Command to collect all dependencies of this LinkTarget. static const Command command_dep( Path depfile, String linktargetname, diff --git a/solenv/doc/gbuild/solenv/gbuild/package.mk b/solenv/doc/gbuild/solenv/gbuild/package.mk new file mode 100644 index 000000000000..53daeb5c80af --- /dev/null +++ b/solenv/doc/gbuild/solenv/gbuild/package.mk @@ -0,0 +1,30 @@ +#include + +namespace gb +{ + using namespace types; + class PackagePart + { + private: + /// PackagePart s do not need to be explicitly constructed. + /// They are named after the path of their source file (without + /// file extension) from the root of their source repository. + PackagePart(String name, Path Source); + friend Package; + /// Returns a list of aboslute paths where files are copied to with the PackagePart class. + + /// This function needs to be defined in solenv/gbuild/target_names.mk so that it is available to everywhere. + static const List get_destinations(); + }; + + class Package : public Target, public IsCleanable + { + public: + /// Creates a new package that copies files from source_dir to the \$(OUTDIR). + Package(String name, Path source_dir); + /// Adds a file to the package. destination is the relative path in + /// the \$(OUTDIR) and source is the relative path in the source_dir. + add_file(Path destination, Path source); + } +} +/* vim: set filetype=cpp : */ diff --git a/solenv/doc/gbuild/solenv/gbuild/sdi.mk b/solenv/doc/gbuild/solenv/gbuild/sdi.mk new file mode 100644 index 000000000000..f9f913fb141c --- /dev/null +++ b/solenv/doc/gbuild/solenv/gbuild/sdi.mk @@ -0,0 +1,23 @@ +#include + +namespace gb +{ + using namespace types; + + class SdiTarget : public Target, public IsCleanable + { + public: + /// Creates a new SdiTarget. + SdiTarget(String name, String exports); + /// Sets the include paths for this SdiTarget. + set_include(List includes); + private: + /// The command to execute svidl. + static const Command SVIDLCOMMAND; + /// The target on with to depend to make sure the svidl executable is available. + static const Path SVIDLTARGET; + /// The target on with to depend to make sure the auxiliary files (libraries etc.) for the svidl executable are available. + static const Path SVIDLAUXDEPS; + }; +} +/* vim: set filetype=cpp : */ diff --git a/solenv/doc/gbuild/solenv/gbuild/static_library.mk b/solenv/doc/gbuild/solenv/gbuild/static_library.mk index c6b81960f74e..741589f582c2 100644 --- a/solenv/doc/gbuild/solenv/gbuild/static_library.mk +++ b/solenv/doc/gbuild/solenv/gbuild/static_library.mk @@ -10,6 +10,11 @@ namespace gb { public: StaticLibrary(String name) {}; + /// Returns how the library is named in the filesystem on the current platform. + /// StaticLibrary filename schemes are defined in solenv/gbuild/libnames.mk (with some platformdependant hacks in solenv/gbuild/platform/*.mk. + + /// This function needs to be defined in solenv/gbuild/target_names.mk so that it is available to everywhere. + Path get_filename(); private: /// private helper function for the constructor diff --git a/solenv/doc/gbuild/solenv/gbuild/types.mk b/solenv/doc/gbuild/solenv/gbuild/types.mk index 1cddf1a7f401..ecb736834736 100644 --- a/solenv/doc/gbuild/solenv/gbuild/types.mk +++ b/solenv/doc/gbuild/solenv/gbuild/types.mk @@ -9,6 +9,8 @@ namespace gb { namespace gb { namespace types { + /// A type of target, with its set of rules etc., as used in the build system. + class TargetType {}; /// A plain old string. class String {}; /// A partial, relative or absolute filesystem path. @@ -18,10 +20,10 @@ namespace gb { namespace types { public: /// The absolute filesystem path representing the target. + + /// This function needs to be defined in solenv/gbuild/target_names.mk so that it is available to everywhere. Path get_target(); }; - /// A target that can be linked against statically. - class StaticLinkable {}; /// A partial or complete shell-command. class Command {}; /// A integer number. @@ -53,6 +55,8 @@ namespace gb { namespace types { public: /// The (phony) absolute filesystem path to clean the target. + + /// This function needs to be defined in solenv/gbuild/target_names.mk so that it is available to everywhere. Path get_clean_target(); }; /// A target that has generated dependencies. @@ -60,6 +64,8 @@ namespace gb { namespace types { public: /// The absolute filesystem path to the file containing the dependencies. + + /// This function needs to be defined in solenv/gbuild/target_names.mk so that it is available to everywhere. Path get_dep_target(); }; /// A target that has a source file from which it is generated. @@ -74,68 +80,90 @@ namespace gb { namespace types { public: /// Add a CObject to be compiled and linked. - void add_cobject(const CObject& cobject); + void add_cobject(CObject cobject); /// Add multiple CObject s to be compiled and linked. - void add_cobjects(const List& cobjects); + void add_cobjects(List cobjects); /// Add a CxxObject to be compiled and linked. - void add_cxxobject(const CxxObject& cobject); + void add_cxxobject(CxxObject cobject); /// Add multiple CxxObject s to be compiled and linked. - void add_cxxobjects(const List& cobjects); + void add_cxxobjects(List cobjects); /// Add multiple CxxObject s to be compiled and linked (with exceptions enabled). - void add_exception_objects(const List& cobject); + void add_exception_objects(List cobject); /// Add libraries to link against dynamically. - void add_linked_libs(const List& linked_libs); + void add_linked_libs(List linked_libs); /// Add libraries to link against statically. - void add_linked_static_libs(const List& linked_static_libs); + void add_linked_static_libs(List linked_static_libs); /// Add multiple CxxObject s to be compiled and linked (without exceptions enabled). - /// @deprecated { We should not care about disabling exception. } - void add_noexception_objects(const List& cobject); + /// @deprecated We should not care about disabling exception. + void add_noexception_objects(List cobject); /// Set auxiliary files that are produced by linking (for cleanup and copying). - void set_auxtargets(const List& auxtargets); + void set_auxtargets(List auxtargets); /// Set the location for the produced DLL (used on Windows only). - void set_dll_target(const Path& dlltarget); + void set_dll_target(Path dlltarget); /// Set additional flags for the link command. - void set_ldflags(const List& ldflags); + void set_ldflags(List ldflags); }; /// A target that delivers headers of some kind. class DeliversHeaders { public: /// The absolute filesystem path which is touched when all headers for this target are prepared. + + /// This function needs to be defined in solenv/gbuild/target_names.mk so that it is available to everywhere. Path get_headers_target(); /// The absolute filesystem path which is touched when all external headers for this target are prepared. + + /// This function needs to be defined in solenv/gbuild/target_names.mk so that it is available to everywhere. Path get_external_headers_target(); /// Add multiple Packages that need to be delivered/generated /// before compilation or dependency generation can start. - void add_package_headers(const List& packages); + void add_package_headers(List packages); /// Add multiple SdiTargets that need to be delivered/generated /// before compilation or dependency generation can start. - void add_sdi_headers(const List& sdis); + void add_sdi_headers(List sdis); }; /// A target where settings for the compilation can be set. class HasCompileSettings { public: /// Sets flags for plain C compilation. - /// \$\$(CFLAGS) contains the current flags and can be used, if + /// \$\$(CFLAGS) contains the current flags and can be used if /// just a few need to be modified. - void set_cflags(const List& cflags); + void set_cflags(List cflags); /// Sets flags for C++ compilation. - /// \$\$(CXXFLAGS) contains the current flags and can be used, if + /// \$\$(CXXFLAGS) contains the current flags and can be used if /// just a few need to be modified. - void set_cxxflags(const List& cxxflags); + void set_cxxflags(List cxxflags); /// Sets defines for C/C++ compilation. - /// \$\$(DEFS) contains the current flags and can be used, if + /// \$\$(DEFS) contains the current flags and can be used if /// just a few need to be modified. - void set_defs(const List& defs); + void set_defs(List defs); /// Sets the include paths for C/C++ compilation. - /// \$\$(INCLUDE) contains the current paths and can be used, if + /// \$\$(INCLUDE) contains the current paths and can be used if /// just a few need to be modified. - void set_include(const List& include); + void set_include(List include); /// Sets the stl include paths for C++ compilation. - /// \$\$(INCLUDE_STL) contains the current paths and can be used, if + /// \$\$(INCLUDE_STL) contains the current paths and can be used if /// just a few need to be modified. - void set_include_stl(const List& include_stl); + void set_include_stl(List include_stl); + }; + /// A target using the resource compiler + class UsesRsc + { + public: + /// The command to execute rsc. + static const Command RSCCOMMAND; + /// The target on with to depend to make sure the rsc executable is available. + static const Path RSCTARGET; + }; + /// A target processing a set of srs files + class HasSrs + { + public: + /// Add a SrsTarget to be processed. + void add_one_srs(SrsTarget srs); + /// Add multiple SrsTarget s to be processed. + void add_srs(List srs); }; }}; /* vim: set filetype=cpp : */ -- cgit v1.2.3