diff options
Diffstat (limited to 'solenv/doc/gbuild/solenv')
-rw-r--r-- | solenv/doc/gbuild/solenv/gbuild/alllangres.mk | 90 | ||||
-rw-r--r-- | solenv/doc/gbuild/solenv/gbuild/executable.mk | 25 | ||||
-rw-r--r-- | solenv/doc/gbuild/solenv/gbuild/gbuild.mk | 82 | ||||
-rw-r--r-- | solenv/doc/gbuild/solenv/gbuild/helper.mk | 42 | ||||
-rw-r--r-- | solenv/doc/gbuild/solenv/gbuild/library.mk | 41 | ||||
-rw-r--r-- | solenv/doc/gbuild/solenv/gbuild/linktarget.mk | 128 | ||||
-rw-r--r-- | solenv/doc/gbuild/solenv/gbuild/package.mk | 30 | ||||
-rw-r--r-- | solenv/doc/gbuild/solenv/gbuild/sdi.mk | 23 | ||||
-rw-r--r-- | solenv/doc/gbuild/solenv/gbuild/static_library.mk | 39 | ||||
-rw-r--r-- | solenv/doc/gbuild/solenv/gbuild/types.mk | 169 |
10 files changed, 669 insertions, 0 deletions
diff --git a/solenv/doc/gbuild/solenv/gbuild/alllangres.mk b/solenv/doc/gbuild/solenv/gbuild/alllangres.mk new file mode 100644 index 000000000000..8d5034e881dd --- /dev/null +++ b/solenv/doc/gbuild/solenv/gbuild/alllangres.mk @@ -0,0 +1,90 @@ +#include <types.h> + +namespace gb +{ + class SrsTarget; + class ResTarget; + class AllLangResTarget; + + class SrsPartTarget : public Target, public HasDependencies, public UsesRsc + { + private: + /// SrsPartTarget s 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<Path> include, + List<String> 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<String> 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<String> include); + /// Adds a SrsPartTarget to be processed. + void add_file(SrsPartTarget part); + /// Adds multiple SrsPartTarget s to be processed. + void add_files(List<SrsPartTarget> parts); + private: + /// SrsTarget s do not need to be explicitly constructed. + + /// They are a helper class for the ResTarget class. + SrsTarget(String name); + friend class ResTarget; + + List<String> DEFS; + List<String> INCLUDE + List<SrsPartTarget> PARTS; + static const List<String> DEFAULTDEFS; + }; + + class ResTarget : public Target, public IsCleanable, public HasSrs + { + public: + void add_file(Path file); + void add_files(List<Path> 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<Language> langs); + + /// The list of languages that need to be build. + static List<Language> LANGS; + }; +} +/* vim: set filetype=cpp : */ diff --git a/solenv/doc/gbuild/solenv/gbuild/executable.mk b/solenv/doc/gbuild/solenv/gbuild/executable.mk new file mode 100644 index 000000000000..8f7fcc9b0ce9 --- /dev/null +++ b/solenv/doc/gbuild/solenv/gbuild/executable.mk @@ -0,0 +1,25 @@ +#include <types.h> + +namespace gb +{ + using namespace types; + + class LinkTarget; + + class Executable : public IsCleanable, public HasDependencies, public IsLinking, public DeliversHeaders, public HasCompileSettings, public Target + { + public: + Executable(String name); + + private: + /// private helper function for the constructor + void Executable_impl(LinkTarget library_linktarget); + /// platformdependant additional setup for constructor (used on Windows only) + void Executable_platform(LinkTarget library_linktarget); + /// helper function to wrap LinkTargets functions (this is more or less pimpl ...) + void forward_to_linktarget(Function f); + + static const List<String> TARGETTYPEFLAGS; + }; +} +/* vim: set filetype=cpp : */ diff --git a/solenv/doc/gbuild/solenv/gbuild/gbuild.mk b/solenv/doc/gbuild/solenv/gbuild/gbuild.mk new file mode 100644 index 000000000000..97ca9b252789 --- /dev/null +++ b/solenv/doc/gbuild/solenv/gbuild/gbuild.mk @@ -0,0 +1,82 @@ + +#include <types.mk> +using namespace gb::types; + +// GNU make specific setup +static const Command SHELL; + + +// gbuild root directorys +static Path SRCDIR; +static Path OUTDIR; +static Path WORKDIR; + +// Expected from configure/environment +static const Integer OSL_DEBUG_LEVEL; +static const List<Path> JDKINCS; +static const List<Path> SOLARINC; +static const List<Path> SOLARLIB; +static const Path GBUILDDIR; +static const Path INPATH; +static const Path JAVA_HOME; +static const Path UPD; +static const String CVER; +static const String LIBXML_CFLAGS; +static const String OS; +static const String STLPORT_VER; +static const Bool DEBUG; +static const Bool PRODUCT; + +// gbuild global variables derived from the configure/environment +// some of these are defined per platform +namespace gb +{ + /// building with generated dependencies + static const Bool FULLDEPS; + /// product build or non-product build with additional assertions and tests + static const Bool PRODUCT; + /// command to run awk scripts + static const Command AWK; + /// command to compile c source files + static const Command CC; + /// command to compile c++ source files + static const Command CXX; + /// command to process input with a gcc compatible preprocessor + static const Command GCCP; + /// command to link objects on the microsoft toolchain + static const Command LINK; + /// command to create a unique temporary file + static const Command MKTEMP; + /// debuglevel: + /// 0=no debugging, + /// 1=non-product build, + /// 2=debugging build (either product or nonproduct) + static const Integer DEBUGLEVEL; + /// compiler specific optimization flags + static const List<String> COMPILEROPTFLAGS; + /// default c compilation compiler flags + static const List<String> CFLAGS; + /// compiler specific defines + static const List<String> COMPILERDEFS; + /// cpu-specific default defines + static const List<String> CPUDEFS; + /// default c++ compilation compiler flags + static const List<String> CXXFLAGS; + /// platform- and compilerindependent default defines + static const List<String> GLOBALDEFS; + /// default objective c++ compilation compiler flags + static const List<String> OBJCXXFLAGS; + /// platfomspecific default defines + static const List<String> OSDEFS; + /// ? + static const Path SDKDIR; +}; + +// GXX_INCLUDE_PATH (Linux) +// PTHREAD_CFLAGS (Linux) +// SYSTEM_ICU (Linux) +// SYSTEM_JPEG (Linux) +// SYSTEM_LIBXML (Linux) +// USE_SYSTEM_STL (Linux) + +/* 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 <types.h> + +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<TargetType> 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<TargetType> 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<TargetType> 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 new file mode 100644 index 000000000000..eba19a86156a --- /dev/null +++ b/solenv/doc/gbuild/solenv/gbuild/library.mk @@ -0,0 +1,41 @@ +#include <types.h> + +namespace gb +{ + using namespace types; + + class LinkTarget; + + class Library : public IsCleanable, public HasDependencies, public IsLinking, public DeliversHeaders, public HasCompileSettings, public Target + { + 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 + void Library_impl(LinkTarget library_linktarget); + /// platformdependant additional setup for constructor (used on Windows only) + void Library_platform( + LinkTarget library_linktarget, + Path dllfile); + /// helper function to wrap LinkTargets functions (this is more or less pimpl ...) + void forward_to_linktarget(Function f); + + /// List of buildable libraries (i.e. libraries that are not expected to exist outside of \$(OUTDIR) on the system). + static const List<Library> TARGETS; + /// List of additional defines for compiling objects for libraries + static const List<String> DEFS; + /// List of additional flags for linking a library + static const List<String> TARGETTYPEFLAGS; + /// Mapping from symbolic library names to dll filenames + static const Map<Library,Path> DLLFILENAMES; + /// Mapping from symbolic library names to filenames + static const Map<Library,Path> FILENAMES; + }; +} +/* vim: set filetype=cpp : */ diff --git a/solenv/doc/gbuild/solenv/gbuild/linktarget.mk b/solenv/doc/gbuild/solenv/gbuild/linktarget.mk new file mode 100644 index 000000000000..5fb7ead86b83 --- /dev/null +++ b/solenv/doc/gbuild/solenv/gbuild/linktarget.mk @@ -0,0 +1,128 @@ +#include <types.h> + +namespace gb +{ + using namespace types; + + class LinkTarget; + class Library; + class StaticLibrary; + class SdiTarget; + class Package; + + /// CObjects are never used standalone. They only exist as part of a + /// LinkTarget. + class CObject : public HasSource, public HasDependencies, public Target + { + public: + Path get_source(); + private: + /// 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 class LinkTarget; + + /// Platformdependent command to compile a plain C object. + static const Command command( + Path objectfile, + String name, + Path sourcefile, + List<String> defs, + List<String> cxxflags, + List<Path> include); + /// Platformdependent command to generate plain C object dependencies. + static const Command command_dep( + Path depfile, + String name, + Path sourcefile, + List<String> defs, + List<String> cxxflags, + List<Path> include); + }; + + /// CxxObjects are never used standalone. They only exist as part of a + /// LinkTarget. + class CxxObject : public HasSource, public HasDependencies, public Target + { + public: + 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 class LinkTarget; + + /// Platformdependent command to compile a C++ object. + static const Command command( + Path objectfile, + String name, + Path sourcefile, + List<String> defs, + List<String> cxxflags, + List<Path> include); + /// Platformdependent command to generate C++ object dependencies. + static const Command command_dep( + Path objectfile, + String name, + Path sourcefile, + List<String> defs, + List<String> cxxflags, + List<Path> include); + }; + + class LinkTarget : public IsCleanable, public HasDependencies, public IsLinking, public DeliversHeaders, public HasCompileSettings, public Target + { + public: + LinkTarget(String name); + + private: + void get_external_headers_check(); + void add_internal_headers(const List<Target>& 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 + /// the execution of the header rule, the LinkTarget is used (linked + /// against) but was never defined. This might work out, if the + /// LinkTarget has been provided by other means (for example: + /// build.pl/dmake), but it should never happen in a project where + /// all LinkTarget s are controlled by gbuild. + LinkTarget& SELF; + List<CObject> COBJECTS; + List<CxxObject> CXXOBJECTS; + List<Library> LINKED_LIBS; + List<Path> AUXTARGETS; + List<Path> INCLUDE; + List<Path> INCLUDE_STL; + List<StaticLibrary> LINKED_STATIC_LIBS; + List<String> CFLAGS; + List<String> CXXFLAGS; + List<String> DEFS; + List<String> LDFLAGS; + List<String> TARGETTYPE_FLAGS; + Path DLLTARGET; + + /// Platformdependent command for linking. + static const Command command ( + Path linktargetfile, + String linktargetname, + List<String> linkflags, + List<Library> linked_libs, + List<StaticLibrary> linked_static_libs, + List<CObject> cobjects, + List<CxxObject> cxxobjects); + /// Command to collect all dependencies of this LinkTarget. + static const Command command_dep( + Path depfile, + String linktargetname, + List<CObject> cobjects, + List<CxxObject> cxxobjects); + static const List<String> DEFAULTDEFS; + static const List<String> CXXFLAGS; + static const List<String> LDFLAGS; + static const List<Path> INCLUDE; + static const List<Path> INCLUDE_STL; + }; +} +/* vim: set filetype=cpp : */ 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 <types.h> + +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<Path> 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 <types.h> + +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<Path> 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 new file mode 100644 index 000000000000..787c6e732ede --- /dev/null +++ b/solenv/doc/gbuild/solenv/gbuild/static_library.mk @@ -0,0 +1,39 @@ +#include <types.h> + +namespace gb +{ + using namespace types; + + class LinkTarget; + + class StaticLibrary : public IsCleanable, public HasDependencies, public IsLinking, public DeliversHeaders, public HasCompileSettings, public Target + { + 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 + void StaticLibrary_impl(LinkTarget library_linktarget); + /// helper function to wrap LinkTargets functions (this is more or less pimpl ...). + void forward_to_linktarget(Function f); + + /// List of buildable static libraries (i.e. static libraries that are not expected to exist outside of \$(OUTDIR) on the system). + static const List<StaticLibrary> TARGETS; + /// List of additional defines for compiling objects for static libraries + static const List<String> DEFS; + /// List of additional flags for linking a static library + static const List<String> TARGETTYPEFLAGS; + /// Mapping from symbolic static library names to filenames + static const Map<StaticLibrary,Path> FILENAMES; + /// location to place static libraries in the \$(OUTDIR) + static const Path OUTDIRLOCATION; + /// platformdependant file extension for static libraries + static const String PLAINEXT; + }; +} +/* vim: set filetype=cpp : */ diff --git a/solenv/doc/gbuild/solenv/gbuild/types.mk b/solenv/doc/gbuild/solenv/gbuild/types.mk new file mode 100644 index 000000000000..ecb736834736 --- /dev/null +++ b/solenv/doc/gbuild/solenv/gbuild/types.mk @@ -0,0 +1,169 @@ +namespace gb { + class CObject; + class CxxObject; + class Library; + class StaticLibrary; + class Package; + class SdiTarget; +}; + +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. + class Path {}; + /// A target to be build. + class Target + { + 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 partial or complete shell-command. + class Command {}; + /// A integer number. + class Integer {}; + /// A boolean value. + + /// There are const boolean values true and false for + /// comparisons (written as $(true) and $(false) in makefiles. + class Bool {}; + /// A language (for localisation) + + /// A language represented by its ISO 639-1:2002 code. + class Language {}; + /// A List of objects. + + /// A List of objects represented by a whitespace separated list + /// in makefiles. + template <typename T> + class List<T> {}; + + /// A Mapping from with a key of type K and a value of type V + + /// A Mapping is represented by a whitespace separated list + /// of key-value pairs. Key and value are separated by a colon (:). + template <typename K, typename V> + class Map<K,V> {}; + /// A target that can be cleaned. + class IsCleanable + { + 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. + class HasDependencies + { + 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. + class HasSource + { + public: + /// The absolute filesystem path to the source file. + Path get_source(); + }; + /// A target that links objects and libraries. + class IsLinking + { + public: + /// Add a CObject to be compiled and linked. + void add_cobject(CObject cobject); + /// Add multiple CObject s to be compiled and linked. + void add_cobjects(List<CObject> cobjects); + /// Add a CxxObject to be compiled and linked. + void add_cxxobject(CxxObject cobject); + /// Add multiple CxxObject s to be compiled and linked. + void add_cxxobjects(List<CxxObject> cobjects); + /// Add multiple CxxObject s to be compiled and linked (with exceptions enabled). + void add_exception_objects(List<CxxObject> cobject); + /// Add libraries to link against dynamically. + void add_linked_libs(List<Library> linked_libs); + /// Add libraries to link against statically. + void add_linked_static_libs(List<StaticLibrary> 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(List<CxxObject> cobject); + /// Set auxiliary files that are produced by linking (for cleanup and copying). + void set_auxtargets(List<Path> auxtargets); + /// Set the location for the produced DLL (used on Windows only). + void set_dll_target(Path dlltarget); + /// Set additional flags for the link command. + void set_ldflags(List<Path> 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(List<Package> packages); + /// Add multiple SdiTargets that need to be delivered/generated + /// before compilation or dependency generation can start. + void add_sdi_headers(List<SdiTarget> 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 + /// just a few need to be modified. + void set_cflags(List<String> cflags); + /// Sets flags for C++ compilation. + /// \$\$(CXXFLAGS) contains the current flags and can be used if + /// just a few need to be modified. + void set_cxxflags(List<String> cxxflags); + /// Sets defines for C/C++ compilation. + /// \$\$(DEFS) contains the current flags and can be used if + /// just a few need to be modified. + void set_defs(List<String> defs); + /// Sets the include paths for C/C++ compilation. + /// \$\$(INCLUDE) contains the current paths and can be used if + /// just a few need to be modified. + void set_include(List<Path> include); + /// Sets the stl include paths for C++ compilation. + /// \$\$(INCLUDE_STL) contains the current paths and can be used if + /// just a few need to be modified. + void set_include_stl(List<Path> 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<SrsTarget> srs); + }; +}}; +/* vim: set filetype=cpp : */ |