cbp2make-147+dfsg/0000755000175000017500000000000012305647324013660 5ustar moellermoellercbp2make-147+dfsg/wx-config.sh0000644000175000017500000000027511522613364016116 0ustar moellermoeller#!/bin/bash opts="--local --config variable --add -set default -name wx" cbp2make $opts -field lflags -value "`wx-config --libs`" cbp2make $opts -field cflags -value "`wx-config --cflags`" cbp2make-147+dfsg/res/0000755000175000017500000000000012155023266014445 5ustar moellermoellercbp2make-147+dfsg/res/cbp2make.png0000644000175000017500000000324112143137414016635 0ustar moellermoellerPNG  IHDR00WsBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<tEXtTitlecbp2make logo? tEXtAuthorMirai Computing]ItEXtCopyrightPublic Domain http://creativecommons.org/licenses/publicdomain/YIDATh՘klUk ƸQ4h..$0xQ0DqH8Àeuvnc79?ssADZ֛. I)XXfxf|d: "J8&\dP zaCl WcfpU|a-ް^U01{x@ lPcϻ!̄z7ϡflpmnOU( JA`-HwHP = 5a Ϡ@`((` g,NŵgPS%v;,_}8 H}{L R[;bCl_HWHsBZl )/^T~HDzTiy9Uc2n&KKTWhSoy5 Ӣg{ONЕRnRjR\L ^?AN7 <5s0a MFoLD"n!5 2 Jx`~N-Pu ϋ/@C+)0e+#t?pt4D0X4#{ v/c$kU/ +$9%hAfE IM>h?_oc RMyuteR J6МT,Ŀ(EWB8~;fFS3wy%N*h袪{Q&@@VBDg*3@IZ:^rY˓ %\vG5lq f=}ٙY/t:#kZ8pv4w)]l~p;_B'2TAǥlmR>L1UGhl ED8$z+oҳ: lXUŊc)"*I/Q-YpeVIENDB`cbp2make-147+dfsg/res/cbp2make.svg0000644000175000017500000002370112143137414016653 0ustar moellermoeller cbp2make logo image/svg+xml cbp2make logo Mirai Computing Mirai Computing Mirai Computing cbp2make-147+dfsg/changelog.txt0000644000175000017500000001625512155023046016351 0ustar moellermoellerKEY [ ]pending [+]new/added [-]removed [*]changed/in-progress [!]fixed --- revision #147 : 09jun2013 --- [!] Fixed setting of automatic file prefix for targets ('lib' for static libraries, etc). [+] Partially reworked support for multiple toolchains. [+] Declared MSVC and Borland toolchains. --- revision #138 : 02feb2013 --- [!] Fixed out-of-order execution of rules due to missing dependencies when -jN option is used. [!] Fixed possible 'could not find getcwd' build error due to missing #include. [*] Corrected default command templates for GCC dynamic library and executable linker. [+] Added support for multiple platform-specific library extensions. --- revision #137 : 02sep2012 --- [!] Fixed output path for Windows resource compiler. [!] Removed false messages about missing compiler for non-compilable units. [+] "-mwindows" option is now supplied to the GCC linker for Windows GUI builds; for other manually added compilers, an "option_wingui" is available in configuration. --- revision #136 : 30jul2012 --- [!] Fixed option syntax for libraries. --- revision #135 : 10may2012 --- [!] Fixed possible crash when compiler variable is overridden for units. [!] Quick fix for handling relative paths outside project tree. --- revision #133 : 30mar2012 --- [!] Fixed reading of virtual targets from project file. [+] Implemented build target selection for virtual targets. --- revision #130 : 18mar2012 --- [+] Implemented handling of spaces and special characters in paths. --- revision #127 : 30nov2011 --- [!] Fixed possible crash due to undefined toolchain. [!] Rechecked global compiler variable evaluation. --- revision #125 : 27nov2011 --- [+] Implemented toolchain selection without explicit duplicates. [+] Added an option to control case of macro variables. [!] Fixed case mismatch issues. [!] Fixed platform selection. --- revision #120 : 17oct2011 --- [+] Implemented build target selection with option "-targets ". [+] Added options "--keep-objdir" and "--keep-outdir" to keep directories for object files and output binary which are forcefully removed withing "clean_*" target by default. --- revision #118 : 05sep2011 --- [!] Fixed wrong unit index building procedure that ignored project constraints and attached all units to all of project targets. [*] Updated documentation. --- revision #112 : 26jul2011 --- [!] Fixed missing toolchain index for multi-toolchain projects. --- revision #110 : 18jul2011 --- [!] Fixed target names in virtual target dependencies. [!] Fixed verbosity setting leading to missing project info output. [*] Modified rules of stored configuration usage, added notification. --- revision #109 : 17jul2011 --- [!] Fixed workspace makefile generation (workspace path was ignored). [!] Fixed C/C++ dependency search (files in project directory were not included) [!] Fixed wrong path processing involving empty paths. [+] Rewrote workspace makefile generation to rule-based approach. [+] Implemented translation of project dependencies into makefile. [*] Changed platform configuration, added parameter for "make" tool filename. --- revision #107 : 20jun2011 --- [+] Rewrote makefile generation to multiple toolchain architecture. [*] Updated toolchain and build tools configuration interface. [!] Fixed problem with workspace makefile generation procedure that used wrong function to generate makefiles of individual projects. --- revision #101 : 12may2011 --- [+] Added default options that can be stored in configuration file. [+] Implemented optional build target name casing. --- revision #100 : 07may2011 --- [+] Added global pre-build and post-build steps. [*] Changed makefile rules naming for build targets. --- revision #99 : 27apr2011 --- [+] Rewrote plaform-specific command generation logic to template-based. [+] Rewrote dependency search for C/C++ source/header files. [+] Switched makefile generation code to rule-based version. [*] Changed format of configuration file to more human-readable form. [*] Prepared infrastructure for multiple toolchains (to be completed soon). [+] Added nice project logo. --- revision #93 : 15apr2011 --- [!] Fixed missing headers for Windows platform. --- revision #91 : 07apr2011 --- [+] Implemented dependency search for C/C++ source/header files, makefiles with dependencies can be generated using "--with-deps" option [+] Added options to set up assembler. [!] Fixed use of wrong working directory during generation of makefiles --- revision #80 : 23mar2011 --- [!] Commands-only type targets no longer generate rules for object files --- revision #72 : 15mar2011 --- [+] Implemented multi-line object file lists (use "--wrap-objects" oprion) [+] Added revision number to generated makefile header --- revision #62 : 01mar2011 --- [*] Few minor bugfixes --- revision #57 : 21jan2011 --- [!] Fixed windows-specific code broken after rev.39 --- revision #55 : 13dec2010 --- [!] Fixed windres invocation --- revision #53 : 12dec2010 --- [+] Added support for global compiler variables [+] Implemented "flat" objects --- revision #42 : 05dec2010 --- [*] Changed configuration lookup order previously: 1) "-cfg" parameter, 2) current directory now: 1) "-cfg" parameter, 2) home directory 3) current directory "--local" parameter overrides home directory lookup "-cfg" parameter overrides "--local" parameter [+] Environment variables [+] External dependencies for targets --- revision #39 : 23nov2010 --- [!] Fixed misbehavior caused by missing configuration, now configuration file is created automatically [!] Fixed missing command for creation of output directory for object files of source files located in project root directory --- revision #38 : 21nov2010 --- [*] Slightly fixed Windows part, simple makefiles seem to work fine [*] Changed Windows platform defaults to MinGW32 --- revision #37 : 20nov2010 --- [*] Moved Before-build and After-build commands to individual targets [!] Fixed dynamic library linking [!] Fixed makefile generation for project with multiple targets [!] Fixed makefile generation for workspaces [!] Fixed issues caused by wrong file paths or extensions --- revision #35 : 19nov2010 --- [+] Improved platform and toolchain management [+] Non-inclusive compiler/linker option relations [+] Working directories for targets (see macros.h TARGET_WDIR_ENABLED) [+] Commands-only targets [+] Support for fortran compilers [+] Extended object names [*] Limited support for Windows/Mac platforms [*] Resource compilers: windres invocation --- revision #30 : 17nov2010 --- [!] Fixed toolchain management [+] Support for Code::Blocks workspace files (.workspace) [+] Project and unit dependencies are taken into account [+] Implemented "compile" and "link" flags for build units [+] Implemented Before-build and After-build commands [*] Makefile names are made by appending ".mak" extension now, not by replacing input file extension [+] Automatic "default" target for project without targets --- revision #20 : 14nov2010 --- [+] Basic Code::Blocks project files (.cbp) processing [+] Support for building executable binaries and static libraries [+] Support for multiple build targets (all real and virtual targets) [+] Two additional virtual targets: "all" and "clean" [+] Basic Makefile generation --- initial revision : 05nov2010 --- cbp2make-147+dfsg/Doxyfile0000644000175000017500000021236112143137414015365 0ustar moellermoeller# Doxyfile 1.7.3 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. # # All text after a hash (#) is considered a comment and will be ignored. # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" "). #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = cbp2make # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # Using the PROJECT_BRIEF tag one can provide an optional one line description for a project that appears at the top of each page and should give viewer a quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = "Makefile generation tool for Code::Blocks IDE" # With the PROJECT_LOGO tag one can specify an logo or icon that is # included in the documentation. The maximum height of the logo should not # exceed 55 pixels and the maximum width should not exceed 200 pixels. # Doxygen will copy the logo to the output directory. PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = dox # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = YES # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful if your file system # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. 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 # 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". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this # tag. The format is ext=language, where ext is a file extension, and language # is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, # C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make # doxygen treat .inc files as Fortran files (default is PHP), and .f files as C # (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions # you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also makes the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penalty. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will roughly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = YES # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = YES # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespaces are hidden. EXTRACT_ANON_NSPACES = YES # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen # will sort the (brief and detailed) documentation of class members so that # constructors and destructors are listed first. If set to NO (the default) # the constructors will appear in the respective orders defined by # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper type resolution of all parameters of a function it will reject a # match between the prototype and the implementation of a member function even if there is only one candidate or it is obvious which candidate to choose by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen # will still accept a match between prototype and implementation in such cases. STRICT_PROTO_MATCHING = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or macro consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and macros in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = NO # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. The create the layout file # that represents doxygen's defaults, run doxygen with the -l option. # You can optionally specify a file name after the option, if omitted # DoxygenLayout.xml will be used as the name of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The WARN_NO_PARAMDOC option can be enabled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = lib \ src # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py # *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = *.h \ *.cpp \ *.dox # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. 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 # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = lib/tinyxml # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = src/doc # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty or if # non of the patterns match the file name, INPUT_FILTER is applied. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) # and it is also possible to disable source filtering for a specific pattern # using *.ext= (so without naming a filter). This option only has effect when # FILTER_SOURCE_FILES is enabled. FILTER_SOURCE_PATTERNS = #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the stylesheet and background images # according to this color. Hue is specified as an angle on a colorwheel, # see http://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of # the colors in the HTML output. For a value of 0 the output will use # grayscales only. A value of 255 will produce the most vivid colors. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to # the luminance component of the colors in the HTML output. Values below # 100 gradually make the output lighter, whereas values above 100 make # the output darker. The value divided by 100 is the actual gamma applied, # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, # and 100 does not change the gamma. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = YES # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated # that can be used as input for Qt's qhelpgenerator to generate a # Qt Compressed Help (.qch) of the generated HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see # # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. # # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [0,1..20]) # that doxygen will group on one line in the generated HTML documentation. # Note that a value of 0 will completely suppress the enum values from appearing in the overview section. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list. USE_INLINE_TREES = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open # links to external symbols imported via tag files in a separate window. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are # not supported properly for IE 6.0, but are supported on all modern browsers. # Note that when changing this option you need to delete any form_*.png files # in the HTML output before the changes have effect. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax # (see http://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML # output. When enabled you also need to install MathJax separately and # configure the path to it using the MATHJAX_RELPATH option. USE_MATHJAX = NO # When MathJax is enabled you need to specify the location relative to the # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to the mathjax.org site, so you can quickly see the result without installing # MathJax, but it is strongly recommended to install a local copy of MathJax # before deployment. MATHJAX_RELPATH = http://www.mathjax.org/mathjax # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets # (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a PHP enabled web server instead of at the web client # using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server # based approach is that it scales better to large projects and allows # full text search. The disadvantages are that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include # source code with syntax highlighting in the LaTeX output. # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = lib \ src # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = *.h \ *.cpp \ *.dox # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition that overrules the definition found in the source code. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all references to function-like macros # that are alone on a line, have an all uppercase name, and do not end with a # semicolon, because these will confuse the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option also works with HAVE_DOT disabled, but it is recommended to # install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is # allowed to run in parallel. When set to 0 (the default) doxygen will # base this on the number of processors available in the system. You can set it # explicitly to a value larger than 0 to get control over the balance # between CPU load and processing speed. DOT_NUM_THREADS = 0 # By default doxygen will write a font called Helvetica to the output # directory and reference it in all dot files that doxygen generates. # When you want a differently looking font you can specify the font name # using DOT_FONTNAME. You need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will generate a graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, svg, gif or svg. # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the # \mscfile command). MSCFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES cbp2make-147+dfsg/cbp2make.cbp.mak.unix0000644000175000017500000005216212143777603017575 0ustar moellermoeller#------------------------------------------------------------------------------# # This makefile was generated by 'cbp2make' tool rev.138 # #------------------------------------------------------------------------------# WORKDIR = `pwd` CC = gcc CXX = g++ AR = ar LD = g++ WINDRES = windres INC = -Ilib -Ilib/tinyxml -Isrc CFLAGS = -Wall -fexceptions -fno-strict-aliasing -Wno-write-strings RESINC = LIBDIR = LIB = LDFLAGS = INC_DEBUG = $(INC) CFLAGS_DEBUG = $(CFLAGS) -g RESINC_DEBUG = $(RESINC) RCFLAGS_DEBUG = $(RCFLAGS) LIBDIR_DEBUG = $(LIBDIR) LIB_DEBUG = $(LIB) LDFLAGS_DEBUG = $(LDFLAGS) OBJDIR_DEBUG = obj/Debug DEP_DEBUG = OUT_DEBUG = bin/Debug/cbp2make INC_RELEASE = $(INC) CFLAGS_RELEASE = $(CFLAGS) -O2 RESINC_RELEASE = $(RESINC) RCFLAGS_RELEASE = $(RCFLAGS) LIBDIR_RELEASE = $(LIBDIR) LIB_RELEASE = $(LIB) LDFLAGS_RELEASE = $(LDFLAGS) -s OBJDIR_RELEASE = obj/Release DEP_RELEASE = OUT_RELEASE = bin/Release/cbp2make INC_DOXYGEN = $(INC) CFLAGS_DOXYGEN = $(CFLAGS) RESINC_DOXYGEN = $(RESINC) RCFLAGS_DOXYGEN = $(RCFLAGS) LIBDIR_DOXYGEN = $(LIBDIR) LIB_DOXYGEN = $(LIB) LDFLAGS_DOXYGEN = $(LDFLAGS) OBJDIR_DOXYGEN = .objs DEP_DOXYGEN = INC_PROFILE = $(INC) CFLAGS_PROFILE = $(CFLAGS) -pg -g RESINC_PROFILE = $(RESINC) RCFLAGS_PROFILE = $(RCFLAGS) LIBDIR_PROFILE = $(LIBDIR) LIB_PROFILE = $(LIB) LDFLAGS_PROFILE = $(LDFLAGS) -pg OBJDIR_PROFILE = obj/Profile DEP_PROFILE = OUT_PROFILE = bin/Profile/cbp2make OBJ_DEBUG = $(OBJDIR_DEBUG)/src/cbp2make.o \ $(OBJDIR_DEBUG)/src/cbproject.o \ $(OBJDIR_DEBUG)/src/cbptarget.o \ $(OBJDIR_DEBUG)/src/cbpunit.o \ $(OBJDIR_DEBUG)/src/cbworkspace.o \ $(OBJDIR_DEBUG)/src/depsearch.o \ $(OBJDIR_DEBUG)/src/cbhelper.o \ $(OBJDIR_DEBUG)/src/makefile.o \ $(OBJDIR_DEBUG)/src/platforms.o \ $(OBJDIR_DEBUG)/src/toolchains.o \ $(OBJDIR_DEBUG)/lib/stlconfig.o \ $(OBJDIR_DEBUG)/lib/stlconvert.o \ $(OBJDIR_DEBUG)/lib/stlfutils.o \ $(OBJDIR_DEBUG)/lib/stlgpm.o \ $(OBJDIR_DEBUG)/lib/stlstrings.o \ $(OBJDIR_DEBUG)/lib/stlvariables.o \ $(OBJDIR_DEBUG)/lib/stringhash.o \ $(OBJDIR_DEBUG)/lib/tinyxml/tinystr.o \ $(OBJDIR_DEBUG)/lib/tinyxml/tinyxml.o \ $(OBJDIR_DEBUG)/lib/tinyxml/tinyxmlerror.o \ $(OBJDIR_DEBUG)/lib/tinyxml/tinyxmlparser.o \ $(OBJDIR_DEBUG)/src/buildtools.o \ $(OBJDIR_DEBUG)/src/cbbuildcfg.o \ $(OBJDIR_DEBUG)/src/cbbuildmgr.o \ $(OBJDIR_DEBUG)/src/cbglobalvar.o OBJ_RELEASE = $(OBJDIR_RELEASE)/src/cbp2make.o \ $(OBJDIR_RELEASE)/src/cbproject.o \ $(OBJDIR_RELEASE)/src/cbptarget.o \ $(OBJDIR_RELEASE)/src/cbpunit.o \ $(OBJDIR_RELEASE)/src/cbworkspace.o \ $(OBJDIR_RELEASE)/src/depsearch.o \ $(OBJDIR_RELEASE)/src/cbhelper.o \ $(OBJDIR_RELEASE)/src/makefile.o \ $(OBJDIR_RELEASE)/src/platforms.o \ $(OBJDIR_RELEASE)/src/toolchains.o \ $(OBJDIR_RELEASE)/lib/stlconfig.o \ $(OBJDIR_RELEASE)/lib/stlconvert.o \ $(OBJDIR_RELEASE)/lib/stlfutils.o \ $(OBJDIR_RELEASE)/lib/stlgpm.o \ $(OBJDIR_RELEASE)/lib/stlstrings.o \ $(OBJDIR_RELEASE)/lib/stlvariables.o \ $(OBJDIR_RELEASE)/lib/stringhash.o \ $(OBJDIR_RELEASE)/lib/tinyxml/tinystr.o \ $(OBJDIR_RELEASE)/lib/tinyxml/tinyxml.o \ $(OBJDIR_RELEASE)/lib/tinyxml/tinyxmlerror.o \ $(OBJDIR_RELEASE)/lib/tinyxml/tinyxmlparser.o \ $(OBJDIR_RELEASE)/src/buildtools.o \ $(OBJDIR_RELEASE)/src/cbbuildcfg.o \ $(OBJDIR_RELEASE)/src/cbbuildmgr.o \ $(OBJDIR_RELEASE)/src/cbglobalvar.o OBJ_PROFILE = $(OBJDIR_PROFILE)/src/cbp2make.o \ $(OBJDIR_PROFILE)/src/cbproject.o \ $(OBJDIR_PROFILE)/src/cbptarget.o \ $(OBJDIR_PROFILE)/src/cbpunit.o \ $(OBJDIR_PROFILE)/src/cbworkspace.o \ $(OBJDIR_PROFILE)/src/depsearch.o \ $(OBJDIR_PROFILE)/src/cbhelper.o \ $(OBJDIR_PROFILE)/src/makefile.o \ $(OBJDIR_PROFILE)/src/platforms.o \ $(OBJDIR_PROFILE)/src/toolchains.o \ $(OBJDIR_PROFILE)/lib/stlconfig.o \ $(OBJDIR_PROFILE)/lib/stlconvert.o \ $(OBJDIR_PROFILE)/lib/stlfutils.o \ $(OBJDIR_PROFILE)/lib/stlgpm.o \ $(OBJDIR_PROFILE)/lib/stlstrings.o \ $(OBJDIR_PROFILE)/lib/stlvariables.o \ $(OBJDIR_PROFILE)/lib/stringhash.o \ $(OBJDIR_PROFILE)/lib/tinyxml/tinystr.o \ $(OBJDIR_PROFILE)/lib/tinyxml/tinyxml.o \ $(OBJDIR_PROFILE)/lib/tinyxml/tinyxmlerror.o \ $(OBJDIR_PROFILE)/lib/tinyxml/tinyxmlparser.o \ $(OBJDIR_PROFILE)/src/buildtools.o \ $(OBJDIR_PROFILE)/src/cbbuildcfg.o \ $(OBJDIR_PROFILE)/src/cbbuildmgr.o \ $(OBJDIR_PROFILE)/src/cbglobalvar.o all: debug release doxygen profile clean: clean_debug clean_release clean_profile before_debug: test -d bin/Debug || mkdir -p bin/Debug test -d $(OBJDIR_DEBUG)/src || mkdir -p $(OBJDIR_DEBUG)/src test -d $(OBJDIR_DEBUG)/lib || mkdir -p $(OBJDIR_DEBUG)/lib test -d $(OBJDIR_DEBUG)/lib/tinyxml || mkdir -p $(OBJDIR_DEBUG)/lib/tinyxml after_debug: debug: before_debug out_debug after_debug out_debug: before_debug $(OBJ_DEBUG) $(DEP_DEBUG) $(LD) $(LDFLAGS_DEBUG) $(LIBDIR_DEBUG) $(OBJ_DEBUG) $(LIB_DEBUG) -o $(OUT_DEBUG) $(OBJDIR_DEBUG)/src/cbp2make.o: src/cbp2make.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/cbp2make.cpp -o $(OBJDIR_DEBUG)/src/cbp2make.o $(OBJDIR_DEBUG)/src/cbproject.o: src/cbproject.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/cbproject.cpp -o $(OBJDIR_DEBUG)/src/cbproject.o $(OBJDIR_DEBUG)/src/cbptarget.o: src/cbptarget.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/cbptarget.cpp -o $(OBJDIR_DEBUG)/src/cbptarget.o $(OBJDIR_DEBUG)/src/cbpunit.o: src/cbpunit.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/cbpunit.cpp -o $(OBJDIR_DEBUG)/src/cbpunit.o $(OBJDIR_DEBUG)/src/cbworkspace.o: src/cbworkspace.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/cbworkspace.cpp -o $(OBJDIR_DEBUG)/src/cbworkspace.o $(OBJDIR_DEBUG)/src/depsearch.o: src/depsearch.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/depsearch.cpp -o $(OBJDIR_DEBUG)/src/depsearch.o $(OBJDIR_DEBUG)/src/cbhelper.o: src/cbhelper.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/cbhelper.cpp -o $(OBJDIR_DEBUG)/src/cbhelper.o $(OBJDIR_DEBUG)/src/makefile.o: src/makefile.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/makefile.cpp -o $(OBJDIR_DEBUG)/src/makefile.o $(OBJDIR_DEBUG)/src/platforms.o: src/platforms.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/platforms.cpp -o $(OBJDIR_DEBUG)/src/platforms.o $(OBJDIR_DEBUG)/src/toolchains.o: src/toolchains.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/toolchains.cpp -o $(OBJDIR_DEBUG)/src/toolchains.o $(OBJDIR_DEBUG)/lib/stlconfig.o: lib/stlconfig.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib/stlconfig.cpp -o $(OBJDIR_DEBUG)/lib/stlconfig.o $(OBJDIR_DEBUG)/lib/stlconvert.o: lib/stlconvert.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib/stlconvert.cpp -o $(OBJDIR_DEBUG)/lib/stlconvert.o $(OBJDIR_DEBUG)/lib/stlfutils.o: lib/stlfutils.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib/stlfutils.cpp -o $(OBJDIR_DEBUG)/lib/stlfutils.o $(OBJDIR_DEBUG)/lib/stlgpm.o: lib/stlgpm.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib/stlgpm.cpp -o $(OBJDIR_DEBUG)/lib/stlgpm.o $(OBJDIR_DEBUG)/lib/stlstrings.o: lib/stlstrings.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib/stlstrings.cpp -o $(OBJDIR_DEBUG)/lib/stlstrings.o $(OBJDIR_DEBUG)/lib/stlvariables.o: lib/stlvariables.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib/stlvariables.cpp -o $(OBJDIR_DEBUG)/lib/stlvariables.o $(OBJDIR_DEBUG)/lib/stringhash.o: lib/stringhash.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib/stringhash.cpp -o $(OBJDIR_DEBUG)/lib/stringhash.o $(OBJDIR_DEBUG)/lib/tinyxml/tinystr.o: lib/tinyxml/tinystr.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib/tinyxml/tinystr.cpp -o $(OBJDIR_DEBUG)/lib/tinyxml/tinystr.o $(OBJDIR_DEBUG)/lib/tinyxml/tinyxml.o: lib/tinyxml/tinyxml.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib/tinyxml/tinyxml.cpp -o $(OBJDIR_DEBUG)/lib/tinyxml/tinyxml.o $(OBJDIR_DEBUG)/lib/tinyxml/tinyxmlerror.o: lib/tinyxml/tinyxmlerror.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib/tinyxml/tinyxmlerror.cpp -o $(OBJDIR_DEBUG)/lib/tinyxml/tinyxmlerror.o $(OBJDIR_DEBUG)/lib/tinyxml/tinyxmlparser.o: lib/tinyxml/tinyxmlparser.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib/tinyxml/tinyxmlparser.cpp -o $(OBJDIR_DEBUG)/lib/tinyxml/tinyxmlparser.o $(OBJDIR_DEBUG)/src/buildtools.o: src/buildtools.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/buildtools.cpp -o $(OBJDIR_DEBUG)/src/buildtools.o $(OBJDIR_DEBUG)/src/cbbuildcfg.o: src/cbbuildcfg.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/cbbuildcfg.cpp -o $(OBJDIR_DEBUG)/src/cbbuildcfg.o $(OBJDIR_DEBUG)/src/cbbuildmgr.o: src/cbbuildmgr.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/cbbuildmgr.cpp -o $(OBJDIR_DEBUG)/src/cbbuildmgr.o $(OBJDIR_DEBUG)/src/cbglobalvar.o: src/cbglobalvar.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/cbglobalvar.cpp -o $(OBJDIR_DEBUG)/src/cbglobalvar.o clean_debug: rm -f $(OBJ_DEBUG) $(OUT_DEBUG) rm -rf bin/Debug rm -rf $(OBJDIR_DEBUG)/src rm -rf $(OBJDIR_DEBUG)/lib rm -rf $(OBJDIR_DEBUG)/lib/tinyxml before_release: test -d bin/Release || mkdir -p bin/Release test -d $(OBJDIR_RELEASE)/src || mkdir -p $(OBJDIR_RELEASE)/src test -d $(OBJDIR_RELEASE)/lib || mkdir -p $(OBJDIR_RELEASE)/lib test -d $(OBJDIR_RELEASE)/lib/tinyxml || mkdir -p $(OBJDIR_RELEASE)/lib/tinyxml after_release: release: before_release out_release after_release out_release: before_release $(OBJ_RELEASE) $(DEP_RELEASE) $(LD) $(LDFLAGS_RELEASE) $(LIBDIR_RELEASE) $(OBJ_RELEASE) $(LIB_RELEASE) -o $(OUT_RELEASE) $(OBJDIR_RELEASE)/src/cbp2make.o: src/cbp2make.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/cbp2make.cpp -o $(OBJDIR_RELEASE)/src/cbp2make.o $(OBJDIR_RELEASE)/src/cbproject.o: src/cbproject.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/cbproject.cpp -o $(OBJDIR_RELEASE)/src/cbproject.o $(OBJDIR_RELEASE)/src/cbptarget.o: src/cbptarget.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/cbptarget.cpp -o $(OBJDIR_RELEASE)/src/cbptarget.o $(OBJDIR_RELEASE)/src/cbpunit.o: src/cbpunit.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/cbpunit.cpp -o $(OBJDIR_RELEASE)/src/cbpunit.o $(OBJDIR_RELEASE)/src/cbworkspace.o: src/cbworkspace.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/cbworkspace.cpp -o $(OBJDIR_RELEASE)/src/cbworkspace.o $(OBJDIR_RELEASE)/src/depsearch.o: src/depsearch.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/depsearch.cpp -o $(OBJDIR_RELEASE)/src/depsearch.o $(OBJDIR_RELEASE)/src/cbhelper.o: src/cbhelper.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/cbhelper.cpp -o $(OBJDIR_RELEASE)/src/cbhelper.o $(OBJDIR_RELEASE)/src/makefile.o: src/makefile.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/makefile.cpp -o $(OBJDIR_RELEASE)/src/makefile.o $(OBJDIR_RELEASE)/src/platforms.o: src/platforms.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/platforms.cpp -o $(OBJDIR_RELEASE)/src/platforms.o $(OBJDIR_RELEASE)/src/toolchains.o: src/toolchains.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/toolchains.cpp -o $(OBJDIR_RELEASE)/src/toolchains.o $(OBJDIR_RELEASE)/lib/stlconfig.o: lib/stlconfig.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib/stlconfig.cpp -o $(OBJDIR_RELEASE)/lib/stlconfig.o $(OBJDIR_RELEASE)/lib/stlconvert.o: lib/stlconvert.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib/stlconvert.cpp -o $(OBJDIR_RELEASE)/lib/stlconvert.o $(OBJDIR_RELEASE)/lib/stlfutils.o: lib/stlfutils.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib/stlfutils.cpp -o $(OBJDIR_RELEASE)/lib/stlfutils.o $(OBJDIR_RELEASE)/lib/stlgpm.o: lib/stlgpm.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib/stlgpm.cpp -o $(OBJDIR_RELEASE)/lib/stlgpm.o $(OBJDIR_RELEASE)/lib/stlstrings.o: lib/stlstrings.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib/stlstrings.cpp -o $(OBJDIR_RELEASE)/lib/stlstrings.o $(OBJDIR_RELEASE)/lib/stlvariables.o: lib/stlvariables.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib/stlvariables.cpp -o $(OBJDIR_RELEASE)/lib/stlvariables.o $(OBJDIR_RELEASE)/lib/stringhash.o: lib/stringhash.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib/stringhash.cpp -o $(OBJDIR_RELEASE)/lib/stringhash.o $(OBJDIR_RELEASE)/lib/tinyxml/tinystr.o: lib/tinyxml/tinystr.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib/tinyxml/tinystr.cpp -o $(OBJDIR_RELEASE)/lib/tinyxml/tinystr.o $(OBJDIR_RELEASE)/lib/tinyxml/tinyxml.o: lib/tinyxml/tinyxml.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib/tinyxml/tinyxml.cpp -o $(OBJDIR_RELEASE)/lib/tinyxml/tinyxml.o $(OBJDIR_RELEASE)/lib/tinyxml/tinyxmlerror.o: lib/tinyxml/tinyxmlerror.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib/tinyxml/tinyxmlerror.cpp -o $(OBJDIR_RELEASE)/lib/tinyxml/tinyxmlerror.o $(OBJDIR_RELEASE)/lib/tinyxml/tinyxmlparser.o: lib/tinyxml/tinyxmlparser.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib/tinyxml/tinyxmlparser.cpp -o $(OBJDIR_RELEASE)/lib/tinyxml/tinyxmlparser.o $(OBJDIR_RELEASE)/src/buildtools.o: src/buildtools.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/buildtools.cpp -o $(OBJDIR_RELEASE)/src/buildtools.o $(OBJDIR_RELEASE)/src/cbbuildcfg.o: src/cbbuildcfg.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/cbbuildcfg.cpp -o $(OBJDIR_RELEASE)/src/cbbuildcfg.o $(OBJDIR_RELEASE)/src/cbbuildmgr.o: src/cbbuildmgr.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/cbbuildmgr.cpp -o $(OBJDIR_RELEASE)/src/cbbuildmgr.o $(OBJDIR_RELEASE)/src/cbglobalvar.o: src/cbglobalvar.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/cbglobalvar.cpp -o $(OBJDIR_RELEASE)/src/cbglobalvar.o clean_release: rm -f $(OBJ_RELEASE) $(OUT_RELEASE) rm -rf bin/Release rm -rf $(OBJDIR_RELEASE)/src rm -rf $(OBJDIR_RELEASE)/lib rm -rf $(OBJDIR_RELEASE)/lib/tinyxml before_doxygen: doxygen Doxyfile after_doxygen: doxygen: before_doxygen after_doxygen before_profile: test -d bin/Profile || mkdir -p bin/Profile test -d $(OBJDIR_PROFILE)/src || mkdir -p $(OBJDIR_PROFILE)/src test -d $(OBJDIR_PROFILE)/lib || mkdir -p $(OBJDIR_PROFILE)/lib test -d $(OBJDIR_PROFILE)/lib/tinyxml || mkdir -p $(OBJDIR_PROFILE)/lib/tinyxml after_profile: profile: before_profile out_profile after_profile out_profile: before_profile $(OBJ_PROFILE) $(DEP_PROFILE) $(LD) $(LDFLAGS_PROFILE) $(LIBDIR_PROFILE) $(OBJ_PROFILE) $(LIB_PROFILE) -o $(OUT_PROFILE) $(OBJDIR_PROFILE)/src/cbp2make.o: src/cbp2make.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src/cbp2make.cpp -o $(OBJDIR_PROFILE)/src/cbp2make.o $(OBJDIR_PROFILE)/src/cbproject.o: src/cbproject.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src/cbproject.cpp -o $(OBJDIR_PROFILE)/src/cbproject.o $(OBJDIR_PROFILE)/src/cbptarget.o: src/cbptarget.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src/cbptarget.cpp -o $(OBJDIR_PROFILE)/src/cbptarget.o $(OBJDIR_PROFILE)/src/cbpunit.o: src/cbpunit.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src/cbpunit.cpp -o $(OBJDIR_PROFILE)/src/cbpunit.o $(OBJDIR_PROFILE)/src/cbworkspace.o: src/cbworkspace.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src/cbworkspace.cpp -o $(OBJDIR_PROFILE)/src/cbworkspace.o $(OBJDIR_PROFILE)/src/depsearch.o: src/depsearch.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src/depsearch.cpp -o $(OBJDIR_PROFILE)/src/depsearch.o $(OBJDIR_PROFILE)/src/cbhelper.o: src/cbhelper.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src/cbhelper.cpp -o $(OBJDIR_PROFILE)/src/cbhelper.o $(OBJDIR_PROFILE)/src/makefile.o: src/makefile.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src/makefile.cpp -o $(OBJDIR_PROFILE)/src/makefile.o $(OBJDIR_PROFILE)/src/platforms.o: src/platforms.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src/platforms.cpp -o $(OBJDIR_PROFILE)/src/platforms.o $(OBJDIR_PROFILE)/src/toolchains.o: src/toolchains.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src/toolchains.cpp -o $(OBJDIR_PROFILE)/src/toolchains.o $(OBJDIR_PROFILE)/lib/stlconfig.o: lib/stlconfig.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib/stlconfig.cpp -o $(OBJDIR_PROFILE)/lib/stlconfig.o $(OBJDIR_PROFILE)/lib/stlconvert.o: lib/stlconvert.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib/stlconvert.cpp -o $(OBJDIR_PROFILE)/lib/stlconvert.o $(OBJDIR_PROFILE)/lib/stlfutils.o: lib/stlfutils.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib/stlfutils.cpp -o $(OBJDIR_PROFILE)/lib/stlfutils.o $(OBJDIR_PROFILE)/lib/stlgpm.o: lib/stlgpm.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib/stlgpm.cpp -o $(OBJDIR_PROFILE)/lib/stlgpm.o $(OBJDIR_PROFILE)/lib/stlstrings.o: lib/stlstrings.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib/stlstrings.cpp -o $(OBJDIR_PROFILE)/lib/stlstrings.o $(OBJDIR_PROFILE)/lib/stlvariables.o: lib/stlvariables.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib/stlvariables.cpp -o $(OBJDIR_PROFILE)/lib/stlvariables.o $(OBJDIR_PROFILE)/lib/stringhash.o: lib/stringhash.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib/stringhash.cpp -o $(OBJDIR_PROFILE)/lib/stringhash.o $(OBJDIR_PROFILE)/lib/tinyxml/tinystr.o: lib/tinyxml/tinystr.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib/tinyxml/tinystr.cpp -o $(OBJDIR_PROFILE)/lib/tinyxml/tinystr.o $(OBJDIR_PROFILE)/lib/tinyxml/tinyxml.o: lib/tinyxml/tinyxml.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib/tinyxml/tinyxml.cpp -o $(OBJDIR_PROFILE)/lib/tinyxml/tinyxml.o $(OBJDIR_PROFILE)/lib/tinyxml/tinyxmlerror.o: lib/tinyxml/tinyxmlerror.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib/tinyxml/tinyxmlerror.cpp -o $(OBJDIR_PROFILE)/lib/tinyxml/tinyxmlerror.o $(OBJDIR_PROFILE)/lib/tinyxml/tinyxmlparser.o: lib/tinyxml/tinyxmlparser.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib/tinyxml/tinyxmlparser.cpp -o $(OBJDIR_PROFILE)/lib/tinyxml/tinyxmlparser.o $(OBJDIR_PROFILE)/src/buildtools.o: src/buildtools.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src/buildtools.cpp -o $(OBJDIR_PROFILE)/src/buildtools.o $(OBJDIR_PROFILE)/src/cbbuildcfg.o: src/cbbuildcfg.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src/cbbuildcfg.cpp -o $(OBJDIR_PROFILE)/src/cbbuildcfg.o $(OBJDIR_PROFILE)/src/cbbuildmgr.o: src/cbbuildmgr.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src/cbbuildmgr.cpp -o $(OBJDIR_PROFILE)/src/cbbuildmgr.o $(OBJDIR_PROFILE)/src/cbglobalvar.o: src/cbglobalvar.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src/cbglobalvar.cpp -o $(OBJDIR_PROFILE)/src/cbglobalvar.o clean_profile: rm -f $(OBJ_PROFILE) $(OUT_PROFILE) rm -rf bin/Profile rm -rf $(OBJDIR_PROFILE)/src rm -rf $(OBJDIR_PROFILE)/lib rm -rf $(OBJDIR_PROFILE)/lib/tinyxml virtual_all: debug release src/cbp2make.cpp: lib/macros.h \ src/revision.h \ lib/stlfutils.h \ lib/stlgpm.h \ src/cbbuildmgr.h \ src/cbhelper.h lib/stlfutils.h: lib/macros.h \ lib/stlstrings.h lib/stlgpm.h: lib/stlconfig.h lib/stlconfig.h: lib/stlvariables.h lib/stlvariables.h: lib/stlconvert.h lib/stlconvert.h: lib/stlstrings.h src/cbbuildmgr.h: lib/stlstrings.h \ src/cbproject.h \ src/cbworkspace.h \ src/cbbuildcfg.h src/cbproject.h: lib/stlstrings.h \ lib/stlconfig.h \ src/depsearch.h \ src/makefile.h src/depsearch.h: lib/stlstrings.h \ lib/stringhash.h \ src/platforms.h \ src/makefile.h src/platforms.h: lib/stlstrings.h \ src/cbhelper.h src/cbhelper.h: lib/stlstrings.h src/makefile.h: lib/stlstrings.h \ lib/stlconfig.h src/cbworkspace.h: lib/stlstrings.h \ src/cbproject.h src/cbbuildcfg.h: lib/stlstrings.h \ src/platforms.h \ src/toolchains.h \ src/cbglobalvar.h \ src/cbhelper.h src/toolchains.h: lib/stlstrings.h \ src/platforms.h \ src/buildtools.h src/buildtools.h: lib/stlconfig.h \ lib/stlstrings.h \ src/platforms.h \ src/depsearch.h src/cbglobalvar.h: lib/stlstrings.h \ lib/stlconfig.h src/cbproject.cpp: src/revision.h \ lib/macros.h \ src/cbproject.h \ src/cbptarget.h \ src/cbpunit.h \ src/cbbuildcfg.h \ src/cbhelper.h \ lib/stlconvert.h \ lib/stlfutils.h \ src/depsearch.h \ lib/tinyxml/tinyxml.h src/cbptarget.h: lib/stlstrings.h \ src/platforms.h src/cbpunit.h: lib/stlstrings.h \ src/cbptarget.h lib/tinyxml/tinyxml.h: lib/tinyxml/tinystr.h src/cbptarget.cpp: src/cbptarget.h \ src/cbhelper.h \ lib/stlconvert.h \ lib/stlfutils.h \ lib/tinyxml/tinyxml.h src/cbpunit.cpp: lib/macros.h \ src/cbpunit.h \ src/cbhelper.h \ lib/stlconvert.h \ lib/stlfutils.h \ lib/tinyxml/tinyxml.h src/cbworkspace.cpp: src/revision.h \ lib/macros.h \ src/cbworkspace.h \ src/cbbuildcfg.h \ src/cbhelper.h \ lib/stlfutils.h \ lib/tinyxml/tinyxml.h src/depsearch.cpp: src/cbhelper.h \ lib/stlfutils.h \ src/depsearch.h src/cbhelper.cpp: src/cbhelper.h src/makefile.cpp: lib/tinyxml/tinyxml.h \ lib/stlconvert.h \ src/cbhelper.h \ src/makefile.h src/platforms.cpp: src/platforms.h \ lib/stlconvert.h \ lib/stlfutils.h \ lib/tinyxml/tinyxml.h src/toolchains.cpp: src/toolchains.h \ lib/stlconvert.h \ lib/tinyxml/tinyxml.h lib/stlconfig.cpp: lib/stlstrings.h \ lib/stlconfig.h lib/stlconvert.cpp: lib/stlconvert.h lib/stlfutils.cpp: lib/stlfutils.h lib/stlgpm.cpp: lib/stlgpm.h \ lib/stlfutils.h lib/stlstrings.cpp: lib/stlstrings.h \ lib/stlconvert.h lib/stlvariables.cpp: lib/stlvariables.h lib/stringhash.cpp: lib/stringhash.h lib/tinyxml/tinystr.cpp: lib/tinyxml/tinystr.h lib/tinyxml/tinyxml.cpp: lib/tinyxml/tinyxml.h lib/tinyxml/tinyxmlerror.cpp: lib/tinyxml/tinyxml.h lib/tinyxml/tinyxmlparser.cpp: lib/tinyxml/tinyxml.h src/buildtools.cpp: src/buildtools.h \ lib/stlconvert.h \ src/cbhelper.h \ lib/tinyxml/tinyxml.h src/cbbuildcfg.cpp: src/cbbuildcfg.h \ lib/stlconvert.h \ lib/tinyxml/tinyxml.h src/cbbuildmgr.cpp: lib/stlfutils.h \ src/cbbuildmgr.h \ lib/tinyxml/tinyxml.h src/cbglobalvar.cpp: lib/tinyxml/tinyxml.h \ lib/stlfutils.h \ src/cbglobalvar.h \ src/cbhelper.h .PHONY: before_debug after_debug clean_debug before_release after_release clean_release before_doxygen after_doxygen before_profile after_profile clean_profile cbp2make-147+dfsg/cbp2make.cfg0000644000175000017500000007321512143777603016041 0ustar moellermoeller cbp2make-147+dfsg/lib/0000755000175000017500000000000012305647033014423 5ustar moellermoellercbp2make-147+dfsg/lib/stringhash.h0000644000175000017500000000167112143137414016750 0ustar moellermoeller/* Collection of non-cryptographic string hashing functions. All code is Public Domain. */ #ifndef STRINGHASH_H #define STRINGHASH_H #include #include typedef uint8_t data_t; typedef uint32_t hash_t; hash_t add_hash(const data_t *data, const size_t size); hash_t xor_hash(const data_t *data, const size_t size); hash_t rot_hash(const data_t *data, const size_t size); hash_t djb_hash(const data_t *data, const size_t size); hash_t djb2_hash(const data_t *data, const size_t size); hash_t sax_hash(const data_t *data, const size_t size); hash_t fnv_hash(const data_t *data, const size_t size); hash_t oat_hash(const data_t *data, const size_t size); hash_t jsw_hash(const data_t *data, const size_t size, const hash_t *magic); hash_t elf_hash(const data_t *data, const size_t size); hash_t jen_hash(const data_t *data, const size_t size, const hash_t magic); hash_t sdbm_hash(const data_t *data, const size_t size); #endif cbp2make-147+dfsg/lib/stlconfig.cpp0000644000175000017500000002171612155022125017116 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #include //------------------------------------------------------------------------------ #include "stlstrings.h" #include "stlconfig.h" //------------------------------------------------------------------------------ CConfiguration::CConfiguration(void) { Clear(); } CConfiguration::~CConfiguration(void) { Clear(); } void CConfiguration::Clear(void) { for (size_t i = 0; i < m_Variables.size(); i++) delete m_Variables[i]; m_Variables.clear(); m_NullVariable.SetName("NULL"); m_DefinedPrefix = "~"; } int CConfiguration::GetCount(void) const { return m_Variables.size(); } bool CConfiguration::ValidIndex(const int Index) const { return ((Index>=0)&&(IndexGetName()==Name) return i; } return INVALID_INDEX; } int CConfiguration::InsertIntegerVariable(const CString& Name, const int Value) { m_Variables.push_back(new CIntegerVariable(Name,Value)); return GetCount()-1; } int CConfiguration::InsertFloatVariable(const CString& Name, const double Value) { m_Variables.push_back(new CFloatVariable(Name,Value)); return GetCount()-1; } int CConfiguration::InsertBooleanVariable(const CString& Name, const bool Value) { m_Variables.push_back(new CBooleanVariable(Name,Value)); return GetCount()-1; } int CConfiguration::InsertStringVariable(const CString& Name, const CString& Value) { m_Variables.push_back(new CStringVariable(Name,Value)); return GetCount()-1; } int CConfiguration::InsertCharVariable(const CString& Name, const char Value) { m_Variables.push_back(new CCharVariable(Name,Value)); return GetCount()-1; } void CConfiguration::RemoveVariable(const int Index) { if (ValidIndex(Index)) { CVariable *variable = m_Variables[Index]; m_Variables.erase(m_Variables.begin()+Index); delete variable; } } void CConfiguration::RemoveVariable(const CString& Name) { RemoveVariable(VarIndex(Name)); } void CConfiguration::SetIntegerVariable(const CString& Name, const int Value) { int index = VarIndex(Name); if (ValidIndex(index)) { CVariable *variable = m_Variables[index]; variable->SetInteger(Value); } else { InsertIntegerVariable(Name,Value); } } void CConfiguration::SetFloatVariable(const CString& Name, const double Value) { int index = VarIndex(Name); if (ValidIndex(index)) { CVariable *variable = m_Variables[index]; variable->SetFloat(Value); } else { InsertFloatVariable(Name,Value); } } void CConfiguration::SetBooleanVariable(const CString& Name, const bool Value) { int index = VarIndex(Name); if (ValidIndex(index)) { CVariable *variable = m_Variables[index]; variable->SetBoolean(Value); } else { InsertBooleanVariable(Name,Value); } } void CConfiguration::SetStringVariable(const CString& Name, const CString& Value) { int index = VarIndex(Name); if (ValidIndex(index)) { CVariable *variable = m_Variables[index]; variable->SetString(Value); } else { InsertStringVariable(Name,Value); } } void CConfiguration::SetCharVariable(const CString& Name, const char Value) { int index = VarIndex(Name); if (ValidIndex(index)) { CVariable *variable = m_Variables[index]; variable->SetChar(Value); } else { InsertCharVariable(Name,Value); } } void CConfiguration::Print(std::ostream& out) { for (size_t i = 0; i < m_Variables.size(); i++) { CVariable *variable = m_Variables[i]; out<GetTypeName().GetCString()<<" "<GetName().GetCString()<<"="; if (VARIABLE_TYPE_STRING == variable->GetType()) { out<<"\""<GetString().GetCString()<<"\";"<GetType()) { out<<"'"<GetString().GetCString()<<"';"<GetString().GetCString()<<";"<GetName()+"="; if ((variable->GetType()==VARIABLE_TYPE_STRING)|| (variable->GetType()==VARIABLE_TYPE_CHAR)) { string+="\""+variable->GetString()+"\""; } else { string+=variable->GetString(); } string.Append(';').AppendEOL(); fwrite(string.GetCString(),string.GetLength(),1,stream); } fclose(stream); } CParameterString::CParameterString(int argc, char* argv[]) { SetParameters(argc,argv); } CParameterString::CParameterString(const CString& Parameters) { SetParameters(Parameters); } CParameterString::CParameterString(void) { m_NullParameter.Clear(); m_Parameters.Clear(); } CParameterString::~CParameterString(void) { } void CParameterString::SetParameters(int argc, char* argv[]) { m_Parameters.Clear(); for (int i = 0; i < argc; i++) m_Parameters.Insert(CString(argv[i])); } void CParameterString::SetParameters(const CString& Parameters) { m_Parameters.Clear(); ParseStr(Parameters,' ',m_Parameters); } void CParameterString::SetParameters(const CParameterString& Parameters) { m_Parameters = Parameters.m_Parameters; } void CParameterString::AddParameters(const CString& Parameters) { CStringList l_Parameters; ParseStr(Parameters,' ',l_Parameters); m_Parameters.Insert(l_Parameters); } void CParameterString::AddParameters(const CParameterString& Parameters) { m_Parameters.Insert(Parameters.m_Parameters); } CString CParameterString::Parameter(const int Index) const { return m_Parameters[Index]; } bool CParameterStringConfiguration::VarDefined(const CString& Name) { int index = VarIndex(DefinedPrefix()+Name); return (INVALID_INDEX!=index); } void CParameterStringConfiguration::SetDefined(const CString& Name) { int index = VarIndex(DefinedPrefix()+Name); if (INVALID_INDEX==index) InsertBooleanVariable(DefinedPrefix()+Name,true); } void CParameterStringConfiguration::SetUndefined(const CString& Name) { RemoveVariable(DefinedPrefix()+Name); } void CParameterStringConfiguration::ProcessParameters(const CParameterString& Parameters) { int j = 1; // parameterIndex while (j < Parameters.GetCount()) { CString parameter = Parameters.Parameter(j); for (size_t i = 0; i < m_Variables.size(); i++) { CVariable& variable = Variable(i); if (variable.GetName()==parameter) { if (variable.GetType()==VARIABLE_TYPE_BOOLEAN) variable.SetBoolean(true); else { variable.SetString(Parameters.Parameter(++j)); } m_Variables.push_back(new CBooleanVariable(m_DefinedPrefix+variable.GetName(),true)); break; }} j++; } } void CParameterStringConfiguration::ProcessParameters(const CString& Parameters) { CParameterString parameterString(Parameters); ProcessParameters(parameterString); } //------------------------------------------------------------------------------ cbp2make-147+dfsg/lib/stringhash.cpp0000644000175000017500000000651712143153260017304 0ustar moellermoeller/* Collection of non-cryptographic string hashing functions. All code is Public Domain. */ #include "stringhash.h" hash_t add_hash(const data_t *data, const size_t size) { hash_t h = 0; for (size_t i = 0; i < size; i++) { h += data[i]; } return h; } hash_t xor_hash(const data_t *data, const size_t size) { hash_t h = 0; for (size_t i = 0; i < size; i++) { h ^= data[i]; } return h; } hash_t rot_hash(const data_t *data, const size_t size) { hash_t h = 0; for (size_t i = 0; i < size; i++) { h = (h<<4) ^ (h>>28) ^ data[i]; } return h; } // Bernstein's hash hash_t djb_hash(const data_t *data, const size_t size) { hash_t h = 0; for (size_t i = 0; i < size; i++) { h = 33*h + data[i]; } return h; } // modified Bernstein's hash hash_t djb2_hash(const data_t *data, const size_t size) { hash_t h = 0; for (size_t i = 0; i < size; i++) { h = 33*h ^ data[i]; } return h; } hash_t sax_hash(const data_t *data, const size_t size) { hash_t h = 0; for (size_t i = 0; i < size; i++) { h ^= (h<<5) + (h>>2) + data[i]; } return h; } // Fowler / Noll / Vo (FNV) Hash hash_t fnv_hash(const data_t *data, const size_t size) { hash_t h = 2166136261UL; for (size_t i = 0; i < size; i++ ) { h = (h*16777619) ^ data[i]; } return h; } // One-at-a-Time Hash hash_t oat_hash(const data_t *data, const size_t size) { hash_t h = 0; for (size_t i = 0; i < size; i++) { h += data[i]; h += (h<<10); h ^= (h>>6); } h += (h<<3); h ^= (h>>11); h += (h<<15); return h; } hash_t jsw_hash(const data_t *data, const size_t size, const hash_t *magic) { hash_t h = 16777551; for (size_t i = 0; i < size; i++) { h = ( h << 1 | h >> 31 ) ^ magic[data[i]]; } return h; } hash_t elf_hash(const data_t *data, const size_t size) { hash_t h = 0, g; for (size_t i = 0; i < size; i++) { h = (h<<4) + data[i]; g = h & 0xf0000000L; if (0!=g) { h ^= (g>>24); } h &= ~g; } return h; } void jen_mix(hash_t& a, hash_t& b, hash_t& c) { a -= b; a -= c; a ^= (c>>13); b -= c; b -= a; b ^= (a<<8); c -= a; c -= b; c ^= (b>>13); a -= b; a -= c; a ^= (c>>12); b -= c; b -= a; b ^= (a<<16); c -= a; c -= b; c ^= (b>>5); a -= b; a -= c; a ^= (c>>3); b -= c; b -= a; b ^= (a<<10); c -= a; c -= b; c ^= (b>>15); } hash_t jen_hash(const data_t *data, const size_t size, const hash_t magic) { const hash_t d = 0x9e3779b9; hash_t a = d, b = d; hash_t c = magic; size_t l = size; data_t *k = (data_t *)data; while (l>=12) { a += (data[0] + ((hash_t)k[1]<<8) + ((hash_t)k[2]<<16) + ((hash_t)k[3]<<24)); b += (data[4] + ((hash_t)k[5]<<8) + ((hash_t)k[6]<<16) + ((hash_t)k[7]<<24)); c += (k[8] + ((hash_t)k[9]<<8) + ((hash_t)k[10]<<16) + ((hash_t)k[11]<<24)); jen_mix(a,b,c); k += 12; l -= 12; } c += size; switch (l) { case 11: c += ((hash_t)k[10]<<24); case 10: c += ((hash_t)k[9]<<16); case 9 : c += ((hash_t)k[8]<<8); // first byte of c reserved for length case 8 : b += ((hash_t)k[7]<<24); case 7 : b += ((hash_t)k[6]<<16); case 6 : b += ((hash_t)k[5]<<8); case 5 : b += k[4]; case 4 : a += ((hash_t)k[3]<<24); case 3 : a += ((hash_t)k[2]<<16); case 2 : a += ((hash_t)k[1]<<8); case 1 : a += k[0]; } jen_mix(a,b,c); return c; } hash_t sdbm_hash(const data_t *data, const size_t size) { hash_t h = 0; //data_t c; for (size_t i = 0; i < size; i++) { h -= (h<<6) + (h<<16) +data[i]; } return h; } cbp2make-147+dfsg/lib/stlgpm.h0000644000175000017500000000705212155022125016076 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #ifndef STL_GPM_H #define STL_GPM_H //------------------------------------------------------------------------------ #include "stlconfig.h" //------------------------------------------------------------------------------ class CGenericProcessingMachine { protected: CConfiguration m_FileConfiguration; CParameterStringConfiguration m_ParameterStringConfiguration; CParameterString m_ParameterString; CStringList m_InputFileList; CStringList m_OutputFileList; int m_FileIndex; bool m_AliasesEnabled; int m_FileNameLength; bool m_VerboseMode; bool m_QuietMode; bool m_HelpMode; protected: virtual void Initialize(void); public: virtual void Initialize(int argc, char * argv[]); virtual void Initialize(const CParameterString& Parameters); virtual void DisplayHelpMessage(void); virtual void CreateConfiguration(void); CString DefaultConfigurationName(void); virtual CString ConfigurationName(void); virtual bool Configure(const CString& FileName); int GetFileNameLength(void) const { return m_FileNameLength; } int SetFileNameLength(const int FileNameLength); int FileIndex(void) const { return m_FileIndex; } virtual CString TargetName(const int FileIndex, const CString& SourceFileName); virtual bool ProcessFile(const CString& SourceFileName, CString& TargetFileName); virtual bool PreProcess(void); virtual bool Run(void); virtual bool PostProcess(void); virtual void Finalize(void); virtual void Print(std::ostream& out) { }; public: bool& AliasesEnabled(void) { return m_AliasesEnabled; } bool& BeVerbose(void) { return m_VerboseMode; } bool& BeQuiet(void) { return m_QuietMode; } bool& DoShowHelp(void) { return m_HelpMode; } CConfiguration& CFG(void) { return m_FileConfiguration; } CParameterStringConfiguration& PSC(void) { return m_ParameterStringConfiguration; } CParameterString& PS(void) { return m_ParameterString; } CStringList& ILST(void) { return m_InputFileList; }; CStringList& OLST(void) { return m_OutputFileList; }; public: CGenericProcessingMachine(void); virtual ~CGenericProcessingMachine(void); }; const CString GPM_VAR_NAME_IN = "-in"; const CString GPM_VAR_NAME_OUT = "-out"; const CString GPM_VAR_NAME_LIST = "-list"; const CString GPM_VAR_NAME_CFG = "-cfg"; const CString GPM_VAR_NAME_INDIR = "-indir"; const CString GPM_VAR_NAME_OUTDIR = "-outdir"; const CString GPM_VAR_NAME_HELP = "--help"; const CString GPM_VAR_NAME_VERBOSE = "--verbose"; const CString GPM_VAR_NAME_QUIET = "--quiet"; const CString GPM_VAR_NAME_HELP_ALIAS = "-h"; const CString GPM_VAR_NAME_VERBOSE_ALIAS = "-v"; const CString GPM_VAR_NAME_QUIET_ALIAS = "-q"; #endif //------------------------------------------------------------------------------ cbp2make-147+dfsg/lib/stlconvert.h0000644000175000017500000001073412155022125016774 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #ifndef STL_CONVERT_H #define STL_CONVERT_H //------------------------------------------------------------------------------ #include #include //------------------------------------------------------------------------------ #include "stlstrings.h" //------------------------------------------------------------------------------ inline double IntToFloat(const int Value) { return (double)Value; } inline bool IntToBool(const int Value) { return (0!=Value); } inline std::string IntToStr(const int Value) { std::string result; std::stringstream tmp; tmp<>result; return result; } inline char IntToChar(const int Value) { return (Value & 0xff); } inline int FloatToInt(const double Value) { return (int)Value; } inline bool FloatToBool(const double Value) { return (0.0!=Value); } inline std::string FloatToStr(const double Value) { std::string result; std::stringstream tmp; tmp<>result; return result; } inline char FloatToChar(const double Value) { return IntToChar(FloatToInt(Value)); } inline double BoolToFloat(const bool Value) { return (double)Value; } inline int BoolToInt(const bool Value) { return (int)Value; } inline std::string BoolToStr(const bool Value) { if (Value) return "true"; else return "false"; } inline char BoolToChar(const bool Value) { if (Value) return '1'; else return '0'; } inline double StrToFloat(const std::string& Value) { double result; std::stringstream tmp; tmp<>result; return result; } inline int StrToInt(const std::string& Value) { int result; std::stringstream tmp; tmp<>result; return result; } inline bool StrToBool(const std::string& Value) { return (UpperCase(Value).GetString().compare("TRUE")==0); } inline char StrToChar(const std::string& Value) { char result = 0; if (Value.size()) result = Value[0]; return result; } inline double CharToFloat(const char Value) { return (double)Value; } inline int CharToInt(const char Value) { return (int)Value; } inline bool CharToBool(const char Value) { return ('0'!=Value); } inline std::string CharToStr(const char Value) { std::string result; result.resize(1); result[0] = Value; return result; } //------------------------------------------------------------------------------ inline CString IntegerToString(const int Value) { CString result; result = (int)Value; return result; } inline CString Int64ToString(const long long int Value) { CString result; result = (long long int)Value; return result; } inline CString FloatToString(const double Value) { CString result; result = Value; return result; } inline CString FloatToString(const double Value, const CString& Format) { CString result; result.SetLength(MAX_SHORTSTRING_LENGTH); sprintf(result.GetCString(),Format.GetCString(),Value); result.SetLength(); return result; } inline CString BooleanToString(const bool Value) { if (Value) return CString("true"); else return CString("false"); } inline CString BooleanToYesNoString(const bool Value) { if (Value) return CString("yes"); else return CString("no"); } inline double StringToFloat(const CString& Value) { return Value.GetFloat(); } inline int StringToInteger(const CString& Value) { return Value.GetInteger(); } inline bool StringToBoolean(const CString& Value) { return ((CString(Value)=="1")||(UpperCase(Value)=="TRUE")||(UpperCase(Value)=="YES")); } inline char StringToChar(const CString& Value) { return Value.GetChar(0); } inline CString CharToString(const char Value) { CString result; result.Assign((int)Value); return result; } #endif //------------------------------------------------------------------------------ cbp2make-147+dfsg/lib/stlvariables.h0000644000175000017500000001574312155022125017271 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #ifndef STL_VARIABLES_H #define STL_VARIABLES_H //------------------------------------------------------------------------------ #include "stlconvert.h" //------------------------------------------------------------------------------ const int VARIABLE_TYPE_NONE = 0; const int VARIABLE_TYPE_INTEGER = 1; const int VARIABLE_TYPE_FLOAT = 2; const int VARIABLE_TYPE_BOOLEAN = 1; const int VARIABLE_TYPE_STRING = 4; const int VARIABLE_TYPE_CHAR = 5; const int VARIABLE_TYPE_COUNT = 6; class CVariable { protected: CString m_Name; public: virtual int GetType(void) const; virtual CString GetTypeName(void) const; CString& GetName(void); void SetName(const CString& Name); virtual double GetFloat(void) const; virtual void SetFloat(const double Value); virtual int GetInteger(void) const; virtual void SetInteger(const int Value); virtual bool GetBoolean(void) const; virtual void SetBoolean(const bool Value); virtual CString GetString(void) const; virtual void SetString(const CString& Value); virtual char GetChar(void) const; virtual void SetChar(const char Value); void Print(std::ostream& out); public: CVariable(void); CVariable(const CString& Name); virtual ~CVariable(void); }; class CIntegerVariable: public CVariable { protected: int m_Value; public: virtual int GetType(void) const; virtual CString GetTypeName(void) const; virtual double GetFloat(void) const; virtual void SetFloat(const double Value); virtual int GetInteger(void) const; virtual void SetInteger(const int Value); virtual bool GetBoolean(void) const; virtual void SetBoolean(const bool Value); virtual CString GetString(void) const; virtual void SetString(const CString& Value); virtual char GetChar(void) const; virtual void SetChar(const char Value); int operator=(const CIntegerVariable& Variable); CIntegerVariable& operator =(const double Value); CIntegerVariable& operator =(const int Value); CIntegerVariable& operator =(const bool Value); CIntegerVariable& operator =(const CString& Value); CIntegerVariable& operator =(const char Value); public: CIntegerVariable(const CString& Name,const int Value=0); virtual ~CIntegerVariable(void) {}; }; class CFloatVariable: public CVariable { protected: double m_Value; public: virtual int GetType(void) const; virtual CString GetTypeName(void) const; virtual double GetFloat(void) const; virtual void SetFloat(const double Value); virtual int GetInteger(void) const; virtual void SetInteger(const int Value); virtual bool GetBoolean(void) const; virtual void SetBoolean(const bool Value); virtual CString GetString(void) const; virtual void SetString(const CString& Value); virtual char GetChar(void) const; virtual void SetChar(const char Value); double operator=(const CFloatVariable& Variable); CFloatVariable& operator =(const double Value); CFloatVariable& operator =(const int Value); CFloatVariable& operator =(const bool Value); CFloatVariable& operator =(const CString& Value); CFloatVariable& operator =(const char Value); public: CFloatVariable(const CString& Name,const double Value=0.0); virtual ~CFloatVariable(void) {}; }; class CBooleanVariable: public CVariable { protected: bool m_Value; public: virtual int GetType(void) const; virtual CString GetTypeName(void) const; virtual double GetFloat(void) const; virtual void SetFloat(const double Value); virtual int GetInteger(void) const; virtual void SetInteger(const int Value); virtual bool GetBoolean(void) const; virtual void SetBoolean(const bool Value); virtual CString GetString(void) const; virtual void SetString(const CString& Value); virtual char GetChar(void) const; virtual void SetChar(const char Value); bool operator=(const CBooleanVariable& Variable); CBooleanVariable& operator =(const double Value); CBooleanVariable& operator =(const int Value); CBooleanVariable& operator =(const bool Value); CBooleanVariable& operator =(const CString& Value); CBooleanVariable& operator =(const char Value); public: CBooleanVariable(const CString& Name,const bool Value=false); virtual ~CBooleanVariable(void) {}; }; class CStringVariable: public CVariable { protected: CString m_Value; public: virtual int GetType(void) const; virtual CString GetTypeName(void) const; virtual double GetFloat(void) const; virtual void SetFloat(const double Value); virtual int GetInteger(void) const; virtual void SetInteger(const int Value); virtual bool GetBoolean(void) const; virtual void SetBoolean(const bool Value); virtual CString GetString(void) const; virtual void SetString(const CString& Value); virtual char GetChar(void) const; virtual void SetChar(const char Value); CString operator=(const CStringVariable& Variable); CStringVariable& operator =(const double Value); CStringVariable& operator =(const int Value); CStringVariable& operator =(const bool Value); CStringVariable& operator =(const CString& Value); CStringVariable& operator =(const char Value); public: CStringVariable(const CString& Name,const CString Value=""); virtual ~CStringVariable(void) {}; }; class CCharVariable: public CVariable { protected: char m_Value; public: virtual int GetType(void) const; virtual CString GetTypeName(void) const; virtual double GetFloat(void) const; virtual void SetFloat(const double Value); virtual int GetInteger(void) const; virtual void SetInteger(const int Value); virtual bool GetBoolean(void) const; virtual void SetBoolean(const bool Value); virtual CString GetString(void) const; virtual void SetString(const CString& Value); virtual char GetChar(void) const; virtual void SetChar(const char Value); char operator=(const CCharVariable& Variable); CCharVariable& operator =(const double Value); CCharVariable& operator =(const int Value); CCharVariable& operator =(const bool Value); CCharVariable& operator =(const CString& Value); CCharVariable& operator =(const char Value); public: CCharVariable(const CString& Name,const char Value=char(0)); virtual ~CCharVariable(void) {}; }; #endif //------------------------------------------------------------------------------ cbp2make-147+dfsg/lib/stlstrings.h0000644000175000017500000004375212155022125017013 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #ifndef STL_STRINGS_H #define STL_STRINGS_H //------------------------------------------------------------------------------ #include #include #include #include //------------------------------------------------------------------------------ #define MAX_SHORTSTRING_LENGTH 256 #define INVALID_INDEX -1 class CString { enum eol_t { eol_cr, eol_lf, eol_crlf }; protected: std::string m_String; eol_t m_eol_type; public: std::string& GetString(void); std::string GetString(void) const; char *GetCString(void) const; int GetLength(void) const; bool IsEmpty(void) const; CString& SetLength(void); CString& SetLength(const int Length); CString& Clear(void); char GetChar(const int Index) const; char GetFirstChar(void) const; char GetLastChar(void) const; void SetChar(const int Index, const char Value); CString& Assign(const char AChar); CString& Assign(const char *AString); CString& Assign(const std::string& AString); CString& Assign(const CString& AString); CString& Append(const char AChar); CString& Append(const char *AString); CString& Append(const std::string& AString); CString& Append(const CString& AString); CString& AppendCR(void); CString& AppendLF(void); CString& AppendCRLF(void); CString& AppendEOL(void); CString GetEOL(void); CString& SetEOL(const eol_t EndOfLine); char& operator [](const int Index); char operator [](const int Index) const; CString& operator =(const char AChar); CString& operator =(const char *AString); CString& operator =(const std::string& AString); CString& operator =(const CString& AString); CString& operator =(const int AInteger); CString& operator =(const long long int AInteger); CString& operator =(const float AFloat); CString& operator =(const double AFloat); CString& operator +=(const char AChar); CString& operator +=(const char *CString); CString& operator +=(const CString& AString); CString& operator +=(const int AInteger); CString& operator +=(const long long int AInteger); CString& operator +=(const float AFloat); CString& operator +=(const double AFloat); bool operator ==(const char *AString) const; bool operator ==(const std::string& AString) const; bool operator ==(const CString& AString) const; int GetInteger(void) const; double GetFloat(void) const; void Fill(const char AChar); void Print(std::ostream& out); public: CString(void); CString(const char AChar); CString(const char *AString); CString(const std::string& AString); CString(const CString& AString); ~CString(void); }; class CStringList { protected: std::vector m_Strings; CString m_NullString; protected: bool ValidIndex(const int Index) const; public: bool IsEmpty(void) const; int GetCount(void) const; int GetLength(void) const; CString& GetString(const int Index); CString GetString(const int Index) const; CString Join(const CString& Delimiter) const; int FindString(const CString& AString) const; int Insert(const CString *AString); int Insert(const CString& AString); CStringList& Insert(const CStringList& AStringList); CStringList& InsertAt(const int Index, const CStringList& AStringList); CStringList& InsertAt(const int Index, const CString *AString); CStringList& InsertAt(const int Index, const CString& AString); CStringList& RemoveAt(const int Index); CStringList& RemoveEmpty(void); CStringList& RemoveDuplicates(void); CStringList& Clear(void); bool AppendFromFile(const CString& FileName); bool LoadFromFile(const CString& FileName); bool SaveToFile(const CString& FileName); void Print(std::ostream& out); CStringList& operator =(const CString& AString); CStringList& operator =(const CStringList& AStringList); CString& operator [](const int Index); CString operator [](const int Index) const; CStringList& operator <<(const CString& AString); public: CStringList(void); CStringList(const CStringList& AStringList); ~CStringList(void); }; #define CHARSET_SIZE (1<<(8*sizeof(char))) class CCharset { protected: bool m_Charset[CHARSET_SIZE]; CString m_Alphabet; protected: void UpdateCharset(void); void UpdateAlphabet(void); public: bool Isset(const char AChar) const; char GetChar(const char AChar) const; void SetChar(const char AChar); void UnsetChar(const char AChar); CString GetAlphabet(void) const; void SetAlphabet(const CString& Alphabet); void Print(std::ostream& out); public: CCharset(void); CCharset(const CCharset& Charset); CCharset(const CString& Alphabet); ~CCharset(void); }; class CCharIterator { protected: char m_NullChar; public: virtual int FirstPosition(void) { return 0; } virtual int ThisPosition(void) { return 0; } virtual int LastPosition(void) { return 0; } // virtual char& First(void) { return m_NullChar; } virtual char& Prev(void) { return m_NullChar; } virtual char& This(void) { return m_NullChar; } virtual char& Next(void) { return m_NullChar; } virtual char& Last(void) { return m_NullChar; } virtual void Reset(void) {}; virtual bool Match(const CString& Pattern, const bool Move = false); virtual void Print(std::ostream& out) {}; public: CCharIterator(void) { m_NullChar = 0; }; CCharIterator(const CCharIterator& ACharIterator) { m_NullChar = 0; }; virtual ~CCharIterator(void) {}; }; class CStringIterator: public CCharIterator { protected: CString *m_String; int m_Position; public: virtual int FirstPosition(void); virtual int ThisPosition(void); virtual int LastPosition(void); // virtual char& First(void); virtual char& Prev(void); virtual char& This(void); virtual char& Next(void); virtual char& Last(void); virtual void Reset(void); virtual bool Match(const CString& Pattern, const bool Move = false); public: CStringIterator(void); CStringIterator(const CString *AString); CStringIterator(const CStringIterator& AStringIterator); virtual ~CStringIterator(void) {}; }; class CStringListIterator: public CCharIterator { protected: CStringList *m_StringList; int m_Line; int m_Position; public: virtual int FirstPosition(void); virtual int ThisPosition(void); virtual int LastPosition(void); // virtual char& First(void); virtual char& Prev(void); virtual char& This(void); virtual char& Next(void); virtual char& Last(void); virtual void Reset(void); virtual bool Match(const CString& Pattern, const bool Move = false); public: CStringListIterator(void); CStringListIterator(const CStringList *AStringList); CStringListIterator(const CStringListIterator& AStringListIterator); virtual ~CStringListIterator(void) {}; }; static const unsigned int MAX_CHAR_FREQUENCY = ((1<<(7*sizeof(unsigned int)))-1); class CCharHistogram { private: static const unsigned int FLAG_PURE_NUMERIC = 0x00000001; static const unsigned int FLAG_PURE_INTEGER = 0x00000002; static const unsigned int FLAG_ASCII_TEXT = 0x00000004; static const unsigned int FLAG_CUSTOM_BINARY = 0x00000008; protected: unsigned int m_Histogram[CHARSET_SIZE]; unsigned int m_Flags; protected: void Analyze(void); public: void Reset(void); void Insert(const char AChar); void Insert(const CString& AString); void Insert(const CStringList& AStringList); void Remove(const char AChar); void Remove(const CString& AString); void Remove(const CStringList& AStringList); bool IsPureNumeric(void); bool IsPureInteger(void); bool IsAsciiText(void); bool IsCustomBinary(void); unsigned int GetAt(const char AChar) const; void SetAt(const char AChar, const unsigned int Frequency); CString GetAlphabet(void) const; void Print(std::ostream& out); public: CCharHistogram(void); CCharHistogram(const CCharHistogram& AHistogram); ~CCharHistogram(void); }; static const CString ALPHABET_NULL_CHAR = char(0x00); static const CString ALPHABET_TAB_CHAR = char(0x09); static const CString ALPHABET_CR_CHAR = char(0x0d); static const CString ALPHABET_LF_CHAR = char(0x0a); static const CString ALPHABET_NUMBER = "0123456789"; static const CString ALPHABET_INTEGER_NUMBER = "+-0123456789"; static const CString ALPHABET_FLOAT_NUMBER = "+-.,0123456789eE"; static const CString ALPHABET_DOUBLE_NUMBER = "+-.,0123456789dD"; static const CString ALPHABET_REAL_NUMBER = "+-.,0123456789eEdD"; static const CString ALPHABET_HEX_NUMBER = "0123456789abcdefABCDEF"; static const CString ALPHABET_CTL_CHARS = "\'\"\?\\\a\b\f\n\r\t\v\0"; static const CString ALPHABET_ESC_SEQUENCE = "\'\"?\\abfnrtv0"; static const CString ALPHABET_SHELL_CHARS = " !@#$%^&*(){}[];\'\"\\|<>?"; static const char HEX_CHARS_UCASE[17] = "0123456789ABCDEF"; static const char HEX_CHARS_LCASE[17] = "0123456789abcdef"; inline CString operator +(const CString& AString, const CString& BString) { CString result(AString); result+=BString; return result; } inline CString operator +(const CString& AString, const char BChar) { CString result(AString); result+=BChar; return result; } inline CString operator +(const char AChar, const CString& BString) { CString result(AChar); result+=BString; return result; } inline CString operator +(const CString& AString, const int BInteger) { CString result(AString); result+=BInteger; return result; } inline CString operator +(const int AInteger, const CString& BString) { CString result; result+=AInteger; result+=BString; return result; } inline CString operator +(const CString& AString, const float BFloat) { CString result(AString); result+=BFloat; return result; } inline CString operator +(const float AFloat, const CString& BString) { CString result; result+=AFloat; result+=BString; return result; } inline CString operator +(const CString& AString, const double BFloat) { CString result(AString); result+=BFloat; return result; } inline CString operator +(const double AFloat, const CString& BString) { CString result; result+=AFloat; result+=BString; return result; } inline CString operator +(const CString& AString, const char *BCString) { CString result(AString); result+=BCString; return result; } inline CString operator +(const char *AString, const CString& BString) { CString result(AString); result+=BString; return result; } /* inline CString UpperCase(const CString& AString) { CString result(AString); strupr(result.GetCString()); return result; //CString result(AString); std::strupr(result.GetCString()); return result; } inline CString LowerCase(const CString& AString) { CString result(AString); std::strlwr(result.GetCString()); return result; //CString result(AString); std::strlwr(result.GetCString()); return result; } */ // this might solve compatibility issues // "islower(c) ? toupper(c) : c" // inline CString UpperCase(const CString& AString) { CString result; result.SetLength(AString.GetLength()); for (int i = 0, n = AString.GetLength(); i < n; i++) { char c = AString[i]; result[i] = islower(c) ? toupper(c) : c; } return result; } inline CString LowerCase(const CString& AString) { CString result; result.SetLength(AString.GetLength()); for (int i = 0, n = AString.GetLength(); i < n; i++) { char c = AString[i]; result[i] = isupper(c) ? tolower(c) : c; } return result; } inline char hexChar(const unsigned char Value) { return HEX_CHARS_LCASE[Value&0xF]; } inline char HexChar(const unsigned char Value) { return HEX_CHARS_UCASE[Value&0xF]; } inline CString hex(const unsigned int AInteger, const unsigned int Length=8) { CString result; result.SetLength(Length); unsigned int value = AInteger; for (unsigned int i = 0, j = Length; i < Length; i++) { result[--j] = HEX_CHARS_LCASE[value & 0xF]; value >>= 4; } return result; } inline CString Hex(const unsigned int AInteger, const unsigned int Length=8) { CString result; result.SetLength(Length); unsigned int value = AInteger; for (unsigned int i = 0, j = Length; i < Length; i++) { result[--j] = HEX_CHARS_UCASE[value & 0xF]; value >>= 4; } return result; } inline CString hex8(const unsigned char AInteger) { return hex(AInteger,2*sizeof(unsigned char)); } inline CString Hex8(const unsigned char AInteger) { return Hex(AInteger,2*sizeof(unsigned char)); } inline CString hex16(const unsigned short int AInteger) { return hex(AInteger,2*sizeof(unsigned short int)); } inline CString Hex16(const unsigned short int AInteger) { return Hex(AInteger,2*sizeof(unsigned short int)); } inline CString hex32(const unsigned int AInteger) { return hex(AInteger,2*sizeof(unsigned int)); } inline CString Hex32(const unsigned int AInteger) { return Hex(AInteger,2*sizeof(unsigned int)); } inline CString hex64(const long long int AInteger, const unsigned int Length=16) { CString result; result.SetLength(Length); long long int value = AInteger; for (unsigned int i = 0, j = Length; i < Length; i++) { result[--j] = HEX_CHARS_LCASE[(unsigned int)value & 0xF]; value >>= 4; } return result; } inline CString Hex64(const long long int AInteger, const unsigned int Length=16) { CString result; result.SetLength(Length); long long int value = AInteger; for (unsigned int i = 0, j = Length; i < Length; i++) { result[--j] = HEX_CHARS_UCASE[(unsigned int)value & 0xF]; value >>= 4; } return result; } inline CString hex(const unsigned char *Buffer, const unsigned int Length=0) { unsigned int length = Length*2; CString result; result.SetLength(length); for (unsigned int i = 0, j = length; i < Length; i++) { result[--j] = HEX_CHARS_UCASE[Buffer[i] & 0xF]; result[--j] = HEX_CHARS_UCASE[(Buffer[i]>>4) & 0xF]; } return result; } inline CString Hex(const unsigned char *Buffer, const unsigned int Length=0) { unsigned int length = Length*2; CString result; result.SetLength(length); for (unsigned int i = 0, j = length; i < Length; i++) { result[--j] = HEX_CHARS_UCASE[Buffer[i] & 0xF]; result[--j] = HEX_CHARS_UCASE[(Buffer[i]>>4) & 0xF]; } return result; } CString StringOfChars(const char AChar, const int Count); CString FillStr(const CString& Prefix, const char AChar, const CString& Suffix, const int Length); CString EnumStr(const CString& Prefix, const int Counter, const CString& Suffix, const unsigned int Length); CString SignStr(const int Signature); CString SubStr(const CString& AString, const int FirstPos, const int LastPos); CString ShiftStr(const CString& AString, const int Shift); void SplitStr(const CString& AString, const int Position, CString& LString, CString& RString); CString JoinStr(const CString& AString, const CString& BString, const char Separator); CString LeftStr(const CString& AString, const int Position); CString RightStr(const CString& AString, const int Position); CString FilterStr(const CString& AString, const CCharset& ValidChars, const CCharset& InvalidChars, const bool ValidateUndefined); int CountChars(const CString& AString, const char AChar); int NextCharPos(const CString& AString, const char AChar, const int Position); int PrevCharPos(const CString& AString, const char AChar, const int Position); int FirstCharPos(const CString& AString, const char AChar); int LastCharPos(const CString& AString, const char AChar); CString TrimStr(const CString& AString); CString LeadStr(const CString& AString, const unsigned int RLength); void ParseStr(const CString& AString, const CString& Delimiters, CStringList& SubStrings); void ParseStr(const CString& AString, const char Delimiter, CStringList& SubStrings); CString CollectStr(const CStringList& SubStrings, const CString& Delimiters); CString StripDupChars(const CString& AString, const char AChar); CString StripDupChars(const CString& AString); CString CheckFirstChar(const CString& AString, const char AChar); CString CheckLastChar(const CString& AString, const char AChar); int FindStr(const CString& AString, const CString& BString); CString FindReplaceChar(const CString& AString, const char SearchChar, const char ReplaceChar); CString FindReplaceStr(const CString& AString, const CString& SearchString, const CString& ReplaceString); int ParseMemSizeStr(const CString& AString, int& UnitSize, char& UnitChar); int ParseMemSizeStr(const CString& AString); long long int ParseMemSizeStr64(const CString& AString, long long int& UnitSize, char& UnitChar); long long int ParseMemSizeStr64(const CString& AString); int GuessStr(const CString& AString, const CStringList& Variants, CString& Guessed, const bool TryFuzzy = false); int GuessStr(const CString& AString, const CString& Variants, CString& Guessed, const bool TryFuzzy = false); CString VariantStr(const int Index, const CString& Variants, const char Delimiter = ' '); CString MemSizeStr(const long long int Value, long long int& UnitSize, CString& UnitSuffix); CString MemSizeStr(const long long int Value); CString SI_UnitStr(const double Value, double& UnitSize, CString& UnitPrefix, CString& UnitSymbol); CString SI_UnitStr(const double Value); bool IsQuoted(const CString& AString); CString QuoteStr(const CString& AString); CString UnquoteStr(const CString& AString); CString ShieldSpaces(const CString& AString); CString UnshieldSpaces(const CString& AString); CString ShieldChars(const CString& AString, const CString& Chars); CString UnshieldChars(const CString& AString, const CString& Chars); //--------------------------------------------------------------------------- #endif cbp2make-147+dfsg/lib/stlconvert.cpp0000644000175000017500000000172712155022124017330 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #include "stlconvert.h" //------------------------------------------------------------------------------ cbp2make-147+dfsg/lib/stlstrings.cpp0000644000175000017500000011442312155022124017337 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #include #include #include //------------------------------------------------------------------------------ #include "stlstrings.h" #include "stlconvert.h" //------------------------------------------------------------------------------ std::string& CString::GetString(void) { return m_String; } std::string CString::GetString(void) const { return m_String; } char *CString::GetCString(void) const { return (char *)m_String.c_str(); } int CString::GetLength(void) const { return m_String.size(); } bool CString::IsEmpty(void) const { return (GetLength()==0); } CString& CString::SetLength(void) { return SetLength(strlen(GetCString())); } CString& CString::SetLength(const int Length) { m_String.resize(Length); return *this; } CString& CString::Clear(void) { m_String.clear(); return *this; } char CString::GetChar(const int Index) const { if ((Index>=0)&&(Index=0)&&(Index=0)&&(Index 0; i--) result += m_Strings[i]->GetLength(); return result; } CString& CStringList::GetString(const int Index) { if (ValidIndex(Index)) { return *m_Strings[Index]; } else { return m_NullString; } } CString CStringList::GetString(const int Index) const { if (ValidIndex(Index)) { return *m_Strings[Index]; } else { return m_NullString; } } CString CStringList::Join(const CString& Delimiter) const { CString result; if (GetCount() > 0) { result.Append(*m_Strings[0]); for (int i = 1, n = GetCount(); i < n; i++) { result.Append(Delimiter).Append(*m_Strings[i]); } } return result; } int CStringList::FindString(const CString& AString) const { for (int i = 0, n = GetCount(); i < n; i++) { if (GetString(i)==AString) return i; } return INVALID_INDEX; } int CStringList::Insert(const CString *AString) { m_Strings.push_back((CString *)AString); return GetCount()-1; } int CStringList::Insert(const CString& AString) { m_Strings.push_back(new CString(AString)); return GetCount()-1; } CStringList& CStringList::Insert(const CStringList& AStringList) { for (int i = 0; i < AStringList.GetCount(); i++) { Insert(AStringList[i]); } return *this; } CStringList& CStringList::InsertAt(const int Index, const CStringList& AStringList) { for (int i = 0; i < AStringList.GetCount(); i++) { InsertAt(Index+i,AStringList[i]); } return *this; } CStringList& CStringList::InsertAt(const int Index, const CString *AString) { if (ValidIndex(Index)) { m_Strings.insert(m_Strings.begin()+Index,(CString *)AString); } return *this; } CStringList& CStringList::InsertAt(const int Index, const CString& AString) { if (ValidIndex(Index)) { m_Strings.insert(m_Strings.begin()+Index,new CString(AString)); } return *this; } CStringList& CStringList::RemoveAt(const int Index) { if (ValidIndex(Index)) { CString *string = m_Strings[Index]; m_Strings.erase(m_Strings.begin()+Index); delete string; } return *this; } CStringList& CStringList::RemoveEmpty(void) { for (int i = m_Strings.size()-1; i >= 0; i--) { if (GetString(i).IsEmpty()) { RemoveAt(i); }} return *this; } CStringList& CStringList::RemoveDuplicates(void) { for (size_t j = 0; j < m_Strings.size(); j++) { for (size_t i = m_Strings.size()-1; i > j; i--) { if (GetString(j)==GetString(i)) { RemoveAt(i); }}} return *this; } CStringList& CStringList::Clear(void) { for (int i = m_Strings.size()-1; i >= 0; i--) { RemoveAt(i); } return *this; } bool CStringList::AppendFromFile(const CString& FileName) { FILE* stream = fopen(FileName.GetCString(),"rb"); CString buffer; char c,c2; int buf_pos; if (NULL!=stream) { buffer.SetLength(0x100); buf_pos = 0; c = 0; while (!feof(stream)) { c2 = c; fread(&c,1,1,stream); switch (c) { case 0x00: case 0x0d: { buffer.SetLength(buf_pos); Insert(buffer); buf_pos = 0; break; } case 0x0a: { if (0x0d!=c2) { buffer.SetLength(buf_pos); Insert(buffer); buf_pos = 0; } break; } default: { if (buf_pos>=buffer.GetLength()) buffer.SetLength(buffer.GetLength()+0x100); buffer[buf_pos++] = c; break; }}} if (buf_pos>0) { buffer.SetLength(buf_pos-1); Insert(buffer); } fclose(stream); return true; } return false; } bool CStringList::LoadFromFile(const CString& FileName) { Clear(); return AppendFromFile(FileName); } bool CStringList::SaveToFile(const CString& FileName) { FILE* stream = fopen(FileName.GetCString(),"wb"); if (NULL!=stream) { CString buffer; buffer.AppendEOL(); for (int i = 0; i < GetCount(); i++) { CString& string = GetString(i); fwrite(string.GetCString(),string.GetLength(),1,stream); fwrite(buffer.GetCString(),buffer.GetLength(),1,stream); } fclose(stream); return true; } return false; } void CStringList::Print(std::ostream& out) { for (int i = 0; i < GetCount(); i++) { out<GetLength()-1; } char& CStringIterator::First(void) { m_Position = FirstPosition(); return This(); } char& CStringIterator::Prev(void) { if (m_Position > 0) m_Position--; return This(); } char& CStringIterator::This(void) { return (*m_String)[m_Position]; } char& CStringIterator::Next(void) { if (m_Position < (int)m_String->GetLength()) m_Position++; return This(); } char& CStringIterator::Last(void) { m_Position = LastPosition(); return This(); } void CStringIterator::Reset(void) { First(); } bool CStringIterator::Match(const CString& Pattern, const bool Move) { int position = m_Position; bool result = CCharIterator::Match(Pattern,false); if (!(result && Move)) m_Position = position; return result; } //------------------------------------------------------------------------------ CStringListIterator::CStringListIterator(void) { m_StringList = NULL; m_Line = 0; m_Position = 0; } CStringListIterator::CStringListIterator(const CStringList *AStringList) { m_StringList = (CStringList *)AStringList; } CStringListIterator::CStringListIterator(const CStringListIterator& AStringListIterator) { m_StringList = AStringListIterator.m_StringList; m_Line = AStringListIterator.m_Line; m_Position = AStringListIterator.m_Position; } int CStringListIterator::FirstPosition(void) { return 0; } int CStringListIterator::ThisPosition(void) { return m_Position; } int CStringListIterator::LastPosition(void) { if (NULL==m_StringList) return m_NullChar; return m_StringList->GetLength() + m_StringList->GetCount(); // length of all strings + null chars } char& CStringListIterator::First(void) { if (NULL==m_StringList) return m_NullChar; m_Line = 0; m_Position = 0; return This(); } char& CStringListIterator::Prev(void) { if (NULL==m_StringList) return m_NullChar; if (m_Position > 0) { m_Position--; return This(); } else { if (m_Line > 0) { m_Line--; m_Position = std::max(0,m_StringList->GetString(m_Line).GetLength()-1); }} return This(); } char& CStringListIterator::This(void) { if (NULL==m_StringList) return m_NullChar; return m_StringList->GetString(m_Line)[m_Position]; } char& CStringListIterator::Next(void) { if (NULL==m_StringList) return m_NullChar; if (m_Position < (int)m_StringList->GetString(m_Line).GetLength()) { m_Position++; return This(); } else { if (m_Line < (m_StringList->GetCount()-1)) { m_Line++; m_Position = 0; }} return This(); } char& CStringListIterator::Last(void) { if (NULL==m_StringList) return m_NullChar; m_Line = m_StringList->GetCount()-1; m_Position = m_StringList->GetString(m_Line).GetLength(); return This(); } void CStringListIterator::Reset(void) { First(); } bool CStringListIterator::Match(const CString& Pattern, const bool Move) { int line = m_Line; int position = m_Position; bool result = CCharIterator::Match(Pattern,false); if (!(result && Move)) { m_Line = line; m_Position = position; } return result; } //------------------------------------------------------------------------------ CCharHistogram::CCharHistogram(void) { Reset(); } CCharHistogram::CCharHistogram(const CCharHistogram& AHistogram) { Reset(); } CCharHistogram::~CCharHistogram(void) { // do nothing // } void CCharHistogram::Analyze(void) { m_Flags = 0; CCharset numeric_charset(ALPHABET_NUMBER); CCharset realnum_charset(ALPHABET_REAL_NUMBER); CCharset integer_charset(ALPHABET_INTEGER_NUMBER); CCharset textnum_charset(ALPHABET_REAL_NUMBER+ALPHABET_TAB_CHAR+" "+ALPHABET_CR_CHAR+ALPHABET_LF_CHAR); unsigned int total_chars = 0, ascii_chars = 0, textnum_chars = 0, realnum_chars = 0, integer_chars = 0, numeric_chars = 0; for (int i = 0; i < CHARSET_SIZE; i++) { unsigned int _CharCount = m_Histogram[i]; total_chars += _CharCount; if (i<0x80) ascii_chars += _CharCount; if (textnum_charset.Isset(char(i))) { textnum_chars += _CharCount; if (realnum_charset.Isset(char(i))) { realnum_chars += _CharCount; if (integer_charset.Isset(char(i))) { integer_chars += _CharCount; if (numeric_charset.Isset(char(i))) numeric_chars += _CharCount; }}}} // if there are characters with codes >= 0x80 then content is not an ascii text if (total_chars>ascii_chars) m_Flags |= FLAG_CUSTOM_BINARY; else { // if there are letters other than exponent specifiers if (total_chars>textnum_chars) m_Flags |= FLAG_ASCII_TEXT; else { // if there is at least one digit character if (numeric_chars>0) { if (realnum_chars>integer_chars) m_Flags |= FLAG_PURE_NUMERIC; else m_Flags |= FLAG_PURE_INTEGER; } else m_Flags |= FLAG_ASCII_TEXT; } } } void CCharHistogram::Reset(void) { m_Flags = 0; for (int i = 0; i < CHARSET_SIZE; i++) m_Histogram[i] = 0; } void CCharHistogram::Insert(const char AChar) { if (m_Histogram[(unsigned char)AChar]0) m_Histogram[(unsigned char)AChar]--; m_Flags = 0; } void CCharHistogram::Remove(const CString& AString) { for (int i = 0, n = AString.GetLength(); i < n; i++) { char c = AString[i]; if (m_Histogram[(unsigned char)c]>0) m_Histogram[(unsigned char)c]--; } m_Flags = 0; } void CCharHistogram::Remove(const CStringList& AStringList) { for (int j = 0, nj = AStringList.GetCount(); j < nj; j++) { CString s = AStringList.GetString(j); for (int i = 0, ni = s.GetLength(); i < ni; i++) { char c = s[i]; if (m_Histogram[(unsigned char)c]>0) m_Histogram[(unsigned char)c]--; }} m_Flags = 0; } bool CCharHistogram::IsPureNumeric(void) { if (0==m_Flags) Analyze(); return ((m_Flags&FLAG_PURE_NUMERIC)!=0); } bool CCharHistogram::IsPureInteger(void) { if (0==m_Flags) Analyze(); return ((m_Flags&FLAG_PURE_INTEGER)!=0); } bool CCharHistogram::IsAsciiText(void) { if (0==m_Flags) Analyze(); return ((m_Flags&FLAG_ASCII_TEXT)!=0); } bool CCharHistogram::IsCustomBinary(void) { if (0==m_Flags) Analyze(); return ((m_Flags&FLAG_CUSTOM_BINARY)!=0); } unsigned int CCharHistogram::GetAt(const char AChar) const { return m_Histogram[(unsigned char)AChar]; } void CCharHistogram::SetAt(const char AChar, const unsigned int Frequency) { m_Histogram[(unsigned char)AChar] = Frequency; } CString CCharHistogram::GetAlphabet(void) const { CString result; for (int i = 0, n = CHARSET_SIZE; i < n; i++) { if (m_Histogram[i]>0) result.Append(char(i)); } return result; } void CCharHistogram::Print(std::ostream& out) { for (int i = 0, n = CHARSET_SIZE; i < n; i++) { out<<"char 0x"<0x20) out<0) result.SetLength(Count).Fill(AChar); return result; } CString FillStr(const CString& Prefix, const char AChar, const CString& Suffix, const int Length) { CString filler = StringOfChars(AChar,Length-Prefix.GetLength()-Suffix.GetLength()); CString result = Prefix+filler+Suffix; return result; } CString EnumStr(const CString& Prefix, const int Counter, const CString& Suffix, const unsigned int Length) { CString result, lead_zero, counter = IntegerToString(Counter); unsigned int length = Prefix.GetLength()+counter.GetLength()+Suffix.GetLength(); if (Length>length) { lead_zero.SetLength(Length-length); lead_zero.Fill('0'); } result = Prefix + lead_zero + counter + Suffix; return result; } CString SignStr(const int Signature) { CString result; int s = Signature; for (size_t i = 0; i < sizeof(s); i++) { result+=char(s&0xff); s>>=8; } return result; } CString SubStr(const CString& AString, const int FirstPos, const int LastPos) { CString result; if (FirstPos > LastPos) return result; int first_pos = std::max(std::min(FirstPos,AString.GetLength()-1),0); int last_pos = std::max(std::min(LastPos,AString.GetLength()-1),0); if (last_pos0) return SubStr(AString,Shift,AString.GetLength()-1); if (Shift<0) if (AString.GetLength()>(-Shift)) return SubStr(AString,-Shift,AString.GetLength()-Shift); return result; } CString LeftStr(const CString& AString, const int Position) { return SubStr(AString,0,std::min(AString.GetLength(),Position)); } CString RightStr(const CString& AString, const int Position) { CString result; if (AString.GetLength() > 0) { result = SubStr(AString,Position,std::max(0,AString.GetLength()-1)); } return result; } void SplitStr(const CString& AString, const int Position, CString& LString, CString& RString) { LString = LeftStr(AString,Position); RString = RightStr(AString,Position); } CString JoinStr(const CString& AString, const CString& BString, const char Separator) { CString result = AString; if (!AString.IsEmpty() && !BString.IsEmpty()) { if (BString.GetFirstChar()!=Separator) { result = CheckLastChar(result,Separator); } } result.Append(BString); //std::cout<<"join('"< 0; i--) { if (AChar==AString.GetChar(i)) return i; } return INVALID_INDEX; } int FirstCharPos(const CString& AString, const char AChar) { return NextCharPos(AString,AChar,0); } int LastCharPos(const CString& AString, const char AChar) { if (AString.GetLength() > 0) { return PrevCharPos(AString,AChar,AString.GetLength()-1); } else return INVALID_INDEX; } CString TrimStr(const CString& AString) { int first_pos = 0, last_pos = AString.GetLength()-1; for (int i = first_pos; i <= last_pos; i++) { if (' '==AString.GetChar(i)) first_pos++; else break; } for (int i = last_pos; i > first_pos; i--) { if (' '==AString.GetChar(i)) last_pos--; else break; } return SubStr(AString,first_pos,last_pos); } CString LeadStr(const CString& AString, const unsigned int RLength) { CString result; result.SetLength(std::max(0,(int)RLength-(int)AString.GetLength())); result.Fill(' '); result.Append(AString); return result; } void ParseStr(const CString& AString, const CString& Delimiters, CStringList& SubStrings) { if (Delimiters.GetLength()==0) { SubStrings.Insert(AString); return; } if (AString.GetLength()==0) { return; } int str_pos = 0, delim_pos = 0; CString sub_str; while (str_pos=Delimiters.GetLength()) { sub_str = SubStr(AString,++str_pos,AString.GetLength()-1); break; }} else sub_str.Append(AString.GetChar(str_pos)); str_pos++; } SubStrings.Insert(sub_str); } void ParseStr(const CString& AString, const char Delimiter, CStringList& SubStrings) { CString _Delimiters; _Delimiters.SetLength(CountChars(AString,Delimiter)); _Delimiters.Fill(Delimiter); ParseStr(AString,_Delimiters,SubStrings); } CString CollectStr(const CStringList& SubStrings, const CString& Delimiters) { CString result; int delim_pos = 0; int sub_strIdx = 0; bool delim_set, sub_str_set; do { sub_str_set = (sub_strIdx0)&&(match==max_match)) return INVALID_INDEX; if (match>max_match) { result = i; max_match = match; } } if (result>=0) Guessed = Variants[result]; // if none succeed, return -1 return result; } int GuessStr(const CString& AString, const CString& Variants, CString& Guessed, const bool TryFuzzy) { CStringList _Variants; ParseStr(Variants,' ',_Variants); return GuessStr(AString,_Variants,Guessed,TryFuzzy); } CString VariantStr(const int Index, const CString& Variants, const char Delimiter) { CStringList variants; ParseStr(Variants,Delimiter,variants); CString result = variants.GetString(Index); return result; } CString MemSizeStr(const long long int Value, long long int& UnitSize, CString& UnitSuffix) { const long long int kb = 0x00000000400LL; const long long int mb = 0x00000100000LL; const long long int gb = 0x00040000000LL; const long long int tb = 0x10000000000LL; const CString format = "%lg"; if (Value < kb) { UnitSize = 1; UnitSuffix = "b"; return Int64ToString(Value); } else if (Value < mb) { UnitSize = kb; UnitSuffix = "Kb"; return FloatToString((double)Value/(double)kb,format); } else if (Value < gb) { UnitSize = mb; UnitSuffix = "Mb"; return FloatToString((double)Value/(double)mb,format); } else if (Value < tb) { UnitSize = gb; UnitSuffix = "Gb"; return FloatToString((double)Value/(double)gb,format); } else { UnitSize = tb; UnitSuffix = "Tb"; return FloatToString((double)Value/(double)tb,format); } return ""; } CString MemSizeStr(const long long int Value) { long long int unit_size; CString unit_suffix; return MemSizeStr(Value,unit_size,unit_suffix).Append(" ").Append(unit_suffix); } CString SI_UnitStr(const double Value, double& UnitSize, CString& UnitPrefix, CString& UnitSymbol) { int m = (int)floor(log10(Value)); CString format = "%lg"; if (m<0) { if (m<=-24) { UnitSize = 1e-24; UnitPrefix = "yocto"; UnitSymbol = "y"; return FloatToString(Value/UnitSize,format); } else if (m<=-21) { UnitSize = 1e-21; UnitPrefix = "zepto"; UnitSymbol = "z"; return FloatToString(Value/UnitSize,format); } else if (m<=-18) { UnitSize = 1e-18; UnitPrefix = "atto"; UnitSymbol = "a"; return FloatToString(Value/UnitSize,format); } else if (m<=-15) { UnitSize = 1e-15; UnitPrefix = "femto"; UnitSymbol = format; return FloatToString(Value/UnitSize,format); } else if (m<=-9) { UnitSize = 1e-9; UnitPrefix = "pico"; UnitSymbol = "p"; return FloatToString(Value/UnitSize,format); } else if (m<=-6) { UnitSize = 1e-6; UnitPrefix = "nano"; UnitSymbol = "n"; return FloatToString(Value/UnitSize,format); } else if (m<=-3) { UnitSize = 1e-3; UnitPrefix = "micro"; UnitSymbol = "mu"; return FloatToString(Value/UnitSize,format); } else if (m<=-2) { UnitSize = 1e-2; UnitPrefix = "milli"; UnitSymbol = "m"; return FloatToString(Value/UnitSize,format); } else if (m<=-1) { UnitSize = 1e-1; UnitPrefix = "deci"; UnitSymbol = "d"; return FloatToString(Value/UnitSize,format); } } if (m>0) { if (m>=24) { UnitSize = 1e24; UnitPrefix = "yotta"; UnitSymbol = "Y"; return FloatToString(Value/UnitSize,format); } else if (m>=21) { UnitSize = 1e21; UnitPrefix = "zetta"; UnitSymbol = "Z"; return FloatToString(Value/UnitSize,format); } else if (m>=18) { UnitSize = 1e18; UnitPrefix = "exa"; UnitSymbol = "E"; return FloatToString(Value/UnitSize,format); } else if (m>=15) { UnitSize = 1e15; UnitPrefix = "peta"; UnitSymbol = "P"; return FloatToString(Value/UnitSize,format); } else if (m>=12) { UnitSize = 1e12; UnitPrefix = "tera"; UnitSymbol = "T"; return FloatToString(Value/UnitSize,format); } else if (m>=9) { UnitSize = 1e9; UnitPrefix = "giga"; UnitSymbol = "G"; return FloatToString(Value/UnitSize,format); } else if (m>=6) { UnitSize = 1e6; UnitPrefix = "mega"; UnitSymbol = "M"; return FloatToString(Value/UnitSize,format); } else if (m>=3) { UnitSize = 1e3; UnitPrefix = "kilo"; UnitSymbol = "k"; return FloatToString(Value/UnitSize,format); } else if (m>=2) { UnitSize = 1e2; UnitPrefix = "hecto"; UnitSymbol = "h"; return FloatToString(Value/UnitSize,format); } else if (m>=1) { UnitSize = 1e1; UnitPrefix = "deca"; UnitSymbol = "da"; return FloatToString(Value/UnitSize,format); } } UnitSize = 1; UnitPrefix = ""; UnitSymbol = ""; return FloatToString(Value,format); } CString SI_UnitStr(const double Value) { double unit_size; CString unit_prefix; CString unit_symbol; return SI_UnitStr(Value,unit_size,unit_prefix,unit_symbol).Append(" ").Append(unit_symbol); } bool IsQuoted(const CString& AString) { return ((AString.GetLength()>=2)&&(AString.GetFirstChar()=='\"')&&(AString.GetLastChar()=='\"')); } CString QuoteStr(const CString& AString) { if (!IsQuoted(AString)) return "\""+AString+"\""; else return AString; } CString UnquoteStr(const CString& AString) { if (IsQuoted(AString)) return SubStr(AString,1,AString.GetLength()-2); else return AString; } CString ShieldSpaces(const CString& AString) { CString result; bool shield = false; for (int i = 0, n = AString.GetLength(); i < n; i++) { if (shield) { shield = false; result.Append(AString[i]); } else { if ('\\'==AString[i]) shield = true; else if (' '==AString[i]) { result.Append('\\'); } result.Append(AString[i]); } } return result; } CString UnshieldSpaces(const CString& AString) { CString result; bool shield = false; for (int i = 0, n = AString.GetLength(); i < n; i++) { if (shield) { shield = false; if (' '!=AString[i]) result.Append('\\'); result.Append(AString[i]); } else { if ('\\'==AString[i]) shield = true; else result.Append(AString[i]); } } if (shield) result.Append('\\'); return result; } CString ShieldChars(const CString& AString, const CString& Chars) { if (Chars.IsEmpty()) return AString; CCharset esc_chars(Chars); CString result; bool shield = false; for (int i = 0, n = AString.GetLength(); i < n; i++) { if (shield) { shield = false; if (!esc_chars.Isset(AString[i])) { result.Append('\\'); } result.Append(AString[i]); } else { if ('\\'==AString[i]) shield = true; else if (esc_chars.Isset(AString[i])) { result.Append('\\'); } result.Append(AString[i]); } } return result; } CString UnshieldChars(const CString& AString, const CString& Chars) { if (Chars.IsEmpty()) return AString; CCharset esc_chars(Chars); CString result; bool shield = false; for (int i = 0, n = AString.GetLength(); i < n; i++) { if (shield) { shield = false; if (!esc_chars.Isset(AString[i])) result.Append('\\'); result.Append(AString[i]); } else { if ('\\'==AString[i]) shield = true; else result.Append(AString[i]); } } if (shield) result.Append('\\'); return result; } //------------------------------------------------------------------------------ cbp2make-147+dfsg/lib/stlfutils.cpp0000644000175000017500000001641412155022124017155 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #include #include //#include #include //------------------------------------------------------------------------------ #include "stlfutils.h" //------------------------------------------------------------------------------ #ifdef OS_UNIX #include "sys/stat.h" #endif #ifdef OS_WIN #include "windows.h" #endif //------------------------------------------------------------------------------ const int MAX_PATH_LENGTH = 0x10000; char PathDelimiter(void) { #ifdef OS_WIN return '\\'; #else return '/'; #endif } CString NativePathDelimiter(void) { #ifdef OS_WIN return "\\"; #else return "/"; #endif } CString ChangeFileExt(const CString& FileName, const CString& FileExt) { CString result(FileName); int pos = LastCharPos(FileName,'.'); if (pos>=0) result.SetLength(pos); result.Append(FileExt); return result; } CString ExtractFilePath(const CString& FilePathName) { CString result; int pos = std::max(LastCharPos(FilePathName,'/'),LastCharPos(FilePathName,'\\')); if (pos >= 1) { result = LeftStr(FilePathName,pos-1); } return result; } CString ExtractFileName(const CString& FilePathName) { CString result = FilePathName; int pos = std::max(LastCharPos(FilePathName,'/'),LastCharPos(FilePathName,'\\')); if (pos >= 0) { result = RightStr(FilePathName,pos+1); } return result; } CString ExtractFileExt(const CString& FilePathName) { CString result; int pos = LastCharPos(FilePathName,'.'); if (pos >= 0) { result = RightStr(FilePathName,pos+1); } return result; } void SplitFilePathName(const CString& FilePathName, CString& FilePath, CString& FileName, CString& FileExt) { CString name_ext; int pos = std::max(LastCharPos(FilePathName,'/'),LastCharPos(FilePathName,'\\')); if (pos >= 1) { FilePath = LeftStr(FilePathName,pos-1); name_ext = RightStr(FilePathName,pos+1); } else { FilePath.Clear(); name_ext = FilePathName; } pos = LastCharPos(name_ext,'.'); if (pos >= 0) { if (pos >= 1) { FileName = LeftStr(name_ext,pos-1); } else { FileName.Clear(); } FileExt = RightStr(name_ext,pos+1); } else { FileName = name_ext; FileExt.Clear(); } } CString MakeUnixPath(const CString& FilePathName) { return FindReplaceChar(FilePathName,'\\','/'); } CString MakeWindowsPath(const CString& FilePathName) { return FindReplaceChar(FilePathName,'/','\\'); } CString MakeNativePath(const CString& FilePathName) { #ifdef OS_WIN return MakeWindowsPath(FilePathName); #else return MakeUnixPath(FilePathName); #endif } CString RemoveLeadingPathDelimiter(const CString& FilePathName) { CString result;// = FilePathName; if (!FilePathName.IsEmpty()) { if ((FilePathName.GetFirstChar()=='/')||(FilePathName.GetFirstChar()=='\\')) { result = RightStr(FilePathName,1); } } return result; } CString IncludeLeadingPathDelimiter(const CString& FilePathName) { return CheckFirstChar(FilePathName,PathDelimiter()); } CString RemoveTrailingPathDelimiter(const CString& FilePathName) { CString result = FilePathName; if (!FilePathName.IsEmpty()) { if ((FilePathName.GetLastChar()=='/')||(FilePathName.GetLastChar()=='\\')) { result.SetLength(result.GetLength()-1); } } return result; } CString IncludeTrailingPathDelimiter(const CString& FilePathName) { return CheckLastChar(FilePathName,PathDelimiter()); } CString QuoteSpaces(const CString& FilePathName, const int QuoteMode) { CString result = FilePathName; if ((2==QuoteMode) || (CountChars(FilePathName,' ')>0)) { result = QuoteStr(FilePathName); } return result; } CString JoinPaths(const CString& HeadPath, const CString& TailPath, const char Separator) { CString head_path, tail_path; bool head_quoted = IsQuoted(HeadPath); bool tail_quoted = IsQuoted(TailPath); bool quote_path = head_quoted&&tail_quoted; if (quote_path) head_path = UnquoteStr(HeadPath); else head_path = HeadPath; if (quote_path) tail_path = UnquoteStr(TailPath); else tail_path = TailPath; CString result = head_path; if (!head_path.IsEmpty() && !tail_path.IsEmpty()) { result = CheckLastChar(head_path,Separator); } result += tail_path; if (quote_path) result = QuoteStr(result); return result; } bool FileExists(const CString& FileName) { bool result = false; #ifdef OS_UNIX struct stat st; if (stat(FileName.GetCString(),&st)==0) { result = S_ISREG(st.st_mode); } #else FILE* stream = fopen(FileName.GetCString(),"r"); result = (NULL!=stream); if (result) { fclose(stream); } #endif return result; } bool DirExists(const CString& DirPath) { bool result = false; #ifdef OS_WIN /* WIN32_FIND_DATA w32fd; HANDLE h = FindFirstFile(DirPath.GetCString(),&w32fd); result = (INVALID_HANDLE_VALUE!=h)&&(ERROR_FILE_NOT_FOUND!=h); */ DWORD attr = GetFileAttributes(DirPath.GetCString()); result = (attr & FILE_ATTRIBUTE_DIRECTORY); #else struct stat st; if (stat(DirPath.GetCString(),&st) == 0) { result = S_ISDIR(st.st_mode); } #endif return result; } bool MakeDir(const CString& DirPath, int DirMode) { #ifdef OS_WIN return CreateDirectory(DirPath.GetCString(),0); #else return (mkdir(DirPath.GetCString(),DirMode)==0); #endif } CString RootDirPath(void) { CString result; #ifdef OS_WIN result = getenv("SystemDrive"); if (result.IsEmpty()) { result = "C:"; } result = CheckLastChar(result,'\\'); #else result = "/"; #endif return result; } CString HomeDirPath(void) { CString result; #ifdef OS_WIN result = getenv("USERPROFILE"); if (result.IsEmpty() || !DirExists(result)) { result = CString(getenv("HOMEDRIVE"))+CString(getenv("HOMEPATH")); if (result.IsEmpty() || !DirExists(result)) { result = getenv("HOME"); if (result.IsEmpty() || !DirExists(result)) { result = RootDirPath(); }}} #else result = getenv("HOME"); if (result.IsEmpty()) { result = RootDirPath(); } #endif return result; } CString TempDirPath(void) { CString result; #ifdef OS_WIN char tmp[MAX_PATH_LENGTH]; if (GetTempPath(MAX_PATH_LENGTH,tmp)) { result.Assign((char*)&tmp); } if (result.IsEmpty()) { result = RootDirPath()+"Temp\\"; } #else result = getenv("TMPDIR"); if (result.IsEmpty()) { result = "/tmp/"; } #endif return result; } CString GetCurrentDir(void) { CString result; result.SetLength(MAX_PATH_LENGTH); if (0!=getcwd(result.GetCString(),MAX_PATH_LENGTH)) { result.SetLength(); return result; } return ""; } bool ChangeDir(const CString& DirPath) { return (0==chdir(DirPath.GetCString())); } //------------------------------------------------------------------------------ cbp2make-147+dfsg/lib/stlgpm.cpp0000644000175000017500000001444312155022125016433 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #include "stlgpm.h" #include "stlfutils.h" #include //------------------------------------------------------------------------------ CGenericProcessingMachine::CGenericProcessingMachine(void) { m_FileConfiguration.Clear(); m_ParameterStringConfiguration.Clear(); //m_ParameterString.Clear(); m_InputFileList.Clear(); m_OutputFileList.Clear(); m_FileIndex = 0; m_AliasesEnabled = false; m_FileNameLength = 0; m_VerboseMode = false; m_QuietMode = false; m_HelpMode = false; } CGenericProcessingMachine::~CGenericProcessingMachine(void) { // } void CGenericProcessingMachine::Initialize(void) { CreateConfiguration(); PSC().ProcessParameters(m_ParameterString); Configure(ConfigurationName()); m_FileNameLength = 12; } void CGenericProcessingMachine::Initialize(int argc, char * argv[]) { PS().SetParameters(argc,argv); Initialize(); } void CGenericProcessingMachine::Initialize(const CParameterString& Parameters) { PS().SetParameters(Parameters); Initialize(); } void CGenericProcessingMachine::DisplayHelpMessage(void) { // do nothing // } void CGenericProcessingMachine::CreateConfiguration(void) { PSC().InsertStringVariable(GPM_VAR_NAME_IN); PSC().InsertStringVariable(GPM_VAR_NAME_OUT); PSC().InsertBooleanVariable(GPM_VAR_NAME_LIST); PSC().InsertStringVariable(GPM_VAR_NAME_CFG); PSC().InsertStringVariable(GPM_VAR_NAME_INDIR); PSC().InsertStringVariable(GPM_VAR_NAME_OUTDIR); PSC().InsertBooleanVariable(GPM_VAR_NAME_HELP); PSC().InsertBooleanVariable(GPM_VAR_NAME_VERBOSE); PSC().InsertBooleanVariable(GPM_VAR_NAME_QUIET); if (m_AliasesEnabled) { PSC().InsertBooleanVariable(GPM_VAR_NAME_HELP_ALIAS); PSC().InsertBooleanVariable(GPM_VAR_NAME_VERBOSE_ALIAS); PSC().InsertBooleanVariable(GPM_VAR_NAME_QUIET_ALIAS); } } CString CGenericProcessingMachine::DefaultConfigurationName(void) { return ChangeFileExt(ExtractFileName(PS().Parameter(0)),".cfg"); } CString CGenericProcessingMachine::ConfigurationName(void) { if (PSC().VarDefined(GPM_VAR_NAME_CFG)) { return PSC().VarNamed(GPM_VAR_NAME_CFG).GetString(); } else { return DefaultConfigurationName(); } } bool CGenericProcessingMachine::Configure(const CString& FileName) { bool result = true; // if (m_AliasesEnabled) { m_VerboseMode = PSC().VarDefined(GPM_VAR_NAME_VERBOSE_ALIAS); m_QuietMode = PSC().VarDefined(GPM_VAR_NAME_QUIET_ALIAS); m_HelpMode = PSC().VarDefined(GPM_VAR_NAME_HELP_ALIAS); } else { m_VerboseMode = PSC().VarDefined(GPM_VAR_NAME_VERBOSE); m_QuietMode = PSC().VarDefined(GPM_VAR_NAME_QUIET); m_HelpMode = PSC().VarDefined(GPM_VAR_NAME_HELP); } //PSC().ProcessParameters(m_ParameterString); if ((FileName.GetLength()>0)&&(FileExists(FileName.GetString()))) { CFG().LoadFromFile(FileName); } else { result = false; } if (PSC().VarDefined(GPM_VAR_NAME_LIST)) { ILST().Clear(); ILST().LoadFromFile(PSC().VarNamed(GPM_VAR_NAME_IN).GetString()); } else if (PSC().VarDefined(GPM_VAR_NAME_IN)) { ILST().Clear(); ILST().Insert(PSC().VarNamed(GPM_VAR_NAME_IN).GetString()); } return result; } int CGenericProcessingMachine::SetFileNameLength(const int FileNameLength) { m_FileNameLength = std::max(FileNameLength,1); return m_FileNameLength; } CString CGenericProcessingMachine::TargetName(const int FileIndex, const CString& SourceFileName) { return EnumStr("",FileIndex,".out",m_FileNameLength); } bool CGenericProcessingMachine::ProcessFile(const CString& SourceFileName, CString& TargetFileName) { // override this function // return true; } bool CGenericProcessingMachine::PreProcess(void) { // override this function // return true; } bool CGenericProcessingMachine::Run(void) { if (!PreProcess()) return false; // bool result = true; CString source_directory; CString target_directory; if (PSC().VarDefined(GPM_VAR_NAME_INDIR)) { source_directory = CheckLastChar(PSC().VarNamed(GPM_VAR_NAME_INDIR).GetString(),'/'); PSC().VarNamed(GPM_VAR_NAME_INDIR).SetString(source_directory); } if (PSC().VarDefined(GPM_VAR_NAME_OUTDIR)) { target_directory = CheckLastChar(PSC().VarNamed(GPM_VAR_NAME_OUTDIR).GetString(),'/'); PSC().VarNamed(GPM_VAR_NAME_OUTDIR).SetString(target_directory); } bool do_rename_outfile = ((!PSC().VarDefined(GPM_VAR_NAME_LIST))&&(PSC().VarDefined(GPM_VAR_NAME_OUT))); bool do_create_outlist = ((PSC().VarDefined(GPM_VAR_NAME_LIST))&&(PSC().VarDefined(GPM_VAR_NAME_OUT))); //if ((ILST().GetCount()>1)||(!PSC().VarDefined(GPM_VAR_NAME_OUT))) for (int i = 0; i < ILST().GetCount(); i++) { m_FileIndex = i; if (ILST().GetString(i).GetLength()==0) continue; CString source_file_name = source_directory + ILST().GetString(i); CString target_name = TargetName(i,ILST().GetString(i)); if (do_rename_outfile) { target_name = PSC().VarNamed(GPM_VAR_NAME_OUT).GetString(); } CString target_file_name = target_directory + target_name; result = result && ProcessFile(source_file_name,target_file_name); if (!target_file_name.IsEmpty()) { OLST().Insert(target_name); } } if (do_create_outlist) { OLST().SaveToFile(PSC().VarNamed(GPM_VAR_NAME_OUT).GetString()); } // result = result && PostProcess(); return result; } bool CGenericProcessingMachine::PostProcess(void) { // override this function // return true; } void CGenericProcessingMachine::Finalize(void) { } /* CGenericProcessingMachine::CGenericProcessingMachine(void) { } CGenericProcessingMachine::~CGenericProcessingMachine(void) { } */ //------------------------------------------------------------------------------ cbp2make-147+dfsg/lib/stlfutils.h0000644000175000017500000000511212155022124016613 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #ifndef STL_FUTILS_H #define STL_FUTILS_H //------------------------------------------------------------------------------ #include "macros.h" #ifdef OS_WIN #include #endif //------------------------------------------------------------------------------ #include "stlstrings.h" //------------------------------------------------------------------------------ char PathDelimiter(void); CString NativePathDelimiter(void); CString ChangeFileExt(const CString& FileName, const CString& FileExt); CString ExtractFilePath(const CString& FilePathName); CString ExtractFileName(const CString& FilePathName); CString ExtractFileExt(const CString& FilePathName); void SplitFilePathName(const CString& FilePathName, CString& FilePath, CString& FileName, CString& FileExt); CString MakeUnixPath(const CString& FilePathName); CString MakeWindowsPath(const CString& FilePathName); CString MakeNativePath(const CString& FilePathName); CString RemoveLeadingPathDelimiter(const CString& FilePathName); CString IncludeLeadingPathDelimiter(const CString& FilePathName); CString RemoveTrailingPathDelimiter(const CString& FilePathName); CString IncludeTrailingPathDelimiter(const CString& FilePathName); CString QuoteSpaces(const CString& FilePathName, const int QuoteMode = 0); CString JoinPaths(const CString& HeadPath, const CString& TailPath, const char Separator = PathDelimiter()); bool FileExists(const CString& FileName); bool DirExists(const CString& FileName); bool MakeDir(const CString& DirPath, int DirMode = 0755); CString RootDirPath(void); CString HomeDirPath(void); CString TempDirPath(void); CString GetCurrentDir(void); bool ChangeDir(const CString& DirPath); //------------------------------------------------------------------------------ #endif cbp2make-147+dfsg/lib/doc/0000755000175000017500000000000012305647115015171 5ustar moellermoellercbp2make-147+dfsg/lib/doc/stringhash.dox0000644000175000017500000002155612143137414020064 0ustar moellermoeller/* Collection of non-cryptographic string hashing functions. All documentation is Public Domain. */ /*! \file stringhash.h \brief Non-cryptographic string hash functions. */ /*! \typedef data_t \brief Type of element of input array of a hash function. */ /*! \typedef hash_t \brief Type of hash function result. */ /*! \fn add_hash(const data_t *data, const size_t size) \brief Additive hash. \param data input array (string). \param size size of input array. \return hash digest. Probably the simplest algorithm for hashing a sequence of integral values (such as a string), is to add all of the characters together and then force the range into something suitable for lookup with the remainder of division. I will give an example of this algorithm only because books commonly suggest it in their rush to get past the topic of hash functions on their way to collision resolution methods. This algorithm is very bad. Generally, any hash algorithm that relies primarily on a commutitive operation will have an exceptionally bad distribution. This hash fails to treat permutations differently, so “abc”, “cba”, and “cab” will all result in the same hash value. Despite the suckiness of this algorithm, the example is useful in that it shows how to create a general hash function. add_hash can be used to hash strings, single integers, single floating-point values, arrays of scalar values, and just about anything else you can think of because it is always legal to pun a simple object into an array of unsigned char and work with the individual bytes of the object. */ /*! \fn xor_hash(const data_t *data, const size_t size) \brief XOR hash. \param data input array (string). \param size size of input array. \return hash digest. The XOR hash is another algorithm commonly suggested by textbooks. Instead of adding together the bytes of an object as the additive hash does, the XOR hash repeatedly folds the bytes together to produce a seemingly random hash value. Unfortunately, this algorithm is too simple to work properly on most input data. The internal state, the variable h, is not mixed nearly enough to come close to achieving avalanche, nor is a single XOR effective at permuting the internal state, so the resulting distribution, while better than the additive and multiplicative hashes, is still not very good. */ /*! \fn rot_hash(const data_t *data, const size_t size) \brief Rotating hash. \param data input array (string). \param size size of input array. \return hash digest. The rotating hash is identical to the XOR hash except instead of simply folding each byte of the input into the internal state, it also performs a fold of the internal state before combining it with the each byte of the input. This extra mixing step is enough to give the rotating hash a much better distribution. Much of the time, the rotating hash is sufficient, and can be considered the minimal acceptable algorithm. Notice that with each improvement, the internal state is being mixed up more and more. This is a key element in a good hash function. */ /*! \fn djb_hash(const data_t *data, const size_t size) \brief Bernstein hash. \param data input array (string). \param size size of input array. \return hash digest. Professor Dan Bernstein created this algorithm and posted it in a comp.lang.c newsgroup. It is known by many as the Chris Torek hash because Chris went a long way toward popularizing it. Since then it has been used successfully by many, but despite that the algorithm itself is not very sound when it comes to avalanche and permutation of the internal state. It has proven very good for small character keys, where it can outperform algorithms that result in a more random distribution. Bernstein's hash should be used with caution. It performs very well in practice, for no apparently known reasons (much like how the constant 33 does better than more logical constants for no apparent reason), but in theory it is not up to snuff. Always test this function with sample data for every application to ensure that it does not encounter a degenerate case and cause excessive collisions. */ /*! \fn djb2_hash(const data_t *data, const size_t size); \brief Modified Bernstein hash. \param data input array (string). \param size size of input array. \return hash digest. A minor update to Bernstein's hash replaces addition with XOR for the combining step. This change does not appear to be well known or often used, the original algorithm is still recommended by nearly everyone, but the new algorithm typically results in a better distribution. */ /*! \fn sax_hash(const data_t *data, const size_t size) \brief Shift-Add-XOR hash. \param data input array (string). \param size size of input array. \return hash digest. The shift-add-XOR hash was designed as a string hashing function, but because it is so effective, it works for any data as well with similar efficiency. The algorithm is surprisingly similar to the rotating hash except a different choice of constants for the rotation is used, and addition is a preferred operation for mixing. All in all, this is a surprisingly powerful and flexible hash. Like many effective hashes, it will fail tests for avalanche, but that does not seem to affect its performance in practice. */ /*! \fn fnv_hash(const data_t *data, const size_t size) \brief FNV hash. \param data input array (string). \param size size of input array. \return hash digest. The FNV hash, short for Fowler/Noll/Vo in honor of the creators, is a very powerful algorithm that, not surprisingly, follows the same lines as Bernstein's modified hash with carefully chosen constants. This algorithm has been used in many applications with wonderful results, and for its simplicity, the FNV hash should be one of the first hashes tried in an application. */ /*! \fn oat_hash(const data_t *data, const size_t size) \brief One-at-a-Time hash. \param data input array (string). \param size size of input array. \return hash digest. Bob Jenkins is a well known authority on designing hash functions for table lookup. In fact, one of his hashes is considered state of the art for lookup, which we will see shortly. A considerably simpler algorithm of his design is the One-at-a-Time hash. This algorithm quickly reaches avalanche and performs very well. This function is another that should be one of the first to be tested in any application, if not the very first. This algorithm has seen effective use in several high level scripting languages as the hash function for their associative array data type. */ /*! \fn jsw_hash(const data_t *data, const size_t size, const hash_t *magic) \brief JSW hash. \param data input array (string). \param size size of input array. \param magic table of random numbers. \return hash digest. This is a hash of my own devising that combines a rotating hash with a table of randomly generated numbers. The algorithm walks through each byte of the input, and uses it as an index into a table of random integers generated by a good random number generator. The internal state is rotated to mix it up a bit, then XORed with the random number from the table. The result is a uniform distribution if the random numbers are uniform. The size of the table should match the values in a byte. For example, if a byte is eight bits then the table would hold 256 random numbers. */ /*! \fn elf_hash(const data_t *data, const size_t size) \brief ELF hash. \param data input array (string). \param size size of input array. \return hash digest. The ELF hash function has been around for a while, and it is believed to be one of the better algorithms out there. In my experience, this is true, though ELF hash does not perform sufficiently better than most of the other algorithms presented in this tutorial to justify its slightly more complicated implementation. It should be on your list of first functions to test in a new lookup implementation. */ /*! \fn jen_hash(const data_t *data, const size_t size, const hash_t magic) \brief Jenkins hash. \param data input array (string). \param size size of input array. \param magic a random number. \return hash digest. The dreaded Jenkins hash has been thoroughly tested and passes all kinds of tests for avalanche and permutations. As such it is considered to be one of the best and most thoroughly analyzed algorithms. Unfortunately, it is also ridiculously complicated compared to the other hashes. */ /*! \fn sdbm_hash(const data_t *data, const size_t size) \brief Public-domain reimplementation of NDBM hash. \param data input array (string). \param size size of input array. \return hash digest. */ //------------------------------------------------------------------------------ cbp2make-147+dfsg/lib/doc/macros.dox0000644000175000017500000000405712155022124017165 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /*! \file macros.h \brief Base definitions and macros. */ /*! \def OS_MAC \brief This macro is set if at compile-time the platform is Apple MacOS. */ /*! \def OS_WIN \brief This macro is set if at compile-time the platform is Microsoft Windows. */ /*! \def OS_UNIX \brief This macro is set if at compile-time the platform is UNIX-like (GNU/Linux etc). */ /*! \def SHOW_MODE_ONELINE \brief Allows compact style for verbose message output. */ /*! \def TARGET_WDIR_ENABLED \brief Allows changing working directories for individual build targets. */ /*! \def NOMINMAX \brief Indicates that standard min() and max() template functions are declared. */ /*! \namespace std \brief Namespace of C++ standard library. */ /*! \fn std::min (T1 const& a, T2 const& b) \brief Returns minimal of two arguments. \param a first argument. \param b second argument. \return minimal of two arguments, type of result is defined by the first argument. */ /*! \fn std::max (T1 const& a, T2 const& b) \brief Returns maximal of two arguments. \param a first argument. \param b second argument. \return maximal of two arguments, type of result is defined by the first argument. */ //------------------------------------------------------------------------------ cbp2make-147+dfsg/lib/stlvariables.cpp0000644000175000017500000002535012155022125017617 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #include "stlvariables.h" //------------------------------------------------------------------------------ int CVariable::GetType(void) const { return VARIABLE_TYPE_NONE; } CString CVariable::GetTypeName(void) const { return ""; } CString& CVariable::GetName(void) { return m_Name; } void CVariable::SetName(const CString& Name) { m_Name = Name; } double CVariable::GetFloat(void) const { return 0.0; } void CVariable::SetFloat(const double Value) { // do nothing // } int CVariable::GetInteger(void) const { return 0; } void CVariable::SetInteger(const int Value) { // do nothing // } bool CVariable::GetBoolean(void) const { return 0; } void CVariable::SetBoolean(const bool Value) { // do nothing // } CString CVariable::GetString(void) const { return CString(); } void CVariable::SetString(const CString& Value) { // do nothing // } char CVariable::GetChar(void) const { return char(0); } void CVariable::SetChar(const char Value) { // do nothing // } void CVariable::Print(std::ostream& out) { out<. */ //------------------------------------------------------------------------------ #ifndef MACROS_H #define MACROS_H //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ #if defined(_APPLE_) || defined(_MACH_) #define OS_MAC #endif #if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) #define OS_WIN #endif #ifndef OS_MAC #ifndef OS_WIN #define OS_UNIX #endif #endif #define SHOW_MODE_ONELINE //#define TARGET_WDIR_ENABLED #ifndef NOMINMAX #define NOMINMAX namespace std { template inline T1 const& min (T1 const& a, T2 const& b) { return (((a)<(b))?(a):(b)); } template inline T1 const& max (T1 const& a, T2 const& b) { return (((a)>(b))?(a):(b)); } } #endif #endif //------------------------------------------------------------------------------ cbp2make-147+dfsg/lib/stlconfig.h0000644000175000017500000000777212155022125016571 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #ifndef STL_CONFIG_H #define STL_CONFIG_H //------------------------------------------------------------------------------ #include "stlvariables.h" //------------------------------------------------------------------------------ class CConfiguration { protected: CVariable m_NullVariable; std::vector m_Variables; CString m_DefinedPrefix; protected: bool ValidIndex(const int Index) const; public: virtual void Initialize(void) {}; virtual void Clear(void); int GetCount(void) const; CString& DefinedPrefix(void) { return m_DefinedPrefix; } CString DefinedPrefix(void) const { return m_DefinedPrefix; } bool VarDefined(const CString& Name) const; void SetDefined(const CString& Name); void SetUndefined(const CString& Name); CVariable& Variable(const int Index); CVariable& VarNamed(const CString& Name); int VarIndex(const CString& Name) const; int InsertIntegerVariable(const CString& Name, const int Value=0); int InsertFloatVariable(const CString& Name, const double Value=0.0); int InsertBooleanVariable(const CString& Name, const bool Value=false); int InsertStringVariable(const CString& Name, const CString& Value=""); int InsertCharVariable(const CString& Name, const char Value=char(0)); void RemoveVariable(const int Index); void RemoveVariable(const CString& Name); void SetIntegerVariable(const CString& Name, const int Value); void SetFloatVariable(const CString& Name, const double Value); void SetBooleanVariable(const CString& Name, const bool Value); void SetStringVariable(const CString& Name, const CString& Value); void SetCharVariable(const CString& Name, const char Value); void Print(std::ostream& out); void ProcessParameters(int argc, char* argv[]); void LoadFromFile(const CString& FileName); void SaveToFile(const CString& FileName); public: CConfiguration(void); virtual ~CConfiguration(void); }; class CParameterString { protected: CString m_NullParameter; CStringList m_Parameters; public: void SetParameters(int argc, char* argv[]); void SetParameters(const CString& Parameters); void SetParameters(const CParameterString& Parameters); void AddParameters(const CString& Parameters); void AddParameters(const CParameterString& Parameters); int GetCount(void) const { return m_Parameters.GetCount(); } CString Parameter(const int Index) const; virtual void Print(std::ostream& out) {}; public: CParameterString(int argc, char* argv[]); CParameterString(const CString& Parameters); CParameterString(void); virtual ~CParameterString(void); }; class CParameterStringConfiguration: public CConfiguration { protected: CString m_DefinedPrefix; public: CString& DefinedPrefix(void) { return m_DefinedPrefix; } bool VarDefined(const CString& Name); void SetDefined(const CString& Name); void SetUndefined(const CString& Name); void ProcessParameters(const CParameterString& Parameters); void ProcessParameters(const CString& Parameters); public: CParameterStringConfiguration(void) { m_DefinedPrefix = '~'; }; virtual ~CParameterStringConfiguration(void) {}; }; #endif //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/0000755000175000017500000000000012155022233014434 5ustar moellermoellercbp2make-147+dfsg/src/cbproject.cpp0000644000175000017500000014171712155022124017125 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #include //------------------------------------------------------------------------------ #include "revision.h" #include "macros.h" #include "cbproject.h" #include "cbptarget.h" #include "cbpunit.h" #include "cbbuildcfg.h" #include "cbhelper.h" #include "stlconvert.h" #include "stlfutils.h" #include "depsearch.h" #include "tinyxml.h" //------------------------------------------------------------------------------ CCodeBlocksProject::CCodeBlocksProject(void) { Clear(); } CCodeBlocksProject::~CCodeBlocksProject(void) { Clear(); } void CCodeBlocksProject::Clear(void) { //m_ValidProject = false; m_VersionMajor = 0; m_VersionMinor = 0; m_Title.Clear(); m_DefaultTarget.Clear(); m_Compiler.Clear(); m_ExtendedObjectNames = false; m_CompilerOptions.Clear(); m_CompilerDirectories.Clear(); m_ResourceCompilerDirectories.Clear(); m_LinkerOptions.Clear(); m_LinkerLibraries.Clear(); m_LinkerDirectories.Clear(); m_BeforeBuildCommands.Clear(); m_AfterBuildCommands.Clear(); m_ForceBeforeBuildCommands = false; m_ForceAfterBuildCommands = false; m_Platforms.Clear(); m_SinglePlatform = true; m_BuildTargetIndex.clear(); m_VirtualTargetIndex.clear(); m_UnitIndex.clear(); m_ToolChainIndex.clear(); //m_MakefileText.Clear(); m_Makefile.Clear(); for (size_t i = 0; i < m_BuildTargets.size(); i++) delete m_BuildTargets[i]; for (size_t i = 0; i < m_VirtualTargets.size(); i++) delete m_VirtualTargets[i]; for (size_t i = 0; i < m_Units.size(); i++) delete m_Units[i]; // m_BuildTargets.clear(); m_VirtualTargets.clear(); m_Units.clear(); } void CCodeBlocksProject::Read(const TiXmlElement *ProjectRoot) { const TiXmlNode *_version = ProjectRoot->FirstChild("FileVersion"); if (0!=_version) { const TiXmlElement *version = _version->ToElement(); if (0!=version) { version->QueryIntAttribute("major",&m_VersionMajor); version->QueryIntAttribute("minor",&m_VersionMinor); }} // file version const TiXmlNode *_project = ProjectRoot->FirstChild("Project"); if (0!=_project) { TiXmlNode *_option = (TiXmlNode *)_project->FirstChild("Option"); while (0!=_option) { TiXmlElement* option = _option->ToElement(); if (0!=option) { char *value = 0; if ((value = (char *)option->Attribute("title"))) { m_Title = value; } if ((value = (char *)option->Attribute("default_target"))) { m_DefaultTarget = value; } if ((value = (char *)option->Attribute("compiler"))) { m_Compiler = value; } if ((value = (char *)option->Attribute("extended_obj_names"))) { m_ExtendedObjectNames = StringToBoolean(value); } } _option = (TiXmlNode *)_project->IterateChildren(_option); } // option TiXmlNode *_build = (TiXmlNode *)_project->FirstChild("Build"); if (0!=_build) { TiXmlNode *_target = (TiXmlNode *)_build->FirstChild("Target"); while (0!=_target) { TiXmlElement* target = _target->ToElement(); if (strcmp(target->Value(),"Target")) break; if (0!=target) { CBuildTarget *build_target = new CBuildTarget(); build_target->Read(target); m_BuildTargets.push_back(build_target); } _target = (TiXmlNode *)_build->IterateChildren(_target); } // target TiXmlNode *_env = (TiXmlNode *)_build->FirstChild("Environment"); if (0!=_env) { TiXmlElement* env = _env->ToElement(); if (0!=env) { TiXmlNode *_var = (TiXmlNode *)_env->FirstChild("Variable"); while (0!=_var) { TiXmlElement* var = _var->ToElement(); if (0!=var) { char *value = 0; CString env_name, env_value; if ((value = (char *)var->Attribute("name"))) { env_name = value; } if ((value = (char *)var->Attribute("value"))) { env_value = value; } m_Environment.InsertStringVariable(env_name,env_value); } _var = (TiXmlNode *)_env->IterateChildren(_var); } } // variable } // environment } // build TiXmlNode *_vtarget = (TiXmlNode *)_project->FirstChild("VirtualTargets"); if (0!=_vtarget) { TiXmlElement *vtarget = _vtarget->ToElement(); if (0!=vtarget) { TiXmlNode *_option = (TiXmlNode *)_vtarget->FirstChild("Add"); while (0!=_option) { TiXmlElement* option = _option->ToElement(); if (0!=option) { CVirtualTarget *v_target = new CVirtualTarget(); v_target->Read(option); m_VirtualTargets.push_back(v_target); } _option = (TiXmlNode *)_vtarget->IterateChildren(_option); } // option } } // vtargets TiXmlNode *_compiler = (TiXmlNode *)_project->FirstChild("Compiler"); if (0!=_compiler) { TiXmlNode *_option = (TiXmlNode *)_compiler->FirstChild("Add"); while (0!=_option) { TiXmlElement* option = _option->ToElement(); if (0!=option) { char *value = 0; if ((value = (char *)option->Attribute("option"))) { m_CompilerOptions.Insert(value); } if ((value = (char *)option->Attribute("directory"))) { m_CompilerDirectories.Insert(value); } } _option = (TiXmlNode *)_compiler->IterateChildren(_option); } // option } // compiler TiXmlNode *_res_compiler = (TiXmlNode *)_project->FirstChild("ResourceCompiler"); if (0!=_res_compiler) { TiXmlNode *_option = (TiXmlNode *)_res_compiler->FirstChild("Add"); while (0!=_option) { TiXmlElement* option = _option->ToElement(); if (0!=option) { char *value = 0; if ((value = (char *)option->Attribute("directory"))) { m_ResourceCompilerDirectories.Insert(value); } } _option = (TiXmlNode *)_res_compiler->IterateChildren(_option); } // option } // resource compiler TiXmlNode *_linker = (TiXmlNode *)_project->FirstChild("Linker"); if (0!=_linker) { TiXmlNode *_option = (TiXmlNode *)_linker->FirstChild("Add"); while (0!=_option) { TiXmlElement* option = _option->ToElement(); if (0!=option) { char *value = 0; if ((value = (char *)option->Attribute("option"))) { m_LinkerOptions.Insert(value); } if ((value = (char *)option->Attribute("directory"))) { m_LinkerDirectories.Insert(value); } if ((value = (char *)option->Attribute("library"))) { m_LinkerLibraries.Insert(value); } } _option = (TiXmlNode *)_linker->IterateChildren(_option); } // option } // linker TiXmlNode *_extra_cmd = (TiXmlNode *)_project->FirstChild("ExtraCommands"); if (0!=_extra_cmd) { TiXmlNode *_option = (TiXmlNode *)_extra_cmd->FirstChild("Add"); while (0!=_option) { TiXmlElement* option = _option->ToElement(); if (0!=option) { if (strcmp(option->Value(),"Add")) break; char *value = 0; if ((value = (char *)option->Attribute("before"))) { m_BeforeBuildCommands.Insert(value); } if ((value = (char *)option->Attribute("after"))) { m_AfterBuildCommands.Insert(value); } } _option = (TiXmlNode *)_extra_cmd->IterateChildren(_option); } // option _option = (TiXmlNode *)_extra_cmd->FirstChild("Mode"); while (0!=_option) { TiXmlElement* option = _option->ToElement(); if (0!=option) { if (strcmp(option->Value(),"Mode")) break; char *value = 0; if ((value = (char *)option->Attribute("before"))) { m_ForceBeforeBuildCommands = (strcmp(value,"always")==0); } if ((value = (char *)option->Attribute("after"))) { m_ForceAfterBuildCommands = (strcmp(value,"always")==0); } } _option = (TiXmlNode *)_extra_cmd->IterateChildren(_option); } // option } // extra commands TiXmlNode *_unit = (TiXmlNode *)_project->FirstChild("Unit"); while (0!=_unit) { TiXmlElement* unit = _unit->ToElement(); if (0!=unit) { if (strcmp(unit->Value(),"Unit")) break; CBuildUnit *build_unit = new CBuildUnit(); build_unit->Read(unit); m_Units.push_back(build_unit); } _unit = (TiXmlNode *)_project->IterateChildren(_unit); } // unit } // project // add default target if project has no targets if (m_BuildTargets.size()==0) { CBuildTarget *target = new CBuildTarget(); m_BuildTargets.push_back(target); } // generate object names for units /* for (size_t i = 0; i < m_Units.size(); i++) { if (m_ExtendedObjectNames) { m_Units[i]->m_ObjectFileName = m_Units[i]->m_FileName+".o"; } else { m_Units[i]->m_ObjectFileName = ChangeFileExt(m_Units[i]->m_FileName,".o"); } } */ // sort units by weight SortUnitsByWeight(); } bool CCodeBlocksProject::LoadProject(const CString& FileName) { bool result = false; TiXmlDocument cbp; result = cbp.LoadFile(FileName.GetCString()); if (!result) return false; Clear(); const TiXmlElement *root = cbp.RootElement(); if (0==strcmp(root->Value(),"CodeBlocks_project_file")) { Read(root); result = true; } // root value return result; } /* void CCodeBlocksProject::DecorateTargetNames(void) { for (int i = 0, n = m_BuildTargets.size(); i < n; i++) { CBuildTarget *target = m_BuildTargets[i]; CString name = DecorateTargetName(target->m_Title); target->UCName() = UpperCase(name); target->LCName() = LowerCase(name); CString path = RemoveTrailingPathDelimiter(target->ObjectOutput()); target->ObjectOutput() = path; } for (int i = 0, n = m_VirtualTargets.size(); i < n; i++) { CVirtualTarget *target = m_VirtualTargets[i]; CString name = DecorateTargetName(target->m_Alias); target->UCName() = UpperCase(name); target->LCName() = LowerCase(name); } } */ class CUnitWeightComparison { public: bool operator ()(CBuildUnit *const &AUnit, CBuildUnit *const &BUnit) { return (AUnit->m_Weight < BUnit->m_Weight); } }; void CCodeBlocksProject::SortUnitsByWeight(void) { /*for (int i = 0, n = m_Units.size(); i < n; i++) { std::cout<m_Filename.GetString()<<","<m_Weight<m_Filename.GetString()<<","<m_Weight<Show(); } std::cout<<"Virtual targets: "<Show(); } std::cout<<"Units: "<Show(); } ShowStringList("Before-build commands","Command",m_BeforeBuildCommands); std::cout<<"Force before-build commands: " <Name(); // add all targets for current platform to index for (int i = 0, n = m_BuildTargets.size(); i < n; i++) { CBuildTarget *target = m_BuildTargets[i]; CStringList platforms = target->Platforms(); bool target_compatible = ((platforms.GetCount()==0) || ((platforms.GetCount()>0) && (platforms.FindString(platform_name)>=0))); bool target_selected = ((Config.Targets().GetCount()==0) || ((Config.Targets().GetCount()>0) && (Config.Targets().FindString(target->Title())>=0))); // check if selected target is a virtual target bool vtarget_selected = false; if (Config.Targets().GetCount()>0) { for (int j = 0, nj = m_VirtualTargets.size(); j < nj; j++) { CVirtualTarget *v_target = m_VirtualTargets[j]; if (Config.Targets().FindString(v_target->Alias())>=0) { if (v_target->Targets().FindString(target->Title())>=0) { vtarget_selected = true; } } } } bool add_target = target_compatible && (target_selected || vtarget_selected); // add target to build targets if it is selected if (add_target) { m_BuildTargetIndex.push_back(target); } } // add all virtual targets containing valid targets to index for (int i = 0, ni = m_VirtualTargets.size(); i < ni; i++) { bool done = false; CVirtualTarget *v_target = m_VirtualTargets[i]; for (int j = 0, nj = v_target->Targets().GetCount(); j < nj; j++) { for (int k = 0, nk = m_BuildTargetIndex.size(); k < nk; k++) { CBuildTarget *target = m_BuildTargetIndex[k]; if (target->Title() == v_target->Targets().GetString(j)) { m_VirtualTargetIndex.push_back(v_target); done = true; break; } } if (done) break; } if (done) break; } // collect unique toolchains for all targets Config.ToolChains().Lock(); // m_TargetToolChainIndex.clear(); CStringList tc_names; tc_names.Insert(m_Compiler); for (int j = 0, nj = m_BuildTargetIndex.size(); j < nj; j++) { CBuildTarget *target = m_BuildTargetIndex[j]; tc_names.Insert(target->Compiler()); } tc_names.RemoveEmpty(); tc_names.RemoveDuplicates(); // add all uniqie toolchains to index for (int j = 0, nj = tc_names.GetCount(); j < nj; j++) { CPlatform::OS_Type platform = Config.Platforms().Platform(Platform)->OS(); for (int i = 0, ni = Config.ToolChains().GetCount(platform); i < ni; i++) { CToolChain *tc = Config.ToolChains().ToolChain(platform,i); if (tc->Alias() == tc_names[j]) { //std::cout<<"unique toolchain index = "<Title().GetCString()<BelongToTarget(target->Title())) { //std::cout<<"+++ Unit #"<<(i+1)<<" "<FileName().GetCString() // <<" belongs to target "<Title().GetCString()<FileName().GetCString() // <<" does not belong to target "<Title().GetCString()<Alias(),Config.MacroVariableCase()); } } return tc_suffix; } bool CCodeBlocksProject::GenerateMakefile (const CString& FileName, CCodeBlocksBuildConfig& Config) { m_Dependencies.Clear(); // setup decorated target names //DecorateTargetNames(); for (size_t i = 0; i < m_BuildTargets.size(); i++) { m_BuildTargets[i]->NameCase() = Config.TargetNameCase(); } for (size_t i = 0; i < m_VirtualTargets.size(); i++) { m_VirtualTargets[i]->NameCase() = Config.TargetNameCase(); } // int active_platforms = 0; for (size_t pi = 0, pn = Config.Platforms().GetCount(); pi < pn; pi++) { if (Config.Platforms().Platform(pi)->Active()) active_platforms++; } m_SinglePlatform = (1==active_platforms); // CString cwd = GetCurrentDir(); for (size_t pi = 0, pn = Config.Platforms().GetCount(); pi < pn; pi++) { CPlatform *pl = Config.Platforms().Platform(pi); if (!pl->Active()) continue; CString makefile_path = ExtractFilePath(FileName); CString makefile_name = ExtractFileName(FileName); CString platform_name = pl->Name(); if (!m_SinglePlatform) makefile_name += "."+LowerCase(platform_name); UpdatePlatformIndex(pi,Config); if (!makefile_path.IsEmpty()) { ChangeDir(makefile_path); } m_Dependencies.Platform() = *pl; CConfiguration cmd_args; // begin makefile m_Makefile.Clear(); int section = 0; // head comment const int header_width = 80; m_Makefile.Header().Insert(FillStr("#",'-',"#",header_width)); #ifdef REVISION_NUMBER { CString rn = IntegerToString(REVISION_NUMBER); CString line = FillStr("# This makefile was generated by 'cbp2make' tool rev."+rn,' ',"#",header_width); m_Makefile.Header().Insert(line); } #else CString line = FillStr("# This makefile was generated by 'cbp2make' tool rev.",' ',"#",header_width) #endif m_Makefile.Header().Insert(FillStr("#",'-',"#",header_width)); m_Makefile.Header().Insert(""); section++; // standard macros CString STR_WRKDIR = DecorateVariableName("WorkDir",Config.MacroVariableCase()); CString STR_INC = DecorateVariableName("Inc",Config.MacroVariableCase()); CString STR_LIB = DecorateVariableName("Lib",Config.MacroVariableCase()); CString STR_DEP = DecorateVariableName("Dep",Config.MacroVariableCase()); CString STR_OBJ = DecorateVariableName("Obj",Config.MacroVariableCase()); CString STR_OUT = DecorateVariableName("Out",Config.MacroVariableCase()); CString STR_CFLAGS = DecorateVariableName("CFlags",Config.MacroVariableCase()); CString STR_RCFLAGS = DecorateVariableName("RCFlags",Config.MacroVariableCase()); CString STR_LDFLAGS = DecorateVariableName("LDFlags",Config.MacroVariableCase()); CString STR_RESINC = DecorateVariableName("ResInc",Config.MacroVariableCase()); CString STR_LIBDIR = DecorateVariableName("LibDir",Config.MacroVariableCase()); CString STR_OBJDIR = DecorateVariableName("ObjDir",Config.MacroVariableCase()); // macros CString line = pl->EvalWorkDir(); m_Makefile.AddMacro(STR_WRKDIR,line,section); section++; // declare environment variables if (m_Environment.GetCount()) { for (int i = 0; i < m_Environment.GetCount(); i++) { m_Makefile.AddEnvVar(m_Environment.Variable(i).GetName(), m_Environment.Variable(i).GetString(),section); } } section++; // declare global compiler variables for (size_t i = 0; i < Config.GlobalVariables().Count(); i++) { CGlobalVariableSet *vset = Config.GlobalVariables().Get(i); if (0!=vset) if (vset->Active()) { for (size_t j = 0; j < vset->Count(); j++) { CGlobalVariable *v = vset->Get(j); m_Makefile.AddMacro(DecorateVariableName(v->Name(), Config.MacroVariableCase()),v->Convert(v->Base()),section); m_Makefile.AddMacro(DecorateVariableName(v->Name()+".include", Config.MacroVariableCase()),v->Convert(v->Include()),section); m_Makefile.AddMacro(DecorateVariableName(v->Name()+".lib", Config.MacroVariableCase()),v->Convert(v->Lib()),section); m_Makefile.AddMacro(DecorateVariableName(v->Name()+".obj", Config.MacroVariableCase()),v->Convert(v->Obj()),section); m_Makefile.AddMacro(DecorateVariableName(v->Name()+".cflags", Config.MacroVariableCase()),v->Convert(v->Cflags()),section); m_Makefile.AddMacro(DecorateVariableName(v->Name()+".lflags", Config.MacroVariableCase()),v->Convert(v->Lflags()),section); for (int k = 0; k < v->Count(); k++) { m_Makefile.AddMacro(DecorateVariableName(v->Name()+"."+v->GetField(k), Config.MacroVariableCase()),v->Convert(v->GetValue(k)),section); }}} section++; } // make variables of build tools //int tc_section = section;//unused bool single_toolchain = (m_ToolChainIndex.size()==1); for (size_t i = 0; i < m_ToolChainIndex.size(); i++) { CToolChain *tc = m_ToolChainIndex[i]; CString tc_suffix = ToolChainSuffix(i,Config); for (size_t j = 0; j < tc->ToolsCount(); j++) { CBuildTool *bt = tc->GetBuildTool(j); m_Makefile.AddMacro( DecorateVariableName(bt->MakeVariable()+tc_suffix,Config.MacroVariableCase()), bt->Program(),section); } section++; // base flags //pl->Show(); //tc->Show(); line.Clear(); for (int i = 0; i < m_CompilerDirectories.GetCount(); i++) { line = JoinStr(line,tc->IncludeDirSwitch()+pl->ProtectPath(pl->Pd(m_CompilerDirectories[i]),Config.QuotePathMode()),' '); } m_Makefile.AddMacro(STR_INC+tc_suffix,CGlobalVariable::Convert(line,Config.MacroVariableCase()),section); line.Clear(); for (int i = 0; i < m_CompilerOptions.GetCount(); i++) { line = JoinStr(line,m_CompilerOptions[i],' '); } m_Makefile.AddMacro(STR_CFLAGS+tc_suffix,CGlobalVariable::Convert(line,Config.MacroVariableCase()),section); m_Makefile.AddMacro(STR_RESINC+tc_suffix,"",section); //m_Makefile.AddMacro("RCFLAGS","",section);//not supported by CB build system line.Clear(); for (int i = 0; i < m_LinkerDirectories.GetCount(); i++) { line = JoinStr(line,tc->LibraryDirSwitch()+pl->ProtectPath(pl->Pd(m_LinkerDirectories[i]),Config.QuotePathMode()),' '); } m_Makefile.AddMacro(STR_LIBDIR+tc_suffix,CGlobalVariable::Convert(line,Config.MacroVariableCase()),section); line.Clear(); for (int i = 0; i < m_LinkerLibraries.GetCount(); i++) { CString lib_name = m_LinkerLibraries[i]; CString lib_ext = ExtractFileExt(lib_name); if (lib_ext.IsEmpty()) { line = JoinStr(line,tc->LinkLibrarySwitch()+pl->ProtectPath(pl->Pd(lib_name),Config.QuotePathMode()),' '); } else { line = JoinStr(line,pl->ProtectPath(pl->Pd(lib_name),Config.QuotePathMode()),' '); } } m_Makefile.AddMacro(STR_LIB+tc_suffix,CGlobalVariable::Convert(line,Config.MacroVariableCase()),section); line.Clear(); for (int i = 0; i < m_LinkerOptions.GetCount(); i++) { line = JoinStr(line,m_LinkerOptions[i],' '); } m_Makefile.AddMacro(STR_LDFLAGS+tc_suffix,CGlobalVariable::Convert(line,Config.MacroVariableCase()),section); section++; } // per-target flags for (size_t t = 0; t < m_BuildTargetIndex.size(); t++) { CBuildTarget *target = m_BuildTargetIndex[t]; int tc_id = m_TargetToolChainIndex[t]; //std::cout<<"target #"< toolchain #"<=(int)m_ToolChainIndex.size())) && !Config.BeQuiet()) { std::cout<<"Warning: toolchain '"<Compiler().GetCString()<<"' for target '" <Title().GetCString()<<"' is not defined."<Name(STR_INC+"_",Config.MacroVariableCase()), CGlobalVariable::Convert(pl->Pd(target->IncDirs("$("+STR_INC+tc_suffix+")",tc->IncludeDirSwitch())),Config.MacroVariableCase()),section); m_Makefile.AddMacro(target->Name(STR_CFLAGS+"_",Config.MacroVariableCase()), CGlobalVariable::Convert(pl->Pd(target->CFlags("$("+STR_CFLAGS+tc_suffix+")")),Config.MacroVariableCase()),section); m_Makefile.AddMacro(target->Name(STR_RESINC+"_",Config.MacroVariableCase()), CGlobalVariable::Convert(pl->Pd(target->ResDirs("$("+STR_RESINC+tc_suffix+")",tc->IncludeDirSwitch())),Config.MacroVariableCase()),section); m_Makefile.AddMacro(target->Name(STR_RCFLAGS+"_",Config.MacroVariableCase()), CGlobalVariable::Convert(pl->Pd(target->RCFlags("$("+STR_RCFLAGS+tc_suffix+")")),Config.MacroVariableCase()),section); m_Makefile.AddMacro(target->Name(STR_LIBDIR+"_",Config.MacroVariableCase()), CGlobalVariable::Convert(pl->Pd(target->LibDirs("$("+STR_LIBDIR+tc_suffix+")",tc->LibraryDirSwitch())),Config.MacroVariableCase()),section); m_Makefile.AddMacro(target->Name(STR_LIB+"_",Config.MacroVariableCase()), CGlobalVariable::Convert("$("+STR_LIB+tc_suffix+")"+pl->Pd(target->Libs(*pl,tc->LinkLibrarySwitch())),Config.MacroVariableCase()),section); m_Makefile.AddMacro(target->Name(STR_LDFLAGS+"_",Config.MacroVariableCase()), CGlobalVariable::Convert(pl->Pd(target->LdFlags("$("+STR_LDFLAGS+tc_suffix+")")),Config.MacroVariableCase()),section); line = pl->Pd(target->ObjectOutput()); if (target->ObjectOutput().IsEmpty()) line += ".objs"; m_Makefile.AddMacro(target->Name(STR_OBJDIR+"_",Config.MacroVariableCase()), CGlobalVariable::Convert( pl->ProtectPath(line,Config.QuotePathMode()),Config.MacroVariableCase()),section); m_Makefile.AddMacro(target->Name(STR_DEP+"_",Config.MacroVariableCase()),pl->Pd(target->ExtDeps()),section); CString target_output = target->Output(); if (CBuildTarget::ttCommands!=target->Type()) { if (target->AutoPrefix()) { //std::cout<<"target_output='"<Pd()+target->AutoFilePrefix(pl->OS())+name+ext; //std::cout<<"target_output_ap='"<AutoExtension()) { CString ext = target->AutoFileExtension(platform_name); //target_output = ChangeFileExt(target_output,ext); if (!ext.IsEmpty()) { target_output += "."+ext; } } m_Makefile.AddMacro(target->Name(STR_OUT+"_",Config.MacroVariableCase()), CGlobalVariable::Convert( pl->ProtectPath(pl->Pd(target_output),Config.QuotePathMode()), Config.MacroVariableCase()), section); } section++; } int target_objects_section = section; // common units // per-target units for (size_t t = 0; t < m_BuildTargetIndex.size(); t++) { CBuildTarget *target = m_BuildTargetIndex[t]; if (CBuildTarget::ttCommands==target->Type()) continue; section++; } bool have_global_commands = (m_BeforeBuildCommands.GetCount()>0) || (m_AfterBuildCommands.GetCount()>0); // default virtual targets CMakefileRule& rule_all = m_Makefile.AddRule (DecorateTargetName("all",Config.TargetNameCase()),section); for (size_t t = 0; t < m_BuildTargetIndex.size(); t++) { CBuildTarget *target = m_BuildTargetIndex[t]; if (have_global_commands) { rule_all.Dependencies().Insert(target->Name("build_")); } else { rule_all.Dependencies().Insert(target->Name("")); } } CMakefileRule& rule_clean = m_Makefile.AddRule (DecorateTargetName("clean",Config.TargetNameCase()),section); for (size_t t = 0; t < m_BuildTargetIndex.size(); t++) { CBuildTarget *target = m_BuildTargetIndex[t]; if (CBuildTarget::ttCommands!=target->Type()) { rule_clean.Dependencies().Insert(target->Name("clean_")); } } // global before-build commands if (have_global_commands)//(m_BeforeBuildCommands.GetCount()>0) { CString name = DecorateTargetName("before_build",Config.TargetNameCase()); CMakefileRule& rule = m_Makefile.AddRule(name,section); rule.Commands().Insert(m_BeforeBuildCommands); rule_all.Dependencies().InsertAt(0,name); } // global after-build commands if (have_global_commands)//(m_AfterBuildCommands.GetCount()>0) { CString name = DecorateTargetName("after_build",Config.TargetNameCase()); CMakefileRule& rule = m_Makefile.AddRule(name,section); rule.Commands().Insert(m_AfterBuildCommands); rule_all.Dependencies().Insert(name); } // build targets for (size_t t = 0; t < m_BuildTargetIndex.size(); t++) { CBuildTarget *target = m_BuildTargetIndex[t]; UpdateTargetIndex(t,Config); CStringList before_build_commands = target->BeforeBuildCommands(); CStringList after_build_commands = target->AfterBuildCommands(); // setup suffix for toolchain if there are more than one toolchain int tc_id = m_TargetToolChainIndex[t]; //std::cout<<"target #"< toolchain #"<=(int)m_ToolChainIndex.size())) && !Config.BeQuiet()) { std::cout<<"Warning: toolchain '"<Compiler().GetCString()<<"' for target '" <Title().GetCString()<<"' is not defined."<Name(STR_OUT+"_",Config.MacroVariableCase())+")"; CMakefileRule& rule_before = m_Makefile.AddRule(target->Name("before_"),section); CMakefileRule& rule_after = m_Makefile.AddRule(target->Name("after_"),section); CMakefileRule& rule_build_target = m_Makefile.AddRule(target->Name(""),section); //CMakefileRule& rule_target = rule_build_target; if (have_global_commands) { rule_build_target.Target() = target->Name("build_"); CMakefileRule& rule_target = m_Makefile.AddRule(target->Name(""),section); // global before-build commands if (have_global_commands)//(m_BeforeBuildCommands.GetCount()>0) { rule_target.Dependencies().Insert (DecorateTargetName("before_build",Config.TargetNameCase())); } rule_target.Dependencies().Insert(rule_build_target.Target()); // global after-build commands if (have_global_commands)//(m_AfterBuildCommands.GetCount()>0) { rule_target.Dependencies().Insert (DecorateTargetName("after_build",Config.TargetNameCase())); } } rule_build_target.Dependencies().Insert(target->Name("before_")); if (CBuildTarget::ttCommands!=target->Type()) { // output binary name may be exactly same for different targets // and shouldn't be used as makefile rule name //rule_target.Dependencies().Insert(target_out_name); rule_build_target.Dependencies().Insert(target->Name("out_")); } rule_build_target.Dependencies().Insert(target->Name("after_")); // before-build commands target if (before_build_commands.GetCount()) { #ifdef TARGET_WRKDIR_ENABLED if (!target->m_WorkingDirectory.IsEmpty()) { rule_before.Commands().Insert(pl->Cd()+" "+pl->Pd(target->m_WorkingDirectory)); } #endif rule_before.Commands().Insert(before_build_commands); } // after-build commands target if (after_build_commands.GetCount()) { rule_after.Commands().Insert(after_build_commands); #ifdef TARGET_WRKDIR_ENABLED if (!target->m_WorkingDirectory.IsEmpty()) { rule_after.Commands().Insert(pl->Cd()+" $("+STR_WRKDIR+")"); } #endif } if (CBuildTarget::ttCommands!=target->Type()) { CMakefileVariable& target_objects = m_Makefile.AddMacro(target->Name(STR_OBJ+"_",Config.MacroVariableCase()),"",target_objects_section++); target_objects.Multiline() = Config.MultilineObjects(); // output binary name may be exactly same for different targets // and shouldn't be used as makefile rule name //CMakefileRule& rule_target_out = m_Makefile.AddRule(target_out_name,section); CMakefileRule& rule_target_out = m_Makefile.AddRule(target->Name("out_"),section); rule_target_out.Dependencies().Insert("$("+target->Name(STR_OBJ+"_",Config.MacroVariableCase())+")"); rule_target_out.Dependencies().Insert("$("+target->Name(STR_DEP+"_",Config.MacroVariableCase())+")"); CStringList target_directories; CStringList clean_target_directories; CString binary_path = ExtractFilePath(target->Output()); if (!binary_path.IsEmpty()) { target_directories.Insert(pl->ProtectPath(pl->Pd(binary_path),Config.QuotePathMode())); if (!Config.KeepOutputDirectories()) { clean_target_directories.Insert(pl->ProtectPath(pl->Pd(binary_path),Config.QuotePathMode())); } } CString object_extension = "x"; // cmd_args.SetStringVariable(TPL_LIB_DIRS,"$("+target->Name(STR_LIBDIR+"_",Config.MacroVariableCase())+")"); cmd_args.SetStringVariable(TPL_LIBS,"$("+target->Name(STR_LIB+"_",Config.MacroVariableCase())+")"); cmd_args.SetStringVariable(TPL_LNK_OBJECTS,"$("+target->Name(STR_OBJ+"_",Config.MacroVariableCase())+")"); cmd_args.SetStringVariable(TPL_LNK_RES_OBJECTS,""); cmd_args.SetStringVariable(TPL_LNK_OPTIONS,"$("+target->Name(STR_LDFLAGS+"_",Config.MacroVariableCase())+")"); // switch (target->Type()) { case CBuildTarget::ttStaticLibrary: { // get a static linker (if any) CStaticLinker *linker = dynamic_cast(tc->GetBuildTool(0,CBuildTool::btStaticLinker)); if (0!=linker) { // compose static linkage command cmd_args.SetStringVariable(TPL_LIB_LINKER,"$("+DecorateVariableName(linker->MakeVariable()+tc_suffix,Config.MacroVariableCase())+")"); cmd_args.SetStringVariable(TPL_STL_OUTPUT,"$("+target->Name(STR_OUT+"_",Config.MacroVariableCase())+")"); line = linker->MakeCommand(cmd_args); // rule_target_out.Commands().Insert(line); object_extension = linker->ObjectExtension(); } else { if (Config.BeVerbose()) { std::cout<<"Cannot link target '"<Name("").GetCString()<<"', static linker is missing."<UCName()+") $(OBJ_"+target->UCName()+")"; //rule_target_out.Commands().Insert(line); break; } case CBuildTarget::ttDynamicLibrary: { // get a dynamic linker (if any) CDynamicLinker *linker = dynamic_cast(tc->GetBuildTool(0,CBuildTool::btDynamicLinker)); if (0!=linker) { // compose dynamic linkage command cmd_args.SetStringVariable(TPL_LINKER,"$("+DecorateVariableName(linker->MakeVariable()+tc_suffix,Config.MacroVariableCase())+")"); cmd_args.SetStringVariable(TPL_EXE_OUTPUT,"$("+target->Name(STR_OUT+"_",Config.MacroVariableCase())+")"); line = linker->MakeCommand(cmd_args); // rule_target_out.Commands().Insert(line); object_extension = linker->ObjectExtension(); } else { if (Config.BeVerbose()) { std::cout<<"Cannot link target '"<Name("").GetCString()<<"', dynamic linker is missing."<(tc->GetBuildTool(0,CBuildTool::btExecutableLinker)); if (0!=linker) { // pass linker option for GUI builds if ((pl->OS()==CPlatform::OS_Windows) && (target->Type()==CBuildTarget::ttExecutable)) { CVariable& v = cmd_args.VarNamed(TPL_LNK_OPTIONS); v.SetString(v.GetString()+" "+linker->OptionWinGUI()); } // compose executable linkage command cmd_args.SetStringVariable(TPL_LINKER,"$("+DecorateVariableName(linker->MakeVariable()+tc_suffix,Config.MacroVariableCase())+")"); cmd_args.SetStringVariable(TPL_EXE_OUTPUT,"$("+target->Name(STR_OUT+"_",Config.MacroVariableCase())+")"); line = linker->MakeCommand(cmd_args); // rule_target_out.Commands().Insert(line); object_extension = linker->ObjectExtension(); } else { if (Config.BeVerbose()) { std::cout<<"Cannot link target '"<Name("").GetCString()<<"', executable linker is missing."< 0) // probably unneccesary { line = "$(LD"+tc_suffix+")"; if (CBuildTarget::ttDynamicLibrary==target->Type()) { line += " -shared"; } line += " $(LDFLAGS_"+target->UCName()+") $(LIBDIR_" + target->UCName()+") -o $(OUT_"+target->UCName()+") $(OBJ_" + target->UCName()+") $(LIB_"+target->UCName()+")"; rule_target_out.Commands().Insert(line); } */ break; } case CBuildTarget::ttNative: { // get a native binary executable linker (if any) CExecutableLinker *linker = dynamic_cast(tc->GetBuildTool(0,CBuildTool::btNativeLinker)); if (0!=linker) { // compose executable linkage command cmd_args.SetStringVariable(TPL_LINKER,"$("+DecorateVariableName(linker->MakeVariable()+tc_suffix,Config.MacroVariableCase())+")"); cmd_args.SetStringVariable(TPL_EXE_OUTPUT,"$("+target->Name(STR_OUT+"_",Config.MacroVariableCase())+")"); line = linker->MakeCommand(cmd_args); // rule_target_out.Commands().Insert(line); object_extension = linker->ObjectExtension(); } else { if (Config.BeVerbose()) { std::cout<<"Cannot link target '"<Name("").GetCString()<<"', executable linker is missing."<FindCompiler(unit->Extension()); /* std::cout<<"target "<Name().GetString() <<" unit "<m_FileName.GetString() <<" compilable "<IsCompilable() <<" compile "<m_DoCompile <<" link "<m_DoLink<DoCompile() && unit->CompilerVariable().IsEmpty()) { if (Config.BeVerbose()) { std::cout<<"Warning: compiler for unit #"<<(i+1)<<" '" <FileName().GetString()<<"' of target '" <Title().GetString()<<"' is missing."<CompilerVariable().IsEmpty()))&&(unit->DoCompile())) if (unit->DoCompile()) { CString compiler_var = unit->CompilerVariable(); if (unit->CompilerVariable().IsEmpty() && (0!=compiler)) { compiler_var = compiler->MakeVariable(); } if (compiler->NeedDependencies() && Config.IncludeDependencies()) { CIncludeSearchFilter *filter = compiler->IncludeSearchFilter(); if (0!=filter) { filter->AddIncludeDirectories(m_CompilerDirectories); filter->AddIncludeDirectories(target->CompilerDirectories()); filter->Execute(unit->FileName(),m_Dependencies); size_t index = m_Dependencies.FindRecord(unit->FileName()); CStringList unit_deps(m_Dependencies.AllDependencies(index)); //m_Dependencies.Show();//debug //unit_deps.RemoveDuplicates();//depsearch makes rules //ShowStringList("unit includes","include",unit_deps);//debug if (Config.BeVerbose()) { std::cout<<"["<<(i+1)<<"/"<FileName().GetString() <Pd(unit->FileName()+object_extension); } else { object_name = pl->Pd(ChangeFileExt(unit->FileName(),object_extension)); } // quick fix for relative paths outside project tree object_name = FindReplaceStr(object_name,"..","__"); // if (Config.FlatObjectNames()) { if (Config.FlatObjectPaths()) { object_name = FlatFileName(object_name); } else { object_name = ExtractFileName(object_name); } } CString object_prefix = "$("+target->Name(STR_OBJDIR+"_",Config.MacroVariableCase())+")"; //CString object_prefix_name = pl->Pd(JoinPaths(object_prefix,object_name)); CString object_prefix_name = object_prefix+pl->ProtectPath(pl->Pd(IncludeLeadingPathDelimiter(object_name)),Config.QuotePathMode()); if (unit->DoLink()) { target_objects.AddValue(object_prefix_name); } CString object_path = pl->Pd(ExtractFilePath(object_name)); CString unit_name = pl->ProtectPath(pl->Pd(unit->FileName()),Config.QuotePathMode()); CMakefileRule& rule_unit = m_Makefile.AddRule(object_prefix_name,section); rule_unit.Dependencies().Insert(unit_name); //if (!object_path.IsEmpty() && !target->ObjectOutput().IsEmpty()) { if (object_path.IsEmpty()) { object_path = object_prefix; } else { //object_path = pl->Pd(JoinPaths(object_prefix,object_path)); object_path = object_prefix+pl->ProtectPath(pl->Pd(IncludeLeadingPathDelimiter(object_path)),Config.QuotePathMode()); } target_directories.Insert(object_path); if (!Config.KeepObjectDirectories()) { clean_target_directories.Insert(object_path); } } // compose compilation command cmd_args.SetStringVariable(TPL_COMPILER,"$("+DecorateVariableName(compiler_var+tc_suffix,Config.MacroVariableCase())+")"); cmd_args.SetStringVariable(TPL_INCLUDES,"$("+target->Name(STR_INC+"_",Config.MacroVariableCase())+")"); cmd_args.SetStringVariable(TPL_OPTIONS,"$("+target->Name(STR_CFLAGS+"_",Config.MacroVariableCase())+")"); cmd_args.SetStringVariable(TPL_FILE,unit_name); cmd_args.SetStringVariable(TPL_OBJECT,object_prefix_name); cmd_args.SetStringVariable(TPL_RES_COMPILER,"$("+DecorateVariableName(compiler_var+tc_suffix,Config.MacroVariableCase())+")"); cmd_args.SetStringVariable(TPL_RES_INCLUDES,"$("+target->Name(STR_RESINC+"_",Config.MacroVariableCase())+")"); cmd_args.SetStringVariable(TPL_RES_OUTPUT,object_prefix_name); line = compiler->MakeCommand(cmd_args); rule_unit.Commands().Insert(line); /* if (CBuildUnit::utResource==unit->m_Type) { line = "$("+compiler_var+tc_suffix+") $(RCFLAGS_"+target->UCName()+") $(RESINC_" + target->UCName()+") -J rc -O coff -o "+"$(OBJDIR_"+target->UCName()+")" + pl->Pd()+object_name+" -i "+unit_name; rule_unit.Commands().Insert(line); } else { line = "$("+compiler_var+tc_suffix+") $(CFLAGS_"+target->UCName()+") $(INC_" + target->UCName()+") -c -o "+"$(OBJDIR_"+target->UCName()+")"+pl->Pd() + object_name+" "+unit_name; rule_unit.Commands().Insert(line); } */ } // compilable unit } // units // clean target CMakefileRule& rule_clean_target = m_Makefile.AddRule(target->Name("clean_"),section); line.Clear(); //if (pl->OS()==CPlatform::OS_Windows) line += "cmd /c "; line += pl->MakefileCmd(pl->ForceRemoveFile( "$("+target->Name(STR_OBJ+"_",Config.MacroVariableCase())+ ") $("+target->Name(STR_OUT+"_",Config.MacroVariableCase())+")")); rule_clean_target.Commands().Insert(line); // target directories target_directories.RemoveDuplicates(); target_directories.RemoveEmpty(); for (int i = 0; i < target_directories.GetCount(); i++) { target_directories[i] = CGlobalVariable::Convert(target_directories[i],Config.MacroVariableCase()); rule_before.Commands().Insert(pl->MakefileCmd(pl->TestMakeDir(target_directories[i]))); } clean_target_directories.RemoveDuplicates(); clean_target_directories.RemoveEmpty(); for (int i = 0; i < clean_target_directories.GetCount(); i++) { clean_target_directories[i] = CGlobalVariable::Convert(clean_target_directories[i],Config.MacroVariableCase()); rule_clean_target.Commands().Insert(pl->MakefileCmd(pl->RemoveDir(clean_target_directories[i]))); } // if (rule_before.Commands().GetCount()) { rule_target_out.Dependencies().InsertAt(0,target->Name("before_")); } if (rule_after.Commands().GetCount()) { rule_after.Dependencies().InsertAt(0,target->Name("out_")); } } } // build target // virtual targets for (size_t t = 0; t < m_VirtualTargetIndex.size(); t++) { CVirtualTarget *v_target = m_VirtualTargetIndex[t]; CMakefileRule& rule_v_target = m_Makefile.AddRule(v_target->Name("virtual_"),section); if (have_global_commands)//(m_BeforeBuildCommands.GetCount()>0) { rule_v_target.Dependencies().Insert(DecorateTargetName("before_build",Config.TargetNameCase())); } for (int i = 0, n = v_target->Targets().GetCount(); i < n; i++) { CString child_target_name = DecorateTargetName(v_target->Targets().GetString(i), Config.TargetNameCase()); if (have_global_commands) { rule_v_target.Dependencies().Insert(DecorateTargetName("build_"+child_target_name,Config.TargetNameCase())); } else { rule_v_target.Dependencies().Insert(child_target_name); } } if (have_global_commands)//(m_AfterBuildCommands.GetCount()>0) { rule_v_target.Dependencies().Insert(DecorateTargetName("after_build",Config.TargetNameCase())); } } section++; // depedency rules if (Config.IncludeDependencies()) { m_Dependencies.MakeRules(m_Makefile,section,Config.MultilineObjects()); } // save makefile CStringList& text = m_Makefile.Update(); text.SaveToFile(makefile_name); m_Makefile.Clear(); ChangeDir(cwd); } // clear index m_BuildTargetIndex.clear(); m_VirtualTargetIndex.clear(); m_ToolChainIndex.clear(); m_UnitIndex.clear(); Config.ToolChains().Unlock(); // if (Config.BeVerbose() && Config.IncludeDependencies()) { m_Dependencies.Show(); } return true; } //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/depsearch.h0000644000175000017500000001266512155022125016555 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #ifndef DEPSEARCH_H #define DEPSEARCH_H //------------------------------------------------------------------------------ //#include //------------------------------------------------------------------------------ #include "stlstrings.h" #include "stringhash.h" #include "platforms.h" #include "makefile.h" //------------------------------------------------------------------------------ class CDependencyInfo; class CDependencyRecord { private: CString m_Name; hash_t m_Hash; std::vector m_Dependencies; std::vector m_CrossReferences; bool m_DependenciesComplete; bool m_CrossReferencesComplete; int m_Marker; public: CString GetName(void) const { return m_Name; }; void SetName(const CString& Name); hash_t Hash(void) const { return m_Hash; } size_t DependenciesCount(void) const; CDependencyRecord *Dependency(const size_t Index) const; void AddDependency(const CDependencyRecord *Record); size_t CrossReferencesCount(void) const; CDependencyRecord *CrossReference(const size_t Index) const; void AddCrossReference(const CDependencyRecord *Record); bool& DependenciesComplete(void) { return m_DependenciesComplete; } bool& CrossReferencesComplete(void) { return m_CrossReferencesComplete; } int& Marker(void) { return m_Marker; } void Clear(void); void Show(void); public: CDependencyRecord(void); ~CDependencyRecord(void); }; class CDependencyInfo { private: CPlatform m_Platform; std::vector m_Records; private: void ResetMarkers(void); size_t DependenciesCount(CDependencyRecord *Record); CStringList Dependencies(CDependencyRecord *Record); size_t CrossReferencesCount(CDependencyRecord *Record); CStringList CrossReferences(CDependencyRecord *Record); public: CPlatform& Platform(void) { return m_Platform; } void Clear(void); void Show(void); CString OneLineReport(const size_t Index, const bool Deps, const bool XRefs); size_t RecordsCount(void) const; CString Name(const size_t Index) const; size_t DirectDependenciesCount(const size_t Index) const; size_t IndirectDependenciesCount(const size_t Index); size_t AllDependenciesCount(const size_t Index); CStringList DirectDependencies(const size_t Index) const; CStringList IndirectDependencies(const size_t Index); CStringList AllDependencies(const size_t Index); size_t DirectCrossReferencesCount(const size_t Index) const; size_t IndirectCrossReferencesCount(const size_t Index); size_t AllCrossReferencesCount(const size_t Index); CStringList DirectCrossReferences(const size_t Index) const; CStringList IndirectCrossReferences(const size_t Index); CStringList AllCrossReferences(const size_t Index); bool AreDependenciesComplete(const size_t Index); bool AreCrossReferencesComplete(const size_t Index); void SetDependenciesComplete(const size_t Index, const bool State = true); void SetCrossReferencesComplete(const size_t Index, const bool State = true); int FindRecord(const CString& Name); size_t AddRecord(const CString& Name); bool AddDependency(const size_t Index, const CString& DependencyName); size_t AddDependency(const CString& Name, const CString& DependencyName); void MakeRules(CMakefile& Makefile, const int Section, const bool Multiline); public: CDependencyInfo(void); ~CDependencyInfo(void); }; class CIncludeSearchFilter { protected: CStringList m_IncludeDirectories; CStringList m_DefinedMacros; public: virtual void Clear(void); virtual void Show(void); virtual void Assign(const CIncludeSearchFilter& Filter); virtual bool Execute(const CString& FileName, CStringList& Includes); virtual bool Execute(const CString& FileName, CDependencyInfo& Dependencies); void AddIncludeDirectory(const CString& Path); void AddIncludeDirectories(const CStringList& Paths); void AddMacroDefiniton(const CString& Macro); void AddMacroDefinitons(const CStringList& Macros); CString ResolveIncludePath(const CString& IncludeName); public: CIncludeSearchFilter(void); CIncludeSearchFilter(const CIncludeSearchFilter& Filter); ~CIncludeSearchFilter(void); }; class CCppIncludeSearchFilter: public CIncludeSearchFilter { public: virtual void Assign(const CCppIncludeSearchFilter& Filter); virtual bool Execute(const CString& FileName, CStringList& Includes); virtual bool Execute(const CString& FileName, CDependencyInfo& Dependencies); public: CCppIncludeSearchFilter(void); CCppIncludeSearchFilter(const CCppIncludeSearchFilter& Filter); ~CCppIncludeSearchFilter(void); }; #endif //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/cbptarget.cpp0000644000175000017500000004672712155022124017132 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #include //------------------------------------------------------------------------------ #include "cbptarget.h" #include "cbhelper.h" #include "stlconvert.h" #include "stlfutils.h" #include "tinyxml.h" //------------------------------------------------------------------------------ CBuildTarget::CBuildTarget(void) { Clear(); } CBuildTarget::~CBuildTarget(void) { Clear(); } CString CBuildTarget::TargetTypeName(const TargetType Type) { switch (Type) { case CBuildTarget::ttExecutable: return "executable"; case CBuildTarget::ttConsoleExecutable: return "console executable"; case CBuildTarget::ttStaticLibrary: return "static library"; case CBuildTarget::ttDynamicLibrary: return "dynamic library"; case CBuildTarget::ttNative: return "native"; case CBuildTarget::ttCommands: return "commands"; //case CBuildTarget::tt: return ""; } return ""; } CString CBuildTarget::TargetTypeName(void) { return TargetTypeName(m_Type); } CString CBuildTarget::OptionsRelationName(const OptionsRelation Relation) { switch (Relation) { case CBuildTarget::orProject: return "project"; case CBuildTarget::orTarget: return "target"; case CBuildTarget::orTargetProject: return "target project"; case CBuildTarget::orProjectTarget: return "project target"; //case CBuildTarget::or: return ""; } return ""; } CString CBuildTarget::AutoFilePrefix(const CPlatform::OS_Type OS) { switch (OS) { default: case CPlatform::OS_Unix: { switch (m_Type) { case CBuildTarget::ttConsoleExecutable: { return ""; } case CBuildTarget::ttExecutable: { return ""; } case CBuildTarget::ttStaticLibrary: { return "lib"; } case CBuildTarget::ttDynamicLibrary: { return ""; } case CBuildTarget::ttNative: { return ""; } case CBuildTarget::ttCommands: { return ""; } //case CBuildTarget::tt: { break; } } break; } case CPlatform::OS_Windows: { switch (m_Type) { case CBuildTarget::ttConsoleExecutable: { return ""; } case CBuildTarget::ttExecutable: { return ""; } case CBuildTarget::ttStaticLibrary: { return "lib"; } case CBuildTarget::ttDynamicLibrary: { return ""; } case CBuildTarget::ttNative: { return ""; } case CBuildTarget::ttCommands: { return ""; } //case CBuildTarget::tt: { break; } } break; } case CPlatform::OS_Mac: { switch (m_Type) { case CBuildTarget::ttConsoleExecutable: { return ""; } case CBuildTarget::ttExecutable: { return ""; } case CBuildTarget::ttStaticLibrary: { return "lib"; } case CBuildTarget::ttDynamicLibrary: { return ""; } case CBuildTarget::ttNative: { return ""; } case CBuildTarget::ttCommands: { return ""; } //case CBuildTarget::tt: { break; } } break; } } return ""; } CString CBuildTarget::AutoFileExtension(const CPlatform::OS_Type OS, const CBuildTarget::TargetType Type) { switch (OS) { default: case CPlatform::OS_Unix: { switch (Type) { case CBuildTarget::ttConsoleExecutable: { return ""; } case CBuildTarget::ttExecutable: { return ""; } case CBuildTarget::ttStaticLibrary: { return "a"; } case CBuildTarget::ttDynamicLibrary: { return "so"; } case CBuildTarget::ttNative: { return ""; } case CBuildTarget::ttCommands: { return ""; } //case CBuildTarget::tt: { break; } } break; } case CPlatform::OS_Windows: { switch (Type) { case CBuildTarget::ttConsoleExecutable: { return "exe"; } case CBuildTarget::ttExecutable: { return "exe"; } case CBuildTarget::ttStaticLibrary: { return "a"; } case CBuildTarget::ttDynamicLibrary: { return "dll"; } case CBuildTarget::ttNative: { return "sys"; } case CBuildTarget::ttCommands: { return ""; } //case CBuildTarget::tt: { break; } } break; } case CPlatform::OS_Mac: { switch (Type) { case CBuildTarget::ttConsoleExecutable: { return ""; } case CBuildTarget::ttExecutable: { return ""; } case CBuildTarget::ttStaticLibrary: { return "a"; } case CBuildTarget::ttDynamicLibrary: { return "dylib"; } case CBuildTarget::ttNative: { return ""; } case CBuildTarget::ttCommands: { return ""; } //case CBuildTarget::tt: { break; } } break; } } return ""; } CString CBuildTarget::AutoFileExtension(CString& Platform) { return AutoFileExtension(CPlatform::OS(Platform),m_Type); } CString CBuildTarget::AutoFileExtension(const int Platform) { return AutoFileExtension(m_Platforms.GetString(Platform)); } CString CBuildTarget::MakeOptions(const OptionsRelation Relation, const CString& ProjectOptions, const CString& TargetOptions) { switch (Relation) { case CBuildTarget::orProject: return ProjectOptions; case CBuildTarget::orTarget: return TargetOptions; case CBuildTarget::orTargetProject: return JoinStr(TargetOptions,ProjectOptions,' '); default: case CBuildTarget::orProjectTarget: return JoinStr(ProjectOptions,TargetOptions,' '); } } CString CBuildTarget::CFlags(void) { CString result; for (int i = 0; i < m_CompilerOptions.GetCount(); i++) { result += " "+m_CompilerOptions[i]; } return result; } CString CBuildTarget::CFlags(const CString& ProjectCFlags) { return MakeOptions(m_CompilerOptionsRelation,ProjectCFlags,CFlags()); } CString CBuildTarget::RCFlags(void) { CString result; for (int i = 0; i < m_ResourceCompilerOptions.GetCount(); i++) { result += " "+m_ResourceCompilerOptions[i]; } return result; } CString CBuildTarget::RCFlags(const CString& ProjectRCFlags) { return MakeOptions(m_ResourceCompilerOptionsRelation,ProjectRCFlags,RCFlags()); } CString CBuildTarget::LdFlags(void) { CString result; for (int i = 0; i < m_LinkerOptions.GetCount(); i++) { result += " "+m_LinkerOptions[i]; } return result; } CString CBuildTarget::LdFlags(const CString& ProjectLdFlags) { return MakeOptions(m_LinkerOptionsRelation,ProjectLdFlags,LdFlags()); } CString CBuildTarget::IncDirs(const CString& IncDirSwitch) { CString result; for (int i = 0; i < m_CompilerDirectories.GetCount(); i++) { result = JoinStr(result,IncDirSwitch+m_CompilerDirectories[i],' '); } return result; } CString CBuildTarget::IncDirs(const CString& ProjectIncDirs, const CString& IncDirSwitch) { return MakeOptions(m_IncludeDirectoriesRelation,ProjectIncDirs,IncDirs(IncDirSwitch)); } CString CBuildTarget::ResDirs(const CString& IncDirSwitch) { CString result; for (int i = 0; i < m_ResourceCompilerDirectories.GetCount(); i++) { result = JoinStr(result,IncDirSwitch+m_ResourceCompilerDirectories[i],' '); } return result; } CString CBuildTarget::ResDirs(const CString& ProjectResDirs, const CString& IncDirSwitch) { return MakeOptions(m_ResourceIncludeDirectoriesRelation,ProjectResDirs,ResDirs(IncDirSwitch)); } CString CBuildTarget::LibDirs(const CString& LibDirSwitch) { CString result; for (int i = 0; i < m_LinkerDirectories.GetCount(); i++) { result = JoinStr(result,LibDirSwitch+m_LinkerDirectories[i],' '); } return result; } CString CBuildTarget::LibDirs(const CString& ProjectLibDirs, const CString& LibDirSwitch) { return MakeOptions(m_LibraryDirectoriesRelation,ProjectLibDirs,LibDirs(LibDirSwitch)); } CString CBuildTarget::Libs(const CPlatform& Platform, const CString& LinkLibSwitch) { CString result; for (int i = 0; i < m_LinkerLibraries.GetCount(); i++) { CString lib_name = m_LinkerLibraries[i]; CString lib_ext = ExtractFileExt(lib_name); //if (lib_ext.IsEmpty()) // wrong for files with dots but without .a extension //if (lib_ext==AutoFileExtension(OS,CBuildTarget::ttStaticLibrary)) // a plaform may have several valid extensions if (Platform.IsStaticLibraryExtension(lib_ext)) { result = JoinStr(result,lib_name,' '); } else { result = JoinStr(result,LinkLibSwitch+lib_name,' '); } } return result; } CString CBuildTarget::ExtDeps(void) { CString result; for (int i = 0; i < m_ExternalDependencies.GetCount(); i++) { result += " "+m_ExternalDependencies[i]; } return result; } void CBuildTarget::Clear(void) { m_Title = "default"; //m_Title.Clear(); m_Platforms.Clear(); m_Output = "a.out"; //m_Output.Clear(); m_ObjectOutput.Clear(); m_ExternalDependencies.Clear(); m_Type = ttExecutable; m_AutoPrefix = false; m_AutoExtension = false; m_Compiler.Clear(); m_CompilerOptions.Clear(); m_CompilerDirectories.Clear(); m_ResourceCompilerDirectories.Clear(); m_LinkerOptions.Clear(); m_LinkerLibraries.Clear(); m_LinkerDirectories.Clear(); m_BeforeBuildCommands.Clear(); m_AfterBuildCommands.Clear(); m_ForceBeforeBuildCommands = false; m_ForceAfterBuildCommands = false; m_CompilerOptionsRelation = orProjectTarget; m_LinkerOptionsRelation = orProjectTarget; m_IncludeDirectoriesRelation = orProjectTarget; m_ResourceIncludeDirectoriesRelation = orProjectTarget; m_LibraryDirectoriesRelation = orProjectTarget; m_UCName.Clear(); m_LCName.Clear(); } void CBuildTarget::Read(const TiXmlElement *TargetRoot) { char *value = 0; if ((value = (char *)TargetRoot->Attribute("title"))) m_Title = value; TiXmlNode *_option = (TiXmlNode *)TargetRoot->FirstChild("Option"); while (0!=_option) { TiXmlElement* option = _option->ToElement(); if (0!=option) { char *value = 0; if ((value = (char *)option->Attribute("platforms"))) { ParseStr(value,';',m_Platforms); m_Platforms.RemoveEmpty(); } if ((value = (char *)option->Attribute("output"))) { m_Output = value; } if ((value = (char *)option->Attribute("prefix_auto"))) { m_AutoPrefix = StringToBoolean(value); } if ((value = (char *)option->Attribute("extension_auto"))) { m_AutoExtension = StringToBoolean(value); } if ((value = (char *)option->Attribute("working_dir"))) { m_WorkingDirectory = value; } if ((value = (char *)option->Attribute("object_output"))) { m_ObjectOutput = value; } if ((value = (char *)option->Attribute("external_deps"))) { ParseStr(value,';',m_ExternalDependencies); m_ExternalDependencies.RemoveEmpty(); } if ((value = (char *)option->Attribute("type"))) { m_Type = (CBuildTarget::TargetType)StringToInteger(value); } if ((value = (char *)option->Attribute("compiler"))) { m_Compiler = value; } if ((value = (char *)option->Attribute("projectCompilerOptionsRelation"))) { m_CompilerOptionsRelation = (CBuildTarget::OptionsRelation)StringToInteger(value); } if ((value = (char *)option->Attribute("projectLinkerOptionsRelation"))) { m_LinkerOptionsRelation = (CBuildTarget::OptionsRelation)StringToInteger(value); } if ((value = (char *)option->Attribute("projectIncludeDirsRelation"))) { m_IncludeDirectoriesRelation = (CBuildTarget::OptionsRelation)StringToInteger(value); } if ((value = (char *)option->Attribute("projectResourceIncludeDirsRelation"))) { m_ResourceIncludeDirectoriesRelation = (CBuildTarget::OptionsRelation)StringToInteger(value); } if ((value = (char *)option->Attribute("projectLibDirsRelation"))) { m_LibraryDirectoriesRelation = (CBuildTarget::OptionsRelation)StringToInteger(value); } /* if ((value = (char *)option->Attribute(""))) { = value; } */ } _option = (TiXmlNode *)TargetRoot->IterateChildren(_option); } // option TiXmlNode *_compiler = (TiXmlNode *)TargetRoot->FirstChild("Compiler"); if (0!=_compiler) { TiXmlNode *_option = (TiXmlNode *)_compiler->FirstChild("Add"); while (0!=_option) { TiXmlElement* option = _option->ToElement(); if (0!=option) { char *value = 0; if ((value = (char *)option->Attribute("option"))) { m_CompilerOptions.Insert(value); } if ((value = (char *)option->Attribute("directory"))) { m_CompilerDirectories.Insert(value); } } _option = (TiXmlNode *)_compiler->IterateChildren(_option); } // option } // compiler TiXmlNode *_res_compiler = (TiXmlNode *)TargetRoot->FirstChild("ResourceCompiler"); if (0!=_res_compiler) { TiXmlNode *_option = (TiXmlNode *)_res_compiler->FirstChild("Add"); while (0!=_option) { TiXmlElement* option = _option->ToElement(); if (0!=option) { char *value = 0; if ((value = (char *)option->Attribute("directory"))) { m_ResourceCompilerDirectories.Insert(value); } } _option = (TiXmlNode *)_res_compiler->IterateChildren(_option); } // option } // resource compiler TiXmlNode *_linker = (TiXmlNode *)TargetRoot->FirstChild("Linker"); if (0!=_linker) { TiXmlNode *_option = (TiXmlNode *)_linker->FirstChild("Add"); while (0!=_option) { TiXmlElement* option = _option->ToElement(); if (0!=option) { if (strcmp(option->Value(),"Add")) break; char *value = 0; if ((value = (char *)option->Attribute("option"))) { m_LinkerOptions.Insert(value); } if ((value = (char *)option->Attribute("directory"))) { m_LinkerDirectories.Insert(value); } if ((value = (char *)option->Attribute("library"))) { m_LinkerLibraries.Insert(value); } } _option = (TiXmlNode *)_linker->IterateChildren(_option); } // option } // linker TiXmlNode *_extra_cmd = (TiXmlNode *)TargetRoot->FirstChild("ExtraCommands"); if (0!=_extra_cmd) { TiXmlNode *_option = (TiXmlNode *)_extra_cmd->FirstChild("Add"); while (0!=_option) { TiXmlElement* option = _option->ToElement(); if (0!=option) { if (strcmp(option->Value(),"Add")) break; char *value = 0; if ((value = (char *)option->Attribute("before"))) { m_BeforeBuildCommands.Insert(value); } if ((value = (char *)option->Attribute("after"))) { m_AfterBuildCommands.Insert(value); } } _option = (TiXmlNode *)_extra_cmd->IterateChildren(_option); } // option _option = (TiXmlNode *)_extra_cmd->FirstChild("Mode"); while (0!=_option) { TiXmlElement* option = _option->ToElement(); if (0!=option) { if (strcmp(option->Value(),"Mode")) break; char *value = 0; if ((value = (char *)option->Attribute("before"))) { m_ForceBeforeBuildCommands = (strcmp(value,"always")==0); } if ((value = (char *)option->Attribute("after"))) { m_ForceAfterBuildCommands = (strcmp(value,"always")==0); } } _option = (TiXmlNode *)_extra_cmd->IterateChildren(_option); } // option } // extra commands // decorate target name { m_MFName = MakefileFriendly(m_Title); m_UCName = UpperCase(m_MFName); m_LCName = LowerCase(m_MFName); m_ObjectOutput = RemoveTrailingPathDelimiter(m_ObjectOutput); } } CString CBuildTarget::Name(const CString& Prefix, const int Case) const { switch (Case) { default: case 0: return Prefix+m_MFName; case 1: return LowerCase(Prefix)+m_LCName; case 2: return UpperCase(Prefix)+m_UCName; } } CString CBuildTarget::Name(const CString& Prefix) const { switch (m_NameCase) { default: case 0: return Prefix+m_MFName; case 1: return LowerCase(Prefix)+m_LCName; case 2: return UpperCase(Prefix)+m_UCName; } } void CBuildTarget::Show(void) { std::cout<<"Target title: "<Attribute("alias"))) { m_Alias = value; } if ((value = (char *)TargetRoot->Attribute("targets"))) { ParseStr(value,';',m_Targets); m_Targets.RemoveEmpty(); } // decorate target name { m_MFName = MakefileFriendly(m_Alias); m_UCName = UpperCase(m_MFName); m_LCName = LowerCase(m_MFName); } } CString CVirtualTarget::Name(const CString& Prefix) const { switch (m_NameCase) { default: case 0: return Prefix+m_MFName; case 1: return LowerCase(Prefix)+m_LCName; case 2: return UpperCase(Prefix)+m_UCName; } } CString CVirtualTarget::Name(const CString& Prefix, const int TargetIndex) const { CString name = MakefileFriendly(m_Targets.GetString(TargetIndex)); switch (m_NameCase) { default: case 0: return name; case 1: return LowerCase(name); case 2: return UpperCase(name); } } void CVirtualTarget::Show(void) { std::cout<<"Target alias: "<. */ //------------------------------------------------------------------------------ #include //------------------------------------------------------------------------------ #include "buildtools.h" #include "stlconvert.h" #include "cbhelper.h" #include "tinyxml.h" //------------------------------------------------------------------------------ CBuildTool::CBuildTool(void) { Clear(); } CBuildTool::CBuildTool(const CBuildTool& BuildTool) { m_Platform = BuildTool.m_Platform; m_Alias = BuildTool.m_Alias; m_Type = BuildTool.m_Type; m_Description = BuildTool.m_Description; m_Program = BuildTool.m_Program; m_MakeVariable = BuildTool.m_MakeVariable; m_CommandTemplate = BuildTool.m_CommandTemplate; m_SourceExtensions = BuildTool.m_SourceExtensions; m_TargetExtension = BuildTool.m_TargetExtension; m_GenericSwitch = BuildTool.m_GenericSwitch; m_NeedQuotedPath = BuildTool.m_NeedQuotedPath; m_NeedFullPath = BuildTool.m_NeedFullPath; m_NeedUnixPath = BuildTool.m_NeedUnixPath; } CBuildTool::~CBuildTool(void) { Clear(); } CBuildTool *CBuildTool::CreateInstance(void) { return new CBuildTool(*this); } void CBuildTool::Clear(void) { m_Platform = CPlatform::OS_Other; m_Type = CBuildTool::btOther; m_Alias.Clear(); m_Description.Clear(); m_Program.Clear(); m_MakeVariable.Clear(); m_CommandTemplate.Clear(); m_SourceExtensions.Clear(); m_TargetExtension.Clear(); m_GenericSwitch = "-"; m_NeedQuotedPath = false; m_NeedFullPath = false; m_NeedUnixPath = false; } CBuildTool::ToolType CBuildTool::Type(const CString& Name) { for (int i = btOther; i < btCount; i++) { CBuildTool::ToolType tt = (CBuildTool::ToolType)i; if ((Name==XMLFriendly(TypeName(tt)))||(Name==TypeName(tt))||(Name==AbbrevTypeName(tt))) { return tt; } } return CBuildTool::btOther; } CString CBuildTool::TypeName(const CBuildTool::ToolType Type) { switch (Type) { default: case CBuildTool::btCount: case CBuildTool::btOther: { return "Other"; } case CBuildTool::btPreprocessor: { return "Preprocessor"; } case CBuildTool::btAssembler: { return "Assembler"; } case CBuildTool::btCompiler: { return "Compiler"; } case CBuildTool::btResourceCompiler: { return "Resource compiler"; } case CBuildTool::btStaticLinker: { return "Static library linker"; } case CBuildTool::btDynamicLinker: { return "Dynamic library linker"; } case CBuildTool::btExecutableLinker: { return "Executable binary linker"; } //case CBuildTool::btConsoleExecutableLinker: { return "Console executable binary linker"; } case CBuildTool::btNativeLinker: { return "Native binary linker"; } //case CBuildTool::btBuildManager, } return "Other"; } CString CBuildTool::AbbrevTypeName(const CBuildTool::ToolType Type) { switch (Type) { default: case CBuildTool::btCount: case CBuildTool::btOther: { return "bt"; } case CBuildTool::btPreprocessor: { return "pp"; } case CBuildTool::btAssembler: { return "as"; } case CBuildTool::btCompiler: { return "cc"; } case CBuildTool::btResourceCompiler: { return "rc"; } case CBuildTool::btStaticLinker: { return "sl"; } case CBuildTool::btDynamicLinker: { return "dl"; } case CBuildTool::btExecutableLinker: { return "el"; } //case CBuildTool::btConsoleExecutableLinker: { return "cl"; } case CBuildTool::btNativeLinker: { return "nl"; } //case CBuildTool::btBuildManager, } return "bt"; } CString CBuildTool::TypeName(void) const { return TypeName(m_Type); } CString CBuildTool::MakeCommand(const CString& CommandTemplate, CConfiguration& Arguments) { CString result = CommandTemplate; for (int i = 0; i < Arguments.GetCount(); i++) { CVariable& v = Arguments.Variable(i); result = FindReplaceStr(result,v.GetName(),v.GetString()); } return result; } CString CBuildTool::MakeCommand(CConfiguration& Arguments) { return MakeCommand(m_CommandTemplate,Arguments); } bool CBuildTool::ExpectedSourceExtension(const CString& FileExtension) { CString file_ext = LowerCase(FileExtension); return (m_SourceExtensions.FindString(file_ext) >= 0); } void CBuildTool::Reset(const CPlatform::OS_Type OS) { if (Supports(OS)) m_Platform = OS; else m_Platform = CPlatform::OS_Other; } bool CBuildTool::Supports(const CPlatform::OS_Type OS) { return ((CPlatform::OS_Unix==OS)|| (CPlatform::OS_Windows==OS)|| (CPlatform::OS_Mac==OS)); } void CBuildTool::Read(const TiXmlElement *Root, const CString& Name, CString& Value) { TiXmlNode *_option = (TiXmlNode *)Root->FirstChild("option"); while (0!=_option) { TiXmlElement* option = _option->ToElement(); //if (strcmp(option->Value(),"option")!=0) break; if (0!=option) { char *value = 0; if ((value = (char *)option->Attribute(Name.GetCString()))) { Value = value; break; } } _option = (TiXmlNode *)Root->IterateChildren(_option); } // option } void CBuildTool::Read(const TiXmlElement *Root, const CString& Name, bool& Value) { CString value; Read(Root,Name,value); Value = StringToBoolean(value); } void CBuildTool::Read(const TiXmlElement *BuildToolRoot) { char *value = 0; CString type_name; if ((value = (char *)BuildToolRoot->Attribute("type"))) { type_name = value; if (CBuildTool::btOther==m_Type) m_Type = Type(type_name); } if ((value = (char *)BuildToolRoot->Attribute("alias"))) { m_Alias = XMLFriendly(value); } /*{ CString l_TypeName; Read(BuildToolRoot, "type", l_TypeName); }*/ Read(BuildToolRoot, "description", m_Description); Read(BuildToolRoot, "program", m_Program); Read(BuildToolRoot, "make_variable", m_MakeVariable); Read(BuildToolRoot, "command_template", m_CommandTemplate); { CString l_SourceExtensions; m_SourceExtensions.Clear(); Read(BuildToolRoot, "source_extensions", l_SourceExtensions); ParseStr(l_SourceExtensions,' ',m_SourceExtensions); } Read(BuildToolRoot, "target_extension", m_TargetExtension); Read(BuildToolRoot, "generic_switch", m_GenericSwitch); Read(BuildToolRoot, "need_quoted_path", m_NeedQuotedPath); Read(BuildToolRoot, "need_full_path", m_NeedFullPath); Read(BuildToolRoot, "need_unix_path", m_NeedUnixPath); } void CBuildTool::Write(TiXmlElement *Root, const CString& Name, const CString& Value) { TiXmlElement *option = new TiXmlElement("option"); option->SetAttribute(Name.GetCString(),Value.GetCString()); Root->LinkEndChild(option); } void CBuildTool::Write(TiXmlElement *Root, const CString& Name, const bool Value) { TiXmlElement *option = new TiXmlElement("option"); option->SetAttribute(Name.GetCString(),Value); Root->LinkEndChild(option); } void CBuildTool::Write(TiXmlElement *BuildToolRoot) { BuildToolRoot->SetAttribute("type",XMLFriendly(TypeName()).GetCString()); BuildToolRoot->SetAttribute("alias",m_Alias.GetCString()); Write(BuildToolRoot, "description", m_Description); Write(BuildToolRoot, "program", m_Program); Write(BuildToolRoot, "make_variable", m_MakeVariable); Write(BuildToolRoot, "command_template", m_CommandTemplate); Write(BuildToolRoot, "source_extensions", m_SourceExtensions.Join(" ")); Write(BuildToolRoot, "target_extension", m_TargetExtension); Write(BuildToolRoot, "generic_switch", m_GenericSwitch); Write(BuildToolRoot, "need_quoted_path", m_NeedQuotedPath); Write(BuildToolRoot, "need_full_path", m_NeedFullPath); Write(BuildToolRoot, "need_unix_path", m_NeedUnixPath); //Write(BuildToolRoot, "", m_); } void CBuildTool::Show(void) { std::cout<<"Type: "<. */ //------------------------------------------------------------------------------ #include //------------------------------------------------------------------------------ #include "macros.h" #include "revision.h" #include "stlfutils.h" #include "stlgpm.h" #include "cbbuildmgr.h" #include "cbhelper.h" //------------------------------------------------------------------------------ class CProcessingMachine: public CGenericProcessingMachine { protected: CCodeBlocksBuildManager m_BuildManager; protected: void ConfigureToolchain(CToolChain *ToolChain); void ConfigureBuildTool(CBuildTool *BuildTool); void ConfigurePlatform(CPlatform *Platform); public: virtual void DisplayHelpMessage(void); virtual void CreateConfiguration(void); virtual CString ConfigurationName(void); virtual bool Configure(const CString& FileName); virtual CString TargetName(const int FileIndex, const CString& SourceFileName); virtual bool ProcessFile(const CString& SourceFileName, CString& TargetFileName); public: CProcessingMachine(void); ~CProcessingMachine(void); }; CProcessingMachine::CProcessingMachine(void) { m_BuildManager.Clear(); } CProcessingMachine::~CProcessingMachine(void) { // } void CProcessingMachine::DisplayHelpMessage(void) { std::cout<< "Usage syntax:\n\n" "\tGenerate makefile:\n" "\t\tcbp2make -in [-cfg ] [-out ]\n" "\t\t\t [-unix] [-windows] [-mac] [--all-os] [-targets \"[,[, ...]]\"]\n" "\t\t\t [--flat-objects] [--flat-objpath] [--wrap-objects] [--wrap-options]\n" "\t\t\t [--with-deps] [--keep-objdir] [--keep-outdir] [--target-case keep|lower|upper]\n" "\t\t\t [--macros-case keep|lower|upper] [--quote-path auto|never|always]\n" "\t\tcbp2make -list -in [-cfg ]\n" "\t\t\t [-unix] [-windows] [-mac] [--all-os] [-targets \"[,[, ...]]\"]\n" "\t\t\t [--flat-objects] [--flat-objpath] [--wrap-objects] [--wrap-options]\n" "\t\t\t [--with-deps] [--keep-objdir] [--keep-outdir] [--target-case keep|lower|upper]\n\n" "\t\t\t [--macros-case keep|lower|upper] [--quote-path auto|never|always]\n" "\tManage toolchains:\n" "\t\tcbp2make --config toolchain --add [-unix|-windows|-mac] -chain \n" "\t\tcbp2make --config toolchain --remove [-unix|-windows|-mac] -chain \n\n" "\tManage build tools:\n" "\t\tcbp2make --config tool --add [-unix|-windows|-mac] -chain \n" "\t\t\t -tool -type \n" "\t\tcbp2make --config tool --remove [-unix|-windows|-mac] -chain \n" "\t\t\t -tool \n\n" "\tTool types:\t pp=preprocessor as=assembler cc=compiler rc=resource compiler\n" "\t\t\t sl=static linker dl=dynamic linker el=executable linker\n" "\t\t\t nl=native linker\n" "\tTool options (common):\n" "\t\t\t -desc -program -command \n" "\t\t\t -mkv -srcext -outext \n" "\t\t\t -quotepath -fullpath -unixpath \n" "\tTool options (compiler):\n" "\t\t\t -incsw -defsw -deps \n" "\tTool options (linker):\n" "\t\t\t -ldsw -llsw -lpfx \n" "\t\t\t -lext -objext -lflat \n\n" "\tManage platforms:\n" "\t\tcbp2make --config platform [-unix|-windows|-mac] [-pwd ]\n" "\t\t\t [-cd ] [-rm ]\n" "\t\t\t [-rmf ] [-rmd ]\n" "\t\t\t [-cp ] [-mv ]\n" //"\t\t\t [-tf ] [-td ]\n" "\t\t\t [-md ] [-mdf ]\n" "\t\t\t [-make ]\n\n" "\tManage global compiler variables:\n" "\t\tcbp2make --config variable --add [-set ] -name \n" "\t\t\t [-desc ] [-field ] -value \n" "\t\tcbp2make --config variable --remove [-set ] [-name ]\n" "\t\t\t [-field ]\n\n" "\tManage options:\n" "\t\tcbp2make --config options --default-options \"\"\n" "\t\tcbp2make --config show\n\n" "\tCommon options:\n" "\t\tcbp2make --local\t// use configuration from current directory\n" "\t\tcbp2make --global\t// use configuration from home directory\n" "\t\tcbp2make --verbose\t// show project information\n" "\t\tcbp2make --quiet\t// hide all messages\n" "\t\tcbp2make --help\t\t// display this message\n" "\t\tcbp2make --version\t// display version information\n" < = PSC().VarNamed("-"); } */ } void CProcessingMachine::ConfigureBuildTool(CBuildTool *BuildTool) { CBuildTool *bt = BuildTool; if (PSC().VarDefined("-desc")) { bt->Description() = PSC().VarNamed("-desc").GetString(); } if (PSC().VarDefined("-program")) { bt->Program() = PSC().VarNamed("-program").GetString(); } if (PSC().VarDefined("-command")) { bt->CommandTemplate() = PSC().VarNamed("-command").GetString(); } if (PSC().VarDefined("-mkv")) { bt->MakeVariable() = PSC().VarNamed("-mkv").GetString(); } if (PSC().VarDefined("-srcext")) { ParseStr(PSC().VarNamed("-srcext").GetString(),' ',bt->SourceExtensions()); bt->SourceExtensions().RemoveDuplicates(); bt->SourceExtensions().RemoveEmpty(); } if (PSC().VarDefined("-outext")) { bt->TargetExtension() = PSC().VarNamed("-outext").GetString(); } if (PSC().VarDefined("-quotepath")) { bt->NeedQuotedPath() = PSC().VarNamed("-quotepath").GetBoolean(); } if (PSC().VarDefined("-fullpath")) { bt->NeedFullPath() = PSC().VarNamed("-fullpath").GetBoolean(); } if (PSC().VarDefined("-unixpath")) { bt->NeedUnixPath() = PSC().VarNamed("-unixpath").GetBoolean(); } CCompiler *cc = dynamic_cast(BuildTool); if (0!=cc) { if (PSC().VarDefined("-incsw")) { cc->IncludeDirSwitch() = PSC().VarNamed("-incsw").GetString(); } if (PSC().VarDefined("-defsw")) { cc->DefineSwitch() = PSC().VarNamed("-defsw").GetString(); } if (PSC().VarDefined("-deps")) { cc->NeedDependencies() = PSC().VarNamed("-deps").GetBoolean(); } } CLinker *ln = dynamic_cast(BuildTool); if (0!=ln) { if (PSC().VarDefined("-ldsw")) { ln->LibraryDirSwitch() = PSC().VarNamed("-ldsw").GetString(); } if (PSC().VarDefined("-llsw")) { ln->LinkLibrarySwitch() = PSC().VarNamed("-llsw").GetString(); } if (PSC().VarDefined("-lpfx")) { ln->LibraryPrefix() = PSC().VarNamed("-lpfx").GetString(); ln->NeedLibraryPrefix() = !(ln->LibraryPrefix().IsEmpty()); } if (PSC().VarDefined("-lext")) { ln->LibraryExtension() = PSC().VarNamed("-lext").GetString(); } if (PSC().VarDefined("-objext")) { ln->ObjectExtension() = PSC().VarNamed("-objext").GetString(); } if (PSC().VarDefined("-lflat")) { ln->NeedFlatObjects() = PSC().VarNamed("-lflat").GetBoolean(); } } } void CProcessingMachine::ConfigurePlatform(CPlatform *Platform) { CPlatform *p = Platform; if (PSC().VarDefined("-make")) { p->Cmd_Make() = PSC().VarNamed("-make").GetString(); } if (PSC().VarDefined("-pwd")) { p->Cmd_PrintWorkDir() = PSC().VarNamed("-pwd").GetString(); } if (PSC().VarDefined("-wd")) { p->Cmd_EvalWorkDir() = PSC().VarNamed("-wd").GetString(); } if (PSC().VarDefined("-cd")) { p->Cmd_ChangeDir() = PSC().VarNamed("-cd").GetString(); } if (PSC().VarDefined("-rm")) { p->Cmd_RemoveFile() = PSC().VarNamed("-rm").GetString(); } if (PSC().VarDefined("-rmf")) { p->Cmd_ForceRemoveFile() = PSC().VarNamed("-rmf").GetString(); } if (PSC().VarDefined("-rmd")) { p->Cmd_RemoveDir() = PSC().VarNamed("-rmd").GetString(); } /* if (PSC().VarDefined("-tf")) { p->Cmd_TestFile() = PSC().VarNamed("-tf").GetString(); } if (PSC().VarDefined("-td")) { p->Cmd_TestDir() = PSC().VarNamed("-td").GetString(); } */ if (PSC().VarDefined("-cp")) { p->Cmd_Copy() = PSC().VarNamed("-cp").GetString(); } if (PSC().VarDefined("-mv")) { p->Cmd_Move() = PSC().VarNamed("-mv").GetString(); } if (PSC().VarDefined("-md")) { p->Cmd_MakeDir() = PSC().VarNamed("-md").GetString(); } if (PSC().VarDefined("-mdf")) { p->Cmd_ForceMakeDir() = PSC().VarNamed("-mdf").GetString(); } } bool CProcessingMachine::Configure(const CString& FileName) { CGenericProcessingMachine::Configure(""/*FileName*/); if (DoShowHelp()) { DisplayHelpMessage(); return false; } if (BeVerbose()) { std::cout<<"Command line parameters:"<FindBuildToolByName(tool_name); if (0==bt) { bt = tc->CreateBuildTool(tool_type); bt->Alias() = tool_name; } if (0==bt) return false; ConfigureBuildTool(bt); } } } // add-tool else if (PSC().VarDefined("--remove")&&PSC().VarDefined("-chain")&&PSC().VarDefined("-tool")&&os_any) { CToolChain *tc = m_BuildManager.ToolChains().Find(os_type,chain_name); if (0!=tc) { return tc->RemoveToolByName(PSC().VarNamed("-tool").GetString()); } } } if (2==config_item) { if (os_any) { CPlatform *p = m_BuildManager.Platforms().Find(os_type); if (0==p) return false; ConfigurePlatform(p); } } if (3==config_item) { if (PSC().VarDefined("--add")) { CString set_name = PSC().VarNamed("-set").GetString(); if (PSC().VarDefined("-name") && PSC().VarDefined("-value")) { CString var_name = PSC().VarNamed("-name").GetString(); CGlobalVariableSet *vset = m_BuildManager.Config().GlobalVariables().Add(set_name); CGlobalVariable *var = vset->Add(var_name); if (PSC().VarDefined("-desc")) { var->Description() = PSC().VarNamed("-desc").GetString(); } if (PSC().VarDefined("-value")) { var->Add(PSC().VarNamed("-field").GetString(), PSC().VarNamed("-value").GetString()); } } } // add variable else if (PSC().VarDefined("--remove")) { CString set_name = PSC().VarNamed("-set").GetString(); if (PSC().VarDefined("-name")) { CString var_name = PSC().VarNamed("-name").GetString(); CGlobalVariableSet *vset = m_BuildManager.Config().GlobalVariables().Add(set_name); CGlobalVariable *var = vset->Add(var_name); if (PSC().VarDefined("-field")) { // if both variable and field names are defined, remove the field var->Remove(PSC().VarNamed("-field").GetString()); } else { // if variable name is defined, but field name is not, remove the variable vset->Remove(var_name); } } else { // if both variable and field names are not defined, // but set name is defined, remove the entire set if (PSC().VarDefined("-set")) { m_BuildManager.Config().GlobalVariables().Remove(set_name); } } } // remove variable } // config variable if (config_item < 0) m_BuildManager.Config().Show(); std::cout<<"Saving configuration: "<Active() = true; } if (os_windows) { CPlatform *p = m_BuildManager.Config().Platforms().Find(CPlatform::OS_Windows); if (p) p->Active() = true; } if (os_mac) { CPlatform *p = m_BuildManager.Config().Platforms().Find(CPlatform::OS_Mac); if (p) p->Active() = true; } // { CString vset_name = PSC().VarNamed("-set").GetString(); CGlobalVariableSet *vset = m_BuildManager.Config().GlobalVariables().Find(vset_name); if (0!=vset) { vset->Active() = true; } } m_BuildManager.Config().FlatObjectNames() = PSC().VarDefined("--flat-objects"); m_BuildManager.Config().FlatObjectPaths() = PSC().VarDefined("--flat-objpath"); m_BuildManager.Config().MultilineObjects() = PSC().VarDefined("--wrap-objects"); m_BuildManager.Config().MultilineOptions() = PSC().VarDefined("--wrap-options"); m_BuildManager.Config().IncludeDependencies() = PSC().VarDefined("--with-deps"); { CString target_case_name = PSC().VarNamed("--target-case").GetString(); m_BuildManager.Config().TargetNameCase() = GuessStr(target_case_name,"keep lower upper",target_case_name,false); } { CString macros_case_name = PSC().VarNamed("--macros-case").GetString(); m_BuildManager.Config().MacroVariableCase() = GuessStr(macros_case_name,"keep lower upper",macros_case_name,false); } { CString quote_path_name = PSC().VarNamed("--quote-path").GetString(); m_BuildManager.Config().QuotePathMode() = GuessStr(quote_path_name,"auto never always",quote_path_name,false); } m_BuildManager.Config().KeepObjectDirectories() = PSC().VarDefined("--keep-objdir"); m_BuildManager.Config().KeepOutputDirectories() = PSC().VarDefined("--keep-outdir"); { CStringList targets; ParseStr(PSC().VarNamed("-targets").GetString(),',',targets); targets.RemoveEmpty(); targets.RemoveDuplicates(); m_BuildManager.Config().Targets() = targets; } //if (BeVerbose()) PSC().Print(std::cout); return true; } CString CProcessingMachine::TargetName(const int FileIndex, const CString& SourceFileName) { return SourceFileName+".mak";//ChangeFileExt(SourceFileName,".mak"); } bool CProcessingMachine::ProcessFile(const CString& SourceFileName, CString& TargetFileName) { bool result = false; if (!BeQuiet()) std::cout<<"Loading file '" <. */ //------------------------------------------------------------------------------ #ifndef CBP_TARGET_H #define CBP_TARGET_H //------------------------------------------------------------------------------ #include "stlstrings.h" #include "platforms.h" //------------------------------------------------------------------------------ class TiXmlNode; class TiXmlElement; class CCodeBlocksProject; class CBuildTarget { public: enum TargetType { ttExecutable, ttConsoleExecutable, ttStaticLibrary, ttDynamicLibrary, ttCommands, ttNative // windows-only ".sys" files }; enum OptionsRelation { orProject, orTarget, orTargetProject, orProjectTarget }; private: CString m_Title; CStringList m_Platforms; CString m_Output; CString m_WorkingDirectory; CString m_ObjectOutput; CStringList m_ExternalDependencies; TargetType m_Type; bool m_AutoPrefix; bool m_AutoExtension; CString m_Compiler; CStringList m_CompilerOptions; CStringList m_CompilerDirectories; CStringList m_LinkerOptions; CStringList m_LinkerLibraries; CStringList m_LinkerDirectories; CStringList m_BeforeBuildCommands; CStringList m_AfterBuildCommands; bool m_ForceBeforeBuildCommands; bool m_ForceAfterBuildCommands; CStringList m_ResourceCompilerDirectories; CStringList m_ResourceCompilerOptions; OptionsRelation m_CompilerOptionsRelation; OptionsRelation m_LinkerOptionsRelation; OptionsRelation m_IncludeDirectoriesRelation; OptionsRelation m_ResourceIncludeDirectoriesRelation; OptionsRelation m_LibraryDirectoriesRelation; OptionsRelation m_ResourceCompilerOptionsRelation; // int m_NameCase; CString m_UCName; CString m_LCName; CString m_MFName; public: CString Title(void) const { return m_Title; } CStringList Platforms(void) const { return m_Platforms; } CString Output(void) const { return m_Output; } CString ObjectOutput(void) const { return m_ObjectOutput; } TargetType Type(void) const { return m_Type; } bool AutoPrefix(void) const { return m_AutoPrefix; } bool AutoExtension(void) const { return m_AutoExtension; } CString Compiler(void) const { return m_Compiler; } CStringList CompilerDirectories(void) const { return m_CompilerDirectories; } CStringList BeforeBuildCommands(void) const { return m_BeforeBuildCommands; } CStringList AfterBuildCommands(void) const { return m_AfterBuildCommands; } bool ForceBeforeBuildCommands(void) const { return m_ForceBeforeBuildCommands; } bool ForceAfterBuildCommands(void) const { return m_ForceAfterBuildCommands; } int& NameCase(void) { return m_NameCase; } CString UCName(void) const { return m_UCName; } CString LCName(void) const { return m_LCName; } CString MFName(void) const { return m_MFName; } CString Name(const CString& Prefix, const int Case) const; CString Name(const CString& Prefix) const; // CString TargetTypeName(const TargetType Type); CString TargetTypeName(void); CString OptionsRelationName(const OptionsRelation Relation); CString AutoFilePrefix(const CPlatform::OS_Type OS); CString AutoFileExtension(const CPlatform::OS_Type OS, const CBuildTarget::TargetType Type); CString AutoFileExtension(CString& Platform); CString AutoFileExtension(const int Platform); CString MakeOptions(const OptionsRelation Relation, const CString& ProjectOptions, const CString& TargetOptions); CString CFlags(void); CString CFlags(const CString& ProjectCFlags); CString RCFlags(void); CString RCFlags(const CString& ProjectRCFlags); CString LdFlags(void); CString LdFlags(const CString& ProjectLdFlags); CString IncDirs(const CString& IncDirSwitch); CString IncDirs(const CString& ProjectIncDirs, const CString& IncDirSwitch); CString ResDirs(const CString& IncDirSwitch); CString ResDirs(const CString& ProjectResDirs, const CString& IncDirSwitch); CString LibDirs(const CString& LibDirSwitch); CString LibDirs(const CString& ProjectLibDirs, const CString& LibDirSwitch); CString Libs(const CPlatform& Platform, const CString& LinkLibSwitch); CString ExtDeps(void); public: void Clear(void); void Read(const TiXmlElement *TargetRoot); void Show(void); public: CBuildTarget(void); ~CBuildTarget(void); }; class CVirtualTarget { //friend class CCodeBlocksProject; private: CString m_Alias; CStringList m_Targets; // int m_NameCase; CString m_UCName; CString m_LCName; CString m_MFName; public: CString Alias(void) const { return m_Alias; } CStringList& Targets(void) { return m_Targets; } int& NameCase(void) { return m_NameCase; } CString UCName(void) const { return m_UCName; } CString LCName(void) const { return m_LCName; } CString MFName(void) const { return m_MFName; } CString Name(const CString& Prefix) const; CString Name(const CString& Prefix, const int TargetIndex) const; // void Clear(void); void Read(const TiXmlElement *TargetRoot); void Show(void); public: CVirtualTarget(void); ~CVirtualTarget(void); }; #endif //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/makefile.h0000644000175000017500000000763412155022125016374 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #ifndef MAKEFILE_H #define MAKEFILE_H //------------------------------------------------------------------------------ #include "stlstrings.h" #include "stlconfig.h" //------------------------------------------------------------------------------ class CMakefileVariable { private: CString m_Name; CStringList m_Values; bool m_Multiline; public: CString& Name(void) { return m_Name; } CStringList& Values(void) { return m_Values; } CString GetValue(const int Index = 0); void SetValue(const CString& NewValue, const int Index = 0); void AddValue(const CString& NewValue); bool& Multiline(void) { return m_Multiline; } CString JoinValues(void); public: void Clear(void); void Show(void); public: CMakefileVariable(void); ~CMakefileVariable(void); }; class CMakefileRule { private: CString m_Target; CStringList m_Dependencies; CStringList m_Commands; bool m_Multiline; public: CString& Target(void) { return m_Target; } CStringList& Dependencies(void) { return m_Dependencies; } CStringList& Commands(void) { return m_Commands; } bool& Multiline(void) { return m_Multiline; } CString JoinDependencies(void); public: void Clear(void); void Show(void); public: CMakefileRule(void); ~CMakefileRule(void); }; class CMakefileSection { private: CStringList m_Header; std::vector m_Macros; std::vector m_EnvVars; std::vector m_Rules; CMakefileVariable m_NullVariable; CMakefileRule m_NullRule; protected: CMakefileVariable *FindMacro(const CString& Name); CMakefileVariable *FindEnvVar(const CString& Name); public: void Clear(void); void Show(void); public: CStringList& Header(void); std::vector& Macros(void); std::vector& EnvVars(void); CMakefileVariable& AddMacro(const CString& Name, const CString& Value); CMakefileVariable& AddEnvVar(const CString& Name, const CString& Value); size_t RulesCount(void) const; CMakefileRule& GetRule(const size_t Index); CMakefileRule& AddRule(const CString& TargetName); public: CMakefileSection(void); ~CMakefileSection(void); }; class CMakefile { private: std::vector m_Sections; CStringList m_Text; public: void Clear(void); void Show(void); public: size_t SectionCount(void) const; CMakefileSection& GetSection(const size_t Section); CStringList& Header(const size_t Section = 0); CMakefileSection& AddSection(size_t *Section = 0); CMakefileVariable& AddMacro(const CString& Name, const CString& Value, const size_t Section = 0); CMakefileVariable& AddEnvVar(const CString& Name, const CString& Value, const size_t Section = 0); size_t RulesCount(const size_t Section = 0); CMakefileRule& GetRule(const size_t Index, const size_t Section = 0); CMakefileRule& AddRule(const CString& TargetName, const size_t Section = 0); CStringList& GetText(void); CStringList& Update(void); public: CMakefile(void); ~CMakefile(void); }; #endif //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/cbworkspace.cpp0000644000175000017500000003652712155022125017460 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #include //------------------------------------------------------------------------------ #include "revision.h" #include "macros.h" #include "cbworkspace.h" #include "cbbuildcfg.h" #include "cbhelper.h" #include "stlfutils.h" #include "tinyxml.h" //------------------------------------------------------------------------------ CWorkspaceUnit::CWorkspaceUnit(void) { Clear(); } CWorkspaceUnit::~CWorkspaceUnit(void) { Clear(); } void CWorkspaceUnit::Clear(void) { m_FileName.Clear(); m_Depends.Clear(); m_Project.Clear(); m_Weight = 0; } void CWorkspaceUnit::Read(const TiXmlElement* UnitRoot) { m_FileName = UnitRoot->Attribute("filename"); const TiXmlNode *_depends = UnitRoot->FirstChild("Depends"); while (0!=_depends) { const TiXmlElement *depends = _depends->ToElement(); if (0!=depends) { char *value = (char *)depends->Attribute("filename"); if (0!=value) { m_Depends.Insert(value); } } _depends = UnitRoot->IterateChildren(_depends); } m_Depends.RemoveDuplicates(); //m_Depends.RemoveEmpty(); } void CWorkspaceUnit::Show(void) { #ifdef SHOW_MODE_ONELINE std::cout<m_Depends.GetCount()) { if (unit->m_Weight) { return unit->m_Weight; } int weight = 0; for (int j = 0, nj = unit->m_Depends.GetCount(); j < nj; j++) { CString dependency = unit->m_Depends[j]; for (size_t i = 0, ni = m_Units.size(); i < ni; i++) { if (i!=Index) { if (unit->m_FileName == dependency) { weight += CalculateProjectWeight(i); }}}} weight++; return weight; } return 0; } void CCodeBlocksWorkspace::ResolveProjectDependencies(void) { for (size_t i = 0; i < m_Units.size(); i++) { m_Units[i]->m_Weight = CalculateProjectWeight(i); } } class CProjectWeightComparison { public: bool operator ()(CWorkspaceUnit *const &AUnit, CWorkspaceUnit *const &BUnit) { return (AUnit->m_Weight < BUnit->m_Weight); } }; void CCodeBlocksWorkspace::SortProjectsByWeight(void) { CProjectWeightComparison cmp; std::sort(m_Units.begin(),m_Units.end(),cmp); } void CCodeBlocksWorkspace::Clear() { m_Title.Clear(); for (size_t i = 0; i < m_Units.size(); i++) { delete m_Units[i]; } m_Units.clear(); m_TargetNames.Clear(); m_MakefileNames.Clear(); m_MakefilePaths.Clear(); m_TargetDeps.Clear(); m_MakefileText.Clear(); m_Makefile.Clear(); } void CCodeBlocksWorkspace::Read(const TiXmlElement* WorkspaceRoot) { const TiXmlNode *_workspace = WorkspaceRoot->FirstChild("Workspace"); if (0!=_workspace) { const TiXmlElement *workspace = _workspace->ToElement(); if (0!=workspace) { m_Title = workspace->Attribute("title"); TiXmlNode *_project = (TiXmlNode *)_workspace->FirstChild("Project"); while (0!=_project) { TiXmlElement* project = _project->ToElement(); if (0!=project) { CWorkspaceUnit *unit = new CWorkspaceUnit(); unit->Read(project); m_Units.push_back(unit); } _project = (TiXmlNode *)_workspace->IterateChildren(_project); }}} } bool CCodeBlocksWorkspace::LoadWorkspace(const CString& FileName) { bool result = false; TiXmlDocument cbw; result = cbw.LoadFile(FileName.GetCString()); if (!result) return false; Clear(); const TiXmlElement *root = cbw.RootElement(); if (0==strcmp(root->Value(),"CodeBlocks_workspace_file")) { Read(root); result = true; } // return result; } bool CCodeBlocksWorkspace::LoadWorkspaceProjects(const CString& WorkspacePath) { bool result = true; for (size_t i = 0; i < m_Units.size(); i++) { result &= m_Units[i]->LoadProject(WorkspacePath); } // resolve project dependencies and sort projects by weight ResolveProjectDependencies(); SortProjectsByWeight(); return result; } void CCodeBlocksWorkspace::Show(const bool ShowProjects) { std::cout<<"Workspace title: "<Show(); if (ShowProjects) { m_Units[i]->m_Project.Show(); }} } bool CCodeBlocksWorkspace::GenerateMakefile (const CString& FileName, CCodeBlocksBuildConfig& Config) { // generate individual makefiles for projects CString cwd = GetCurrentDir(); CString workspace_path = ExtractFilePath(FileName); if (!workspace_path.IsEmpty()) { ChangeDir(workspace_path); } // m_TargetNames.Clear(); m_MakefileNames.Clear(); m_TargetDeps.Clear(); for (size_t i = 0; i < m_Units.size(); i++) { CString project_name = m_Units[i]->m_FileName; //CString makefile_path = JoinPaths(workspace_path,ExtractFilePath(project_name)); CString makefile_path = ExtractFilePath(project_name); //CString makefile_pathname = JoinPaths(workspace_path,project_name+".mak"); CString makefile_pathname = project_name+".mak"; CString target_name = ChangeFileExt(project_name,""); CString makefile_name = ExtractFileName(makefile_pathname); target_name = CCodeBlocksProject::DecorateTargetName(target_name,Config.TargetNameCase()); CString target_deps; for (int j = 0; j < m_Units[i]->m_Depends.GetCount(); j++) { CString dep_name = ChangeFileExt(m_Units[i]->m_Depends[j],""); if (j>0) target_deps += " "; target_deps += CCodeBlocksProject::DecorateTargetName(dep_name,Config.TargetNameCase()); } m_TargetDeps.Insert(target_deps); m_TargetNames.Insert(target_name); m_MakefilePaths.Insert(makefile_path); m_MakefileNames.Insert(makefile_name); makefile_pathname = MakeNativePath(makefile_pathname); //std::cout<<"cwd "<m_Project.GenerateMakefile(makefile_pathname,Config); } // generate workspace makefile int active_platforms = 0; for (size_t pi = 0, pn = Config.Platforms().GetCount(); pi < pn; pi++) { if (Config.Platforms().Platform(pi)->Active()) active_platforms++; } bool single_platform = (1==active_platforms); for (size_t pi = 0, pn = Config.Platforms().GetCount(); pi < pn; pi++) { CPlatform *pl = Config.Platforms().Platform(pi); if (!pl->Active()) continue; CString makefile_path = ExtractFilePath(FileName); CString makefile_name = ExtractFileName(FileName); CString platform_suffix; if (!single_platform) platform_suffix = "."+LowerCase(pl->Name()); makefile_name += platform_suffix; ChangeDir(makefile_path); // begin makefile m_Makefile.Clear(); int section = 0; // head comment const int header_width = 80; m_Makefile.Header().Insert(FillStr("#",'-',"#",header_width)); #ifdef REVISION_NUMBER { CString rn = IntegerToString(REVISION_NUMBER); CString line = FillStr("# This makefile was generated by 'cbp2make' tool rev."+rn,' ',"#",header_width); m_Makefile.Header().Insert(line); } #else CString line = FillStr("# This makefile was generated by 'cbp2make' tool rev.",' ',"#",header_width) #endif m_Makefile.Header().Insert(FillStr("#",'-',"#",header_width)); m_Makefile.Header().Insert(""); section++; // macros CString line = pl->EvalWorkDir(); m_Makefile.AddMacro("WRKDIR",line,section); m_Makefile.AddMacro("MAKE",pl->Tool_Make(),section); section++; // targets CMakefileRule& rule_all = m_Makefile.AddRule("all",section); for (int i = 0; i < m_TargetNames.GetCount(); i++) { rule_all.Dependencies().Insert(m_TargetNames[i]); } section++; for (int i = 0; i < m_TargetNames.GetCount(); i++) { CString makefile_path = m_MakefilePaths[i]; CMakefileRule& rule_target = m_Makefile.AddRule(m_TargetNames[i],section); rule_target.Dependencies().Insert(m_TargetDeps[i]); line = "$(MAKE)"; if (!makefile_path.IsEmpty()) { line += " -C "+pl->ProtectPath(pl->Pd(makefile_path),Config.QuotePathMode()); } line += " all -f "+pl->ProtectPath(pl->Pd(m_MakefileNames[i])+platform_suffix,Config.QuotePathMode()); rule_target.Commands().Insert(line); } section++; // CMakefileRule& rule_clean = m_Makefile.AddRule("clean",section); for (int i = 0; i < m_TargetNames.GetCount(); i++) { rule_clean.Dependencies().Insert("clean_"+m_TargetNames[i]); } section++; for (int i = 0; i < m_TargetNames.GetCount(); i++) { CString makefile_path = m_MakefilePaths[i]; CMakefileRule& rule_clean_target = m_Makefile.AddRule("clean_"+m_TargetNames[i],section); line = "$(MAKE)"; if (!makefile_path.IsEmpty()) { line += " -C "+pl->ProtectPath(pl->Pd(makefile_path),Config.QuotePathMode()); } line += " clean -f "+pl->ProtectPath(pl->Pd(m_MakefileNames[i])+platform_suffix,Config.QuotePathMode()); rule_clean_target.Commands().Insert(line); } // save makefile CStringList& text = m_Makefile.Update(); text.SaveToFile(makefile_name); m_Makefile.Clear(); ChangeDir(cwd); } return true; } void CCodeBlocksWorkspace::GenerateMakefileText(const CString& FileName, CCodeBlocksBuildConfig& Config) { // generate individual makefiles for projects //std::cout<<"Workspace: "<m_FileName; CString makefile_path = JoinPaths(workspace_path,ExtractFilePath(project_name)); CString makefile_pathname = JoinPaths(workspace_path,project_name+".mak"); CString target_name = LowerCase(ChangeFileExt(project_name,"")); CString makefile_name = ExtractFileName(makefile_pathname); //std::cout<<"Project name: "<m_Project.GenerateMakefile(makefile_pathname,Config); } //CString cwd = GetCurrentDir(); // generate workspace makefile int active_platforms = 0; for (size_t pi = 0, pn = Config.Platforms().GetCount(); pi < pn; pi++) { if (Config.Platforms().Platform(pi)->Active()) active_platforms++; } bool single_platform = (1==active_platforms); for (size_t pi = 0, pn = Config.Platforms().GetCount(); pi < pn; pi++) { CPlatform *pl = Config.Platforms().Platform(pi); if (!pl->Active()) continue; CString makefile_path = ExtractFilePath(FileName); CString makefile_name = ExtractFileName(FileName); CString platform_suffix; if (!single_platform) platform_suffix = "."+LowerCase(pl->Name()); makefile_name += platform_suffix; //ChangeDir(makefile_path); // m_MakefileText.Clear(); // head comment m_MakefileText.Insert("#------------------------------------------------------------------------------#"); #ifdef REVISION_NUMBER { CString s = "# This makefile was generated by 'cbp2make' tool rev. #"; CString n = IntegerToString(REVISION_NUMBER); int o = FindStr(s,"rev.") + 4; for (int i = 0; i < n.GetLength(); i++) s.SetChar(i+o,n[i]); m_MakefileText.Insert(s); } #else m_MakefileText.Insert("# This makefile was generated by 'cbp2make' tool #"); #endif m_MakefileText.Insert("#------------------------------------------------------------------------------#"); m_MakefileText.Insert(""); // macros CString line = "WRKDIR = "+pl->EvalWorkDir(); m_MakefileText.Insert(line); line = "MAKE = "+pl->Tool_Make(); m_MakefileText.Insert(line); m_MakefileText.Insert(""); // targets line = "all:"; for (int i = 0; i < m_TargetNames.GetCount(); i++) { line.Append(" ").Append(m_TargetNames[i]); } m_MakefileText.Insert(line); m_MakefileText.Insert(""); for (int i = 0; i < m_TargetNames.GetCount(); i++) { CString makefile_path = m_MakefilePaths[i]; line = m_TargetNames[i]+":"; m_MakefileText.Insert(line); line = "\t$(MAKE)"; if (!makefile_path.IsEmpty()) { line += " -C "+pl->ProtectPath(pl->Pd(makefile_path),Config.QuotePathMode()); } line += " all -f "+pl->ProtectPath(pl->Pd(m_MakefileNames[i])+platform_suffix,Config.QuotePathMode()); m_MakefileText.Insert(line); m_MakefileText.Insert(""); } // line = "clean:"; for (int i = 0; i < m_TargetNames.GetCount(); i++) { line.Append(" clean_").Append(m_TargetNames[i]); } m_MakefileText.Insert(line); m_MakefileText.Insert(""); for (int i = 0; i < m_TargetNames.GetCount(); i++) { CString makefile_path = m_MakefilePaths[i]; line = "clean_"+m_TargetNames[i]+":"; m_MakefileText.Insert(line); line = "\t$(MAKE)"; if (!makefile_path.IsEmpty()) { line += " -C "+pl->ProtectPath(pl->Pd(makefile_path),Config.QuotePathMode()); } line += " clean -f "+pl->ProtectPath(pl->Pd(m_MakefileNames[i])+platform_suffix,Config.QuotePathMode()); m_MakefileText.Insert(line); m_MakefileText.Insert(""); } // line = ".PHONY:"; for (int i = 0; i < m_TargetNames.GetCount(); i++) { line.Append(" ").Append(m_TargetNames[i]); line.Append(" clean_").Append(m_TargetNames[i]); } m_MakefileText.Insert(line); m_MakefileText.Insert(""); m_MakefileText.SaveToFile(makefile_name); m_MakefileText.Clear(); ChangeDir(cwd); } } //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/platforms.h0000644000175000017500000001255512155022125016624 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #ifndef PLATFORMS_H #define PLATFORMS_H //------------------------------------------------------------------------------ #include "stlstrings.h" #include "cbhelper.h" //------------------------------------------------------------------------------ static const CString STR_UNIX = "Unix"; static const CString STR_WINDOWS = "Windows"; static const CString STR_MAC = "Mac"; class TiXmlElement; class CPlatformSet; class CPlatform { public: enum OS_Type { OS_Other, OS_Unix, OS_Windows, OS_Mac, OS_Count }; private: bool m_Active; OS_Type m_OS_Type; CString m_Cmd_Null; CString m_Cmd_Copy; CString m_Cmd_Move; CString m_Cmd_Make; CString m_Tool_Make; //CString m_Cmd_TestFile; CString m_Cmd_RemoveFile; CString m_Cmd_ForceRemoveFile; //CString m_Cmd_TestDir; CString m_Cmd_MakeDir; CString m_Cmd_TestMakeDir; CString m_Cmd_ForceMakeDir; CString m_Cmd_RemoveDir; CString m_Cmd_PrintWorkDir; CString m_Cmd_EvalWorkDir; CString m_Cmd_ChangeDir; char m_PathDelimiter; // CStringList m_StaticLibraryExtensions; CStringList m_DynamicLibraryExtensions; //CString m_; public: static CString Name(const OS_Type PlatformOS); static OS_Type OS(CString& PlatformName); bool& Active(void) { return m_Active; } OS_Type OS(void) const { return m_OS_Type; } CString Name(void); CString& Cmd_Copy(void) { return m_Cmd_Copy; } CString& Cmd_Move(void) { return m_Cmd_Move; } CString& Cmd_Make(void) { return m_Cmd_Make; } CString& Tool_Make(void) { return m_Tool_Make; } //CString& Cmd_TestFile(void) { return m_Cmd_TestFile; } CString& Cmd_RemoveFile(void) { return m_Cmd_RemoveFile; } CString& Cmd_ForceRemoveFile(void) { return m_Cmd_ForceRemoveFile; } //CString& Cmd_TestDir(void) { return m_Cmd_TestDir; } CString& Cmd_MakeDir(void) { return m_Cmd_MakeDir; } CString& Cmd_TestMakeDir(void) { return m_Cmd_TestMakeDir; } CString& Cmd_ForceMakeDir(void) { return m_Cmd_ForceMakeDir; } CString& Cmd_RemoveDir(void) { return m_Cmd_RemoveDir; } CString& Cmd_PrintWorkDir(void) { return m_Cmd_PrintWorkDir; } CString& Cmd_EvalWorkDir(void) { return m_Cmd_EvalWorkDir; } CString& Cmd_ChangeDir(void) { return m_Cmd_ChangeDir; } char Pd(void) const { return m_PathDelimiter; } CString Pd(const CString& Path) const; CString SpecialChars(void) const; CString ProtectPath(const CString& Path, const int QuoteMode = QUOTE_AUTO); CString Copy(const CString& Source, const CString& Destination) const; CString Move(const CString& Source, const CString& Destination) const; CString Make(const CString& Options, const CString& Path) const; CString RemoveFile(const CString& Path) const; CString ForceRemoveFile(const CString& Path) const; CString MakeDir(const CString& Path) const; CString TestMakeDir(const CString& Path) const; CString ForceMakeDir(const CString& Path) const; CString RemoveDir(const CString& Path) const; CString PrintWorkDir(void) const; CString EvalWorkDir(void) const; CString ChangeDir(const CString& Path) const; CString MakefileCmd(const CString& Command) const; // bool IsStaticLibraryExtension(const CString& Ext) const; bool IsDynamicLibraryExtension(const CString& Ext) const; //CString (void) const { return m_; } private: void Read(const TiXmlElement *Root, const CString& Name, CString& Value); void Write(TiXmlElement *Root, const CString& Name, const CString& Value); public: void Assign(const CPlatform& Platform); void Clear(void); void Reset(const CPlatform::OS_Type OS); void Read(const TiXmlElement *PlatformRoot); void Write(TiXmlElement *PlatformRoot); void Show(void); CPlatform& operator =(const CPlatform& Platform); public: CPlatform(void); CPlatform(const CPlatform& Platform); ~CPlatform(void); }; class CPlatformSet { private: std::vector m_Platforms; bool m_Locked; public: void Lock(void); void Unlock(void); void Clear(void); size_t GetCount(void) const; CPlatform *Platform(const size_t Index) const; CPlatform *Find(const CPlatform::OS_Type OS); void AddDefault(void); //CPlatform *Add(const CPlatform::OS_Type OS); //void Remove(const CPlatform::OS_Type OS); void Read(const TiXmlElement *ConfigRoot); void Write(TiXmlElement *ConfigRoot); //bool Load(const CString& FileName); //bool Save(const CString& FileName); void Show(void); public: CPlatformSet(void); ~CPlatformSet(void); }; #endif //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/toolchains.cpp0000644000175000017500000005631112155022124017310 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #include //------------------------------------------------------------------------------ #include "toolchains.h" #include "stlconvert.h" #include "tinyxml.h" //------------------------------------------------------------------------------ CToolChain::CToolChain(const CString& Alias) { Clear(); m_Alias = Alias; } CToolChain::CToolChain(const CToolChain& ToolChain) { Clear(); Assign(ToolChain); } CToolChain::~CToolChain(void) { Clear(); } void CToolChain::Clear(void) { m_Platform = CPlatform::OS_Other; m_Alias.Clear(); m_GenericSwitch = "-"; m_DefineSwitch = "-D"; m_IncludeDirSwitch = "-I"; m_LibraryDirSwitch = "-L"; m_LinkLibrarySwitch = "-l"; } CString CToolChain::sw(const CString& ASwitch) const { if (!ASwitch.IsEmpty()) { if (LeftStr(ASwitch,m_GenericSwitch.GetLength())==m_GenericSwitch) { return m_GenericSwitch+ASwitch; } } return ASwitch; } CBuildTool *CToolChain::CreateBuildTool(const CBuildTool::ToolType Type) { switch (Type) { default: case CBuildTool::btCount: case CBuildTool::btOther: { return 0; //break; } case CBuildTool::btPreprocessor: { CPreprocessor *bt = new CPreprocessor; m_Preprocessors.push_back(bt); m_BuildTools.push_back(bt); return bt; //break; } case CBuildTool::btCompiler: { CCompiler *bt = new CCompiler; m_Compilers.push_back(bt); m_BuildTools.push_back(bt); return bt; //break; } case CBuildTool::btAssembler: { CAssembler *bt = new CAssembler; m_Assemblers.push_back(bt); m_BuildTools.push_back(bt); return bt; //break; } case CBuildTool::btStaticLinker: { CStaticLinker *bt = new CStaticLinker; m_StaticLinkers.push_back(bt); m_BuildTools.push_back(bt); return bt; //break; } case CBuildTool::btDynamicLinker: { CDynamicLinker *bt = new CDynamicLinker; m_DynamicLinkers.push_back(bt); m_BuildTools.push_back(bt); return bt; //break; } case CBuildTool::btExecutableLinker: { CExecutableLinker *bt = new CExecutableLinker; m_ExecutableLinkers.push_back(bt); m_BuildTools.push_back(bt); return bt; //break; } case CBuildTool::btResourceCompiler: { CResourceCompiler *bt = new CResourceCompiler; m_ResourceCompilers.push_back(bt); m_BuildTools.push_back(bt); return bt; //break; } //case CBuildTool::btBuildManager, } return 0; } void CToolChain::Assign(const CToolChain& ToolChain) { m_Platform = ToolChain.m_Platform; m_Alias = ToolChain.m_Alias; m_GenericSwitch = ToolChain.m_GenericSwitch; m_DefineSwitch = ToolChain.m_DefineSwitch; m_IncludeDirSwitch = ToolChain.m_IncludeDirSwitch; m_LibraryDirSwitch = ToolChain.m_LibraryDirSwitch; m_LinkLibrarySwitch = ToolChain.m_LinkLibrarySwitch; for (size_t i = 0; i < ToolChain.m_Preprocessors.size(); i++) { m_Preprocessors.push_back(ToolChain.m_Preprocessors[i]->CreateInstance()); } for (size_t i = 0; i < ToolChain.m_Assemblers.size(); i++) { m_Assemblers.push_back(ToolChain.m_Assemblers[i]->CreateInstance()); } for (size_t i = 0; i < ToolChain.m_Compilers.size(); i++) { m_Compilers.push_back(ToolChain.m_Compilers[i]->CreateInstance()); } for (size_t i = 0; i < ToolChain.m_ResourceCompilers.size(); i++) { m_ResourceCompilers.push_back(ToolChain.m_ResourceCompilers[i]->CreateInstance()); } for (size_t i = 0; i < ToolChain.m_StaticLinkers.size(); i++) { m_StaticLinkers.push_back(ToolChain.m_StaticLinkers[i]->CreateInstance()); } for (size_t i = 0; i < ToolChain.m_DynamicLinkers.size(); i++) { m_DynamicLinkers.push_back(ToolChain.m_DynamicLinkers[i]->CreateInstance()); } for (size_t i = 0; i < ToolChain.m_ExecutableLinkers.size(); i++) { m_ExecutableLinkers.push_back(ToolChain.m_ExecutableLinkers[i]->CreateInstance()); } GatherBuildTools(); } CToolChain *CToolChain::CreateInstance(void) const { return new CToolChain(*this); } void CToolChain::Reset(const CPlatform::OS_Type OS) { if (Supports(OS)) m_Platform = OS; else m_Platform = CPlatform::OS_Other; for (size_t i = 0; i < m_BuildTools.size(); i++) { CBuildTool *bt = m_BuildTools[i]; //bt->Show(); bt->Reset(OS); } } bool CToolChain::Supports(const CPlatform::OS_Type OS) const { return ((CPlatform::OS_Unix==OS)|| (CPlatform::OS_Windows==OS)|| (CPlatform::OS_Mac==OS)); } void CToolChain::Read(const TiXmlElement *Root, const CString& Name, CString& Value) { TiXmlNode *_option = (TiXmlNode *)Root->FirstChild("option"); while (0!=_option) { TiXmlElement* option = _option->ToElement(); //if (strcmp(option->Value(),"option")!=0) break; if (0!=option) { char *value = 0; if ((value = (char *)option->Attribute(Name.GetCString()))) { Value = value; break; } } _option = (TiXmlNode *)Root->IterateChildren(_option); } // option } void CToolChain::Read(const TiXmlElement *Root, const CString& Name, bool& Value) { CString value; Read(Root,Name,value); Value = StringToBoolean(value); } void CToolChain::Read(const TiXmlElement *ToolChainRoot) { char *value = 0; if ((value = (char *)ToolChainRoot->Attribute("alias"))) { m_Alias = value; } if ((value = (char *)ToolChainRoot->Attribute("platform"))) { CString platform = value; m_Platform = CPlatform::OS(platform); } /* if ((value = (char *)ToolChainRoot->Attribute(""))) { m_ = value; } */ TiXmlNode *_tool_root = (TiXmlNode *)(ToolChainRoot->FirstChild("tool")); while (0!=_tool_root) { const TiXmlElement *tool_root = _tool_root->ToElement(); if (0!=tool_root) { char *value = 0; CString type_name, alias; if ((value = (char *)tool_root->Attribute("type"))) { type_name = value; } if ((value = (char *)tool_root->Attribute("alias"))) { alias = value; } Read(ToolChainRoot, "generic_switch", m_GenericSwitch); Read(ToolChainRoot, "define_switch", m_DefineSwitch); Read(ToolChainRoot, "include_dir_switch", m_IncludeDirSwitch); Read(ToolChainRoot, "library_dir_switch", m_LibraryDirSwitch); Read(ToolChainRoot, "link_library_switch", m_LinkLibrarySwitch); bool custom_tool = true; for (size_t i = 0; i < m_BuildTools.size(); i++) { CBuildTool *bt = m_BuildTools[i]; if (bt->Supports(m_Platform)) { if (bt->Alias() == alias) { bt->Read(tool_root); custom_tool = false; } } } if (custom_tool) { CBuildTool::ToolType tool_type = CBuildTool::Type(type_name); CBuildTool *bt = CreateBuildTool(tool_type); if (0!=bt) { bt->Read(tool_root); } } } _tool_root = (TiXmlNode *)(ToolChainRoot->IterateChildren(_tool_root)); } } void CToolChain::Write(TiXmlElement *Root, const CString& Name, const CString& Value) { TiXmlElement *option = new TiXmlElement("option"); option->SetAttribute(Name.GetCString(),Value.GetCString()); Root->LinkEndChild(option); } void CToolChain::Write(TiXmlElement *Root, const CString& Name, const bool Value) { TiXmlElement *option = new TiXmlElement("option"); option->SetAttribute(Name.GetCString(),Value); Root->LinkEndChild(option); } void CToolChain::Write(TiXmlElement *ToolChainRoot) { ToolChainRoot->SetAttribute("platform",CPlatform::Name(m_Platform).GetCString()); ToolChainRoot->SetAttribute("alias",m_Alias.GetCString()); Write(ToolChainRoot, "generic_switch", m_GenericSwitch); Write(ToolChainRoot, "define_switch", m_DefineSwitch); Write(ToolChainRoot, "include_dir_switch", m_IncludeDirSwitch); Write(ToolChainRoot, "library_dir_switch", m_LibraryDirSwitch); Write(ToolChainRoot, "link_library_switch", m_LinkLibrarySwitch); //ToolChainRoot->SetAttribute("",m_.GetCString()); for (size_t i = 0; i < m_BuildTools.size(); i++) { CBuildTool *bt = m_BuildTools[i]; if (bt->Supports(m_Platform)) { TiXmlElement *bt_root = new TiXmlElement("tool"); bt->Write(bt_root); ToolChainRoot->LinkEndChild(bt_root); } } } void CToolChain::Show(void) { std::cout<<"Platform: "<Supports(m_Platform)) bt_count++; } std::cout<<"Toolchain has "<Supports(m_Platform)) { std::cout<<"Build tool #"<<++j<Show(); } std::cout<& Source, std::vector& Target) { for (size_t i = 0; i < Source.size(); i++) { Target.push_back(Source[i]); } } void CToolChain::GatherBuildTools(void) { m_BuildTools.clear(); GatherBuildTools((std::vector&)m_Preprocessors, m_BuildTools); GatherBuildTools((std::vector&)m_Assemblers, m_BuildTools); GatherBuildTools((std::vector&)m_Compilers, m_BuildTools); GatherBuildTools((std::vector&)m_StaticLinkers, m_BuildTools); GatherBuildTools((std::vector&)m_DynamicLinkers, m_BuildTools); GatherBuildTools((std::vector&)m_ExecutableLinkers,m_BuildTools); GatherBuildTools((std::vector&)m_ResourceCompilers,m_BuildTools); } CBuildTool *CToolChain::FindBuildTool(const CString& FileExtension, const std::vector& Tools) { for (size_t i = 0; i < Tools.size(); i++) { CBuildTool *bt = Tools[i]; if (bt->ExpectedSourceExtension(FileExtension)) return bt; } return 0; } std::vector& CToolChain::GetTools(const CBuildTool::ToolType Type) { switch (Type) { default: case CBuildTool::btOther: case CBuildTool::btCount: return m_BuildTools; case CBuildTool::btPreprocessor: return (std::vector&)m_Preprocessors; case CBuildTool::btAssembler: return (std::vector&)m_Assemblers; case CBuildTool::btCompiler: return (std::vector&)m_Compilers; case CBuildTool::btStaticLinker: return (std::vector&)m_StaticLinkers; case CBuildTool::btDynamicLinker: return (std::vector&)m_DynamicLinkers; case CBuildTool::btExecutableLinker: return (std::vector&)m_ExecutableLinkers; case CBuildTool::btResourceCompiler: return (std::vector&)m_ResourceCompilers; //case CBuildTool::btBuildManager, } return m_BuildTools; } size_t CToolChain::ToolsCount(const CBuildTool::ToolType Type) { return GetTools(Type).size(); } CBuildTool *CToolChain::GetBuildTool(const size_t index, const CBuildTool::ToolType Type) { std::vector tools = GetTools(Type); if (indexAlias()==ToolName) return bt; } return 0; } CBuildTool *CToolChain::FindBuildTool(const CString& FileExtension) { return dynamic_cast(FindBuildTool(FileExtension,(std::vector&)m_BuildTools)); } CAssembler *CToolChain::FindAssembler(const CString& FileExtension) { return dynamic_cast(FindBuildTool(FileExtension,(std::vector&)m_Assemblers)); } CCompiler *CToolChain::FindCompiler(const CString& FileExtension) { CCompiler *result = 0; result = dynamic_cast(FindBuildTool(FileExtension,(std::vector&)m_Compilers)); if (0!=result) return result; result = dynamic_cast(FindBuildTool(FileExtension,(std::vector&)m_Assemblers)); if (0!=result) return result; result = dynamic_cast(FindBuildTool(FileExtension,(std::vector&)m_ResourceCompilers)); return result; } void CToolChain::RemoveTool(const CBuildTool* BuildTool, std::vector& Tools) { Tools.erase(std::find(Tools.begin(),Tools.end(),BuildTool)); delete BuildTool; } void CToolChain::RemoveTool(const CBuildTool* BuildTool) { RemoveTool(BuildTool,(std::vector&)m_Preprocessors); RemoveTool(BuildTool,(std::vector&)m_Assemblers); RemoveTool(BuildTool,(std::vector&)m_Compilers); RemoveTool(BuildTool,(std::vector&)m_StaticLinkers); RemoveTool(BuildTool,(std::vector&)m_DynamicLinkers); RemoveTool(BuildTool,(std::vector&)m_ExecutableLinkers); RemoveTool(BuildTool,(std::vector&)m_ResourceCompilers); } bool CToolChain::RemoveToolByName(const CString& ToolName) { for (size_t i = 0; i < m_BuildTools.size(); i++) { CBuildTool *bt = m_BuildTools[i]; if (bt->Alias()==ToolName) { RemoveTool(bt); return true; } } return false; } //------------------------------------------------------------------------------ CGNUToolChain::CGNUToolChain(void): CToolChain("gcc") { m_Compilers.push_back(new CGNUCCompiler); m_Compilers.push_back(new CGNUCppCompiler); // m_ResourceCompilers.push_back(new CGNUWindowsResourceCompiler); // m_StaticLinkers.push_back(new CGNUStaticLinker); // m_DynamicLinkers.push_back(new CGNUDynamicLinker); // m_ExecutableLinkers.push_back(new CGNUExecutableLinker); // GatherBuildTools(); } CGNUToolChain::~CGNUToolChain(void) { // } CToolChain *CGNUToolChain::CreateInstance(void) const { return new CGNUToolChain(*this); } void CGNUToolChain::Reset(const CPlatform::OS_Type OS) { CToolChain::Reset(OS); m_GenericSwitch = "-"; m_DefineSwitch = "-D"; m_IncludeDirSwitch = "-I"; m_LibraryDirSwitch = "-L"; m_LinkLibrarySwitch = "-l"; } //------------------------------------------------------------------------------ CBorlandToolChain::CBorlandToolChain(void): CToolChain("bcc") { m_Compilers.push_back(new CBorlandCppCompiler); //m_ResourceCompilers.push_back(new CIntelResourceCompiler); m_StaticLinkers.push_back(new CIntelStaticLinker); m_DynamicLinkers.push_back(new CIntelDynamicLinker); m_ExecutableLinkers.push_back(new CIntelExecutableLinker); // GatherBuildTools(); } CToolChain *CBorlandToolChain::CreateInstance(void) const { return new CBorlandToolChain(*this); } void CBorlandToolChain::Reset(const CPlatform::OS_Type OS) { CToolChain::Reset(OS); m_GenericSwitch = "-"; m_DefineSwitch = "-D"; m_IncludeDirSwitch = "-I"; m_LibraryDirSwitch = "-L"; m_LinkLibrarySwitch = ""; } CBorlandToolChain::~CBorlandToolChain(void) { // } //------------------------------------------------------------------------------ CIntelToolChain::CIntelToolChain(void): CToolChain("icc") { m_Compilers.push_back(new CIntelCCompiler); m_Compilers.push_back(new CIntelCppCompiler); //m_ResourceCompilers.push_back(new CIntelResourceCompiler); m_StaticLinkers.push_back(new CIntelStaticLinker); m_DynamicLinkers.push_back(new CIntelDynamicLinker); m_ExecutableLinkers.push_back(new CIntelExecutableLinker); // GatherBuildTools(); } CToolChain *CIntelToolChain::CreateInstance(void) const { return new CIntelToolChain(*this); } void CIntelToolChain::Reset(const CPlatform::OS_Type OS) { CToolChain::Reset(OS); if (CPlatform::OS_Windows==OS) { m_GenericSwitch = "/"; m_DefineSwitch = "/D"; m_IncludeDirSwitch = "/I"; m_LibraryDirSwitch = "/LIBPATH:"; m_LinkLibrarySwitch = ""; } else { m_GenericSwitch = "-"; m_DefineSwitch = "-D"; m_IncludeDirSwitch = "-I"; m_LibraryDirSwitch = "-L"; m_LinkLibrarySwitch = "-l"; } } CIntelToolChain::~CIntelToolChain(void) { // } //------------------------------------------------------------------------------ CMSVCToolChain::CMSVCToolChain(void): CToolChain("msvc") { m_Compilers.push_back(new CMSVCCompiler); m_Compilers.push_back(new CMSVCppCompiler); m_ResourceCompilers.push_back(new CMSVCResourceCompiler); m_StaticLinkers.push_back(new CMSVCStaticLinker); m_DynamicLinkers.push_back(new CMSVCDynamicLinker); m_ExecutableLinkers.push_back(new CMSVCExecutableLinker); m_ExecutableLinkers.push_back(new CMSVCConsoleExecutableLinker); m_ExecutableLinkers.push_back(new CMSVCNativeExecutableLinker); // GatherBuildTools(); } CToolChain *CMSVCToolChain::CreateInstance(void) const { return new CMSVCToolChain(*this); } void CMSVCToolChain::Reset(const CPlatform::OS_Type OS) { CToolChain::Reset(OS); //if (CPlatform::OS_Windows==OS) { m_GenericSwitch = "/"; m_DefineSwitch = "/D"; m_IncludeDirSwitch = "/I"; m_LibraryDirSwitch = "/LIBPATH:"; m_LinkLibrarySwitch = ""; } } CMSVCToolChain::~CMSVCToolChain(void) { // } bool CMSVCToolChain::Supports(const CPlatform::OS_Type OS) const { return (CPlatform::OS_Windows==OS); } //------------------------------------------------------------------------------ CToolChainSet::CToolChainSet(void) { Unlock(); Clear(); } CToolChainSet::~CToolChainSet(void) { Unlock(); Clear(); } void CToolChainSet::Lock(void) { m_Locked = true; } void CToolChainSet::Unlock(void) { m_Locked = false; } void CToolChainSet::Clear(void) { if (m_Locked) return; for (size_t i = 0; i < m_ToolChains.size(); i++) { for (size_t j = 0; j < m_ToolChains[i].size(); j++) { //std::cout<<"delete "<=0)&&(IndexAlias() == Alias)&&(tc->OS() == OS)) return tc; } return 0; } void CToolChainSet::AddToolChain(const CToolChain *AToolChain) { CToolChain *tc = (CToolChain *)AToolChain; for (int i = (int)CPlatform::OS_Other; i < (int)CPlatform::OS_Count; i++) { CPlatform::OS_Type os_type = (CPlatform::OS_Type)i; if (AToolChain->Supports(os_type)) { if (0==tc) { tc = AToolChain->CreateInstance(); } tc->Reset(os_type); m_ToolChains[os_type].push_back(tc); tc = 0; } } } void CToolChainSet::AddDefault(void) { if (m_Locked || m_HaveDefaults) return; // AddToolChain(new CGNUToolChain); AddToolChain(new CIntelToolChain); AddToolChain(new CMSVCToolChain); // m_HaveDefaults = true; // } CToolChain *CToolChainSet::Add(const CPlatform::OS_Type OS, const CString& Alias) { if (m_Locked || (OS==CPlatform::OS_Count)) return 0; CToolChain *tc = new CToolChain(Alias); tc->Reset(OS); m_ToolChains[OS].push_back(tc); return tc; } void CToolChainSet::Remove(const CPlatform::OS_Type OS, const CString& Alias) { if (m_Locked || (OS==CPlatform::OS_Count)) return; CToolChain *tc = Find(OS,Alias); if (0!=tc) { m_ToolChains[OS].erase(std::find(m_ToolChains[OS].begin(),m_ToolChains[OS].end(),tc)); delete tc; } } void CToolChainSet::Read(const TiXmlElement *ConfigRoot) { TiXmlNode *_tool_chain = (TiXmlNode *)ConfigRoot->FirstChild("toolchain"); while (0!=_tool_chain) { TiXmlElement* tool_chain = _tool_chain->ToElement(); if (0!=tool_chain) { if (strcmp(tool_chain->Value(),"toolchain")!=0) break; // char *value = 0; CString alias, platform_name; CPlatform::OS_Type platform = CPlatform::OS_Other; if ((value = (char *)tool_chain->Attribute("alias"))) { alias = value; } if ((value = (char *)tool_chain->Attribute("platform"))) { platform_name = value; platform = CPlatform::OS(platform_name); } // CToolChain *tc = Find(platform,alias); // //CToolChain *tc = new CToolChain("other"); bool custom_toolchain = (0==tc); if (custom_toolchain) { tc = new CToolChain("other"); } tc->Read(tool_chain); if (custom_toolchain) { m_ToolChains[tc->OS()].push_back(tc); } } _tool_chain = (TiXmlNode *)ConfigRoot->IterateChildren(_tool_chain); } // tool_chain } void CToolChainSet::Write(TiXmlElement *ConfigRoot) { for (int i = 0, n = m_ToolChains.size(); i < n; i++) { for (int j = 0, m = m_ToolChains[i].size(); j < m; j++) { CToolChain *tc = m_ToolChains[i][j]; TiXmlElement *tc_root = new TiXmlElement("toolchain"); tc->Write(tc_root); ConfigRoot->LinkEndChild(tc_root); } } } /* bool CToolChainSet::Load(const CString& FileName) { if (m_Locked) return false; TiXmlDocument cfg; if (!cfg.LoadFile(FileName.GetCString())) return false; const TiXmlElement *root = cfg.RootElement(); if (0==strcmp(root->Value(),"cbp2make")) { Read(root); } // root if (0==m_ToolChains.size()) AddDefault(); return true; } bool CToolChainSet::Save(const CString& FileName) { TiXmlDocument cfg; TiXmlDeclaration *xmld = new TiXmlDeclaration("1.0", "", ""); cfg.LinkEndChild(xmld); TiXmlElement *root = new TiXmlElement("cbp2make"); cfg.LinkEndChild(root); Write(root); return cfg.SaveFile(FileName.GetCString()); } */ void CToolChainSet::Show(void) { if (m_ToolChains.size()) { int pl_count = 0, tc_count = 0; for (int i = 0, n = m_ToolChains.size(); i < n; i++) { if (m_ToolChains[i].size()>0) { tc_count += m_ToolChains[i].size(); pl_count++; } } std::cout<<"Configued "<Show(); std::cout<. */ //------------------------------------------------------------------------------ #include //------------------------------------------------------------------------------ #include "macros.h" #include "cbpunit.h" #include "cbhelper.h" #include "stlconvert.h" #include "stlfutils.h" #include "tinyxml.h" //------------------------------------------------------------------------------ CBuildUnit::CBuildUnit(void) { Clear(); } CBuildUnit::~CBuildUnit(void) { Clear(); } void CBuildUnit::Clear(void) { m_FileName.Clear(); m_Targets.Clear(); m_DoCompile = true; m_DoLink = true; //m_Type = utNone; m_Weight = 0; } CString CBuildUnit::Extension(void) const { return ExtractFileExt(m_FileName); } bool CBuildUnit::BelongToTarget(const CString& TargetName) { return ((m_Targets.GetCount()==0) || (m_Targets.FindString(TargetName)>=0)); } void CBuildUnit::Read(const TiXmlElement *UnitRoot) { char *value = 0; if ((value = (char *)UnitRoot->Attribute("filename"))) { m_FileName = value; } TiXmlNode *_option = (TiXmlNode *)UnitRoot->FirstChild("Option"); while (0!=_option) { TiXmlElement* option = _option->ToElement(); if (0!=option) { char *value = 0; if ((value = (char *)option->Attribute("compilerVar"))) { m_CompilerVariable = value; } if ((value = (char *)option->Attribute("compile"))) { m_DoCompile = StringToBoolean(value); } if ((value = (char *)option->Attribute("link"))) { m_DoLink = StringToBoolean(value); } if ((value = (char *)option->Attribute("target"))) { m_Targets.Insert(value); } if ((value = (char *)option->Attribute("weight"))) { m_Weight = StringToInteger(value); } } _option = (TiXmlNode *)UnitRoot->IterateChildren(_option); } // option } void CBuildUnit::Show(void) { #ifdef SHOW_MODE_ONELINE std::cout<. */ //------------------------------------------------------------------------------ #ifndef CBP_UNIT_H #define CBP_UNIT_H //------------------------------------------------------------------------------ #include "stlstrings.h" #include "cbptarget.h" //------------------------------------------------------------------------------ class TiXmlNode; class TiXmlElement; class CCodeBlocksProject; class CUnitWeightComparison; class CBuildUnit { friend class CUnitWeightComparison; private: CString m_FileName; CStringList m_Targets; CString m_CompilerVariable; bool m_DoCompile; bool m_DoLink; int m_Weight; // CString m_ObjectFileName; public: CString FileName(void) const { return m_FileName; } CString Extension(void) const; bool BelongToTarget(const CString& TargetName); CString CompilerVariable(void) const { return m_CompilerVariable; } bool DoCompile(void) const { return m_DoCompile; } bool DoLink(void) const { return m_DoLink; } int Weight(void) const { return m_Weight; } public: void Clear(void); void Read(const TiXmlElement *UnitRoot); void Show(void); public: CBuildUnit(void); ~CBuildUnit(void); }; #endif //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/cbhelper.h0000644000175000017500000000317512155022125016377 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #ifndef CBHELPER_H #define CBHELPER_H //------------------------------------------------------------------------------ #include "stlstrings.h" //------------------------------------------------------------------------------ static const int CASE_KEEP = 0; static const int CASE_LOWER = 1; static const int CASE_UPPER = 2; static const int QUOTE_AUTO = 0; static const int QUOTE_NEVER = 1; static const int QUOTE_ALWAYS = 2; void ShowStringList(const CString& Title, const CString& LinePrefix, const CStringList& StringList); CString MakefileFriendly(const CString& AString); CString XMLFriendly(const CString& AString); CString FlatFileName(const CString& FileName); #endif //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/buildtools.h0000644000175000017500000004757012155022124017001 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #ifndef BUILDTOOLS_H #define BUILDTOOLS_H //------------------------------------------------------------------------------ #include "stlconfig.h" #include "stlstrings.h" #include "platforms.h" #include "depsearch.h" //------------------------------------------------------------------------------ class TiXmlElement; class CBuildTool { public: enum ToolType { btOther, btPreprocessor, btAssembler, btCompiler, btResourceCompiler, btStaticLinker, btDynamicLinker, btExecutableLinker, //btConsoleExecutableLinker, btNativeLinker, btDependencyGenerator, btBuildManager, btCount }; protected: CPlatform::OS_Type m_Platform; CBuildTool::ToolType m_Type; CString m_Alias; CString m_Description; CString m_Program; CString m_MakeVariable; CString m_CommandTemplate; CStringList m_SourceExtensions; CString m_TargetExtension; CString m_GenericSwitch; bool m_NeedQuotedPath; bool m_NeedFullPath; bool m_NeedUnixPath; protected: void Read(const TiXmlElement *Root, const CString& Name, CString& Value); void Read(const TiXmlElement *Root, const CString& Name, bool& Value); void Write(TiXmlElement *Root, const CString& Name, const CString& Value); void Write(TiXmlElement *Root, const CString& Name, const bool Value); public: static ToolType Type(const CString& Name); static CString TypeName(const ToolType Type); static CString AbbrevTypeName(const ToolType Type); CBuildTool::ToolType Type(void) const { return m_Type; } CString TypeName(void) const; CString& Alias(void) { return m_Alias; } CString& Description(void) { return m_Description; } CString& Program(void) { return m_Program; } CString& MakeVariable(void) { return m_MakeVariable; } CString& CommandTemplate(void) { return m_CommandTemplate; } CStringList& SourceExtensions(void) { return m_SourceExtensions; } CString& TargetExtension(void) { return m_TargetExtension; } bool& NeedQuotedPath(void) { return m_NeedQuotedPath; } bool& NeedFullPath(void) { return m_NeedFullPath; } bool& NeedUnixPath(void) { return m_NeedUnixPath; } CString MakeCommand(const CString& CommandTemplate, CConfiguration& Arguments); CString MakeCommand(CConfiguration& Arguments); virtual bool ExpectedSourceExtension(const CString& FileExtension); virtual CBuildTool *CreateInstance(void); virtual void Clear(void); virtual void Reset(const CPlatform::OS_Type OS); virtual bool Supports(const CPlatform::OS_Type OS); virtual void Read(const TiXmlElement *BuildToolRoot); virtual void Write(TiXmlElement *BuildToolRoot); virtual void Show(void); public: CBuildTool(void); CBuildTool(const CBuildTool& BuildTool); virtual ~CBuildTool(void); }; //------------------------------------------------------------------------------ class CPreprocessor: public CBuildTool { protected: CString m_IncludeDirSwitch; CString m_DefineSwitch; public: virtual CPreprocessor *CreateInstance(void); virtual void Read(const TiXmlElement *BuildToolRoot); virtual void Write(TiXmlElement *BuildToolRoot); virtual void Show(void); public: CPreprocessor(void); CPreprocessor(const CPreprocessor& Preprocessor); virtual ~CPreprocessor(void); }; class CCompiler: public CBuildTool { protected: CString m_IncludeDirSwitch; CString m_DefineSwitch; bool m_NeedDependencies; public: CString& IncludeDirSwitch(void) { return m_IncludeDirSwitch; } CString& DefineSwitch(void) { return m_DefineSwitch; } bool& NeedDependencies(void) { return m_NeedDependencies; } public: virtual CIncludeSearchFilter *IncludeSearchFilter(void) const { return 0; } virtual CCompiler *CreateInstance(void); virtual void Read(const TiXmlElement *BuildToolRoot); virtual void Write(TiXmlElement *BuildToolRoot); virtual void Show(void); public: CCompiler(void); CCompiler(const CCompiler& Compiler); virtual ~CCompiler(void); }; class CAssembler: public CCompiler { protected: public: virtual CAssembler *CreateInstance(void); public: CAssembler(void); CAssembler(const CAssembler& Assembler); virtual ~CAssembler(void); }; class CResourceCompiler: public CCompiler { protected: public: virtual CResourceCompiler *CreateInstance(void); public: CResourceCompiler(void); CResourceCompiler(const CResourceCompiler& ResourceCompiler); virtual ~CResourceCompiler(void); }; class CLinker: public CBuildTool { protected: CString m_LibraryDirSwitch; CString m_LinkLibrarySwitch; CString m_ObjectExtension; CString m_LibraryPrefix; CString m_LibraryExtension; bool m_NeedLibraryPrefix; bool m_NeedLibraryExtension; bool m_NeedFlatObjects; public: CString& LibraryDirSwitch(void) { return m_LibraryDirSwitch; } CString& LinkLibrarySwitch(void) { return m_LinkLibrarySwitch; } CString& ObjectExtension(void) { return m_ObjectExtension; } CString& LibraryPrefix(void) { return m_LibraryPrefix; } CString& LibraryExtension(void) { return m_LibraryExtension; } bool& NeedLibraryPrefix(void) { return m_NeedLibraryPrefix; } bool& NeedLibraryExtension(void) { return m_NeedLibraryExtension; } bool& NeedFlatObjects(void) { return m_NeedFlatObjects; } public: virtual CLinker *CreateInstance(void); virtual void Read(const TiXmlElement *BuildToolRoot); virtual void Write(TiXmlElement *BuildToolRoot); virtual void Show(void); public: CLinker(void); CLinker(const CLinker& Linker); virtual ~CLinker(void); }; class CLibraryLinker: public CLinker { protected: public: virtual CLibraryLinker *CreateInstance(void); public: CLibraryLinker(void); CLibraryLinker(const CLibraryLinker& LibraryLinker); virtual ~CLibraryLinker(void); }; class CStaticLinker: public CLibraryLinker { protected: public: virtual CStaticLinker *CreateInstance(void); public: CStaticLinker(void); CStaticLinker(const CStaticLinker& StaticLinker); virtual ~CStaticLinker(void); }; class CDynamicLinker: public CLibraryLinker { protected: public: virtual CDynamicLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); public: CDynamicLinker(void); CDynamicLinker(const CDynamicLinker& DynamicLinker); virtual ~CDynamicLinker(void); }; class CExecutableLinker: public CLinker { protected: CString m_Option_WinGUI; public: virtual CExecutableLinker *CreateInstance(void); CString OptionWinGUI(void) const { return m_Option_WinGUI; } virtual void Read(const TiXmlElement *BuildToolRoot); virtual void Write(TiXmlElement *BuildToolRoot); virtual void Show(void); public: CExecutableLinker(void); CExecutableLinker(const CExecutableLinker& ExecutableLinker); virtual ~CExecutableLinker(void); }; class CDependencyGenerator: public CBuildTool { protected: public: virtual CDependencyGenerator *CreateInstance(void); virtual void Read(const TiXmlElement *BuildToolRoot); virtual void Write(TiXmlElement *BuildToolRoot); virtual void Show(void); public: CDependencyGenerator(void); CDependencyGenerator(const CDependencyGenerator& DependencyGenerator); virtual ~CDependencyGenerator(void); }; class CBuildManager: public CBuildTool { protected: public: virtual CBuildManager *CreateInstance(void); virtual void Read(const TiXmlElement *BuildToolRoot); virtual void Write(TiXmlElement *BuildToolRoot); virtual void Show(void); public: CBuildManager(void); CBuildManager(const CBuildManager& BuildManager); virtual ~CBuildManager(void); }; //------------------------------------------------------------------------------ class CGNUCCompiler: public CCompiler { private: CCppIncludeSearchFilter m_IncludeSearchFilter; public: virtual CIncludeSearchFilter *IncludeSearchFilter(void) const; virtual CGNUCCompiler *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CGNUCCompiler(void); }; class CGNUCppCompiler: public CCompiler { private: CCppIncludeSearchFilter m_IncludeSearchFilter; public: virtual CIncludeSearchFilter *IncludeSearchFilter(void) const; virtual CGNUCppCompiler *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CGNUCppCompiler(void); }; class CGNUFortran77Compiler: public CCompiler { public: virtual CGNUFortran77Compiler *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CGNUFortran77Compiler(void); }; class CGNUFortran90Compiler: public CCompiler { public: virtual CGNUFortran90Compiler *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CGNUFortran90Compiler(void); }; class CGNUWindowsResourceCompiler: public CResourceCompiler { public: virtual CGNUWindowsResourceCompiler *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); virtual bool Supports(const CPlatform::OS_Type OS); CGNUWindowsResourceCompiler(void); }; class CGNUStaticLinker: public CStaticLinker { public: virtual CGNUStaticLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CGNUStaticLinker(void); }; class CGNUDynamicLinker: public CDynamicLinker { public: virtual CGNUDynamicLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CGNUDynamicLinker(void); }; class CGNUExecutableLinker: public CExecutableLinker { public: virtual CGNUExecutableLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CGNUExecutableLinker(void); }; //------------------------------------------------------------------------------ class CGNUAVRCCompiler: public CCompiler { private: CCppIncludeSearchFilter m_IncludeSearchFilter; public: virtual CIncludeSearchFilter *IncludeSearchFilter(void) const; virtual CGNUAVRCCompiler *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CGNUAVRCCompiler(void); }; class CGNUAVRCppCompiler: public CCompiler { private: CCppIncludeSearchFilter m_IncludeSearchFilter; public: virtual CIncludeSearchFilter *IncludeSearchFilter(void) const; virtual CGNUAVRCppCompiler *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CGNUAVRCppCompiler(void); }; class CGNUAVRStaticLinker: public CStaticLinker { public: virtual CGNUAVRStaticLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CGNUAVRStaticLinker(void); }; class CGNUAVRDynamicLinker: public CDynamicLinker { public: virtual CGNUAVRDynamicLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CGNUAVRDynamicLinker(void); }; class CGNUAVRExecutableLinker: public CExecutableLinker { public: virtual CGNUAVRExecutableLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CGNUAVRExecutableLinker(void); }; class CGNUAVRDependencyGenerator: public CDependencyGenerator { public: virtual CDependencyGenerator *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); public: CGNUAVRDependencyGenerator(void); }; //------------------------------------------------------------------------------ class CGNUARMCCompiler: public CCompiler { private: CCppIncludeSearchFilter m_IncludeSearchFilter; public: virtual CIncludeSearchFilter *IncludeSearchFilter(void) const; virtual CGNUARMCCompiler *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CGNUARMCCompiler(void); }; class CGNUARMCppCompiler: public CCompiler { private: CCppIncludeSearchFilter m_IncludeSearchFilter; public: virtual CIncludeSearchFilter *IncludeSearchFilter(void) const; virtual CGNUARMCppCompiler *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CGNUARMCppCompiler(void); }; class CGNUARMWindowsResourceCompiler: public CResourceCompiler { public: virtual CGNUARMWindowsResourceCompiler *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); virtual bool Supports(const CPlatform::OS_Type OS); CGNUARMWindowsResourceCompiler(void); }; class CGNUARMStaticLinker: public CStaticLinker { public: virtual CGNUARMStaticLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CGNUARMStaticLinker(void); }; class CGNUARMDynamicLinker: public CDynamicLinker { public: virtual CGNUARMDynamicLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CGNUARMDynamicLinker(void); }; class CGNUARMExecutableLinker: public CExecutableLinker { public: virtual CGNUARMExecutableLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CGNUARMExecutableLinker(void); }; //------------------------------------------------------------------------------ class CBorlandCppCompiler: public CCompiler { private: CCppIncludeSearchFilter m_IncludeSearchFilter; public: virtual CIncludeSearchFilter *IncludeSearchFilter(void) const; virtual CBorlandCppCompiler *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); virtual bool Supports(const CPlatform::OS_Type OS); CBorlandCppCompiler(void); }; class CBorlandResourceCompiler: public CResourceCompiler { public: virtual CBorlandResourceCompiler *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); virtual bool Supports(const CPlatform::OS_Type OS); CBorlandResourceCompiler(void); }; class CBorlandStaticLinker: public CStaticLinker { public: virtual CBorlandStaticLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); virtual bool Supports(const CPlatform::OS_Type OS); CBorlandStaticLinker(void); }; class CBorlandDynamicLinker: public CDynamicLinker { public: virtual CBorlandDynamicLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); virtual bool Supports(const CPlatform::OS_Type OS); CBorlandDynamicLinker(void); }; class CBorlandExecutableLinker: public CExecutableLinker { public: virtual CBorlandExecutableLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); virtual bool Supports(const CPlatform::OS_Type OS); CBorlandExecutableLinker(void); }; class CBorlandConsoleExecutableLinker: public CExecutableLinker { public: virtual CBorlandConsoleExecutableLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); virtual bool Supports(const CPlatform::OS_Type OS); CBorlandConsoleExecutableLinker(void); }; //------------------------------------------------------------------------------ class CIntelCCompiler: public CCompiler { private: CCppIncludeSearchFilter m_IncludeSearchFilter; public: virtual CIncludeSearchFilter *IncludeSearchFilter(void) const; virtual CIntelCCompiler *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CIntelCCompiler(void); }; class CIntelCppCompiler: public CCompiler { private: CCppIncludeSearchFilter m_IncludeSearchFilter; public: virtual CIncludeSearchFilter *IncludeSearchFilter(void) const; virtual CIntelCppCompiler *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CIntelCppCompiler(void); }; class CIntelStaticLinker: public CStaticLinker { public: virtual CIntelStaticLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CIntelStaticLinker(void); }; class CIntelDynamicLinker: public CDynamicLinker { public: virtual CIntelDynamicLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CIntelDynamicLinker(void); }; class CIntelExecutableLinker: public CExecutableLinker { public: virtual CIntelExecutableLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); CIntelExecutableLinker(void); }; //------------------------------------------------------------------------------ class CMSVCCompiler: public CCompiler { private: CCppIncludeSearchFilter m_IncludeSearchFilter; public: virtual CIncludeSearchFilter *IncludeSearchFilter(void) const; virtual CMSVCCompiler *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); virtual bool Supports(const CPlatform::OS_Type OS); CMSVCCompiler(void); }; class CMSVCppCompiler: public CCompiler { private: CCppIncludeSearchFilter m_IncludeSearchFilter; public: virtual CIncludeSearchFilter *IncludeSearchFilter(void) const; virtual CMSVCppCompiler *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); virtual bool Supports(const CPlatform::OS_Type OS); CMSVCppCompiler(void); }; class CMSVCResourceCompiler: public CResourceCompiler { public: virtual CMSVCResourceCompiler *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); virtual bool Supports(const CPlatform::OS_Type OS); CMSVCResourceCompiler(void); }; class CMSVCStaticLinker: public CStaticLinker { public: virtual CMSVCStaticLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); virtual bool Supports(const CPlatform::OS_Type OS); CMSVCStaticLinker(void); }; class CMSVCDynamicLinker: public CDynamicLinker { public: virtual CMSVCDynamicLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); virtual bool Supports(const CPlatform::OS_Type OS); CMSVCDynamicLinker(void); }; class CMSVCExecutableLinker: public CExecutableLinker { public: virtual CMSVCExecutableLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); virtual bool Supports(const CPlatform::OS_Type OS); CMSVCExecutableLinker(void); }; class CMSVCConsoleExecutableLinker: public CExecutableLinker { public: virtual CMSVCConsoleExecutableLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); virtual bool Supports(const CPlatform::OS_Type OS); CMSVCConsoleExecutableLinker(void); }; class CMSVCNativeExecutableLinker: public CExecutableLinker { public: virtual CMSVCNativeExecutableLinker *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); virtual bool Supports(const CPlatform::OS_Type OS); CMSVCNativeExecutableLinker(void); }; class CMSVCBuildManager: public CBuildManager { public: virtual CMSVCBuildManager *CreateInstance(void); virtual void Reset(const CPlatform::OS_Type OS); virtual bool Supports(const CPlatform::OS_Type OS); public: CMSVCBuildManager(void); }; //------------------------------------------------------------------------------ static const CString TPL_COMPILER = "$compiler"; static const CString TPL_RES_COMPILER = "$rescomp"; static const CString TPL_LINKER = "$linker"; static const CString TPL_LIB_LINKER = "$lib_linker"; static const CString TPL_OPTIONS = "$options"; static const CString TPL_RES_INCLUDES = "$res_includes"; static const CString TPL_INCLUDES = "$includes"; static const CString TPL_FILE = "$file"; static const CString TPL_OBJECT = "$object"; static const CString TPL_RES_OUTPUT = "$resource_output"; static const CString TPL_OUTPUT = "$output"; static const CString TPL_STL_OUTPUT = "$static_output"; static const CString TPL_EXE_OUTPUT = "$exe_output"; static const CString TPL_LNK_OPTIONS = "$link_options"; static const CString TPL_LNK_OBJECTS = "$link_objects"; static const CString TPL_LNK_RES_OBJECTS = "$link_resobjects"; static const CString TPL_LIB_DIRS = "$libdirs"; static const CString TPL_LIBS = "$libs"; //static const CString TPL_ = "$"; #endif //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/cbglobalvar.cpp0000644000175000017500000003221012155022125017414 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #include //------------------------------------------------------------------------------ #include "tinyxml.h" #include "stlfutils.h" #include "cbglobalvar.h" #include "cbhelper.h" //------------------------------------------------------------------------------ CGlobalVariable::CGlobalVariable(void) { Clear(); } CGlobalVariable::~CGlobalVariable(void) { Clear(); } int CGlobalVariable::Count(void) { return m_Fields.GetCount(); } CString CGlobalVariable::GetField(const int Index) { return m_Fields.Variable(Index).GetName(); } CString CGlobalVariable::GetValue(const int Index) { return m_Fields.Variable(Index).GetString(); } CString CGlobalVariable::Convert(const CString& Value, const int Case) { CString result, tmp; int state = 0; for (int i = 0, n = Value.GetLength(); i < n; i++) { switch (state) { case 0: { if (Value[i]=='$') { state = 1; tmp += Value[i]; } else result += Value[i]; break; } case 1: { tmp += Value[i]; if (Value[i]=='(') { state = 2; } else { state = 0; result += tmp; tmp.Clear(); } break; } case 2: { tmp += Value[i]; if (Value[i]=='#') { state = 3; } else { state = 0; result += tmp; tmp.Clear(); } break; } case 3: { tmp += Value[i]; if (Value[i]==')') { state = 0; CString gcv_name = SubStr(tmp,3,tmp.GetLength()-2); //CString mfv_name = UpperCase(MakefileFriendly(gcv_name)); CString mfv_name = MakefileFriendly(gcv_name); switch (Case) { case 1: { mfv_name = LowerCase(mfv_name); break; } case 2: { mfv_name = UpperCase(mfv_name); break; } default: break; } result += "$("+mfv_name+")"; tmp.Clear(); } break; } } } return result; } CString CGlobalVariable::Base(void) { if (m_Base.IsEmpty()) { return "."; } return m_Base; } CString CGlobalVariable::Include(void) { if (m_Include.IsEmpty()) { if (m_Base.IsEmpty()) { return "."; } else { return JoinPaths(Base(),"/include"); } } return m_Include; } CString CGlobalVariable::Lib(void) { if (m_Lib.IsEmpty()) { if (m_Base.IsEmpty()) { return "."; } else { return JoinPaths(Base(),"/lib"); } } return m_Lib; } void CGlobalVariable::Clear(void) { m_Name.Clear(); m_Base.Clear(); m_Include.Clear(); m_Lib.Clear(); m_Obj.Clear(); m_Cflags.Clear(); m_Lflags.Clear(); m_Fields.Clear(); } void CGlobalVariable::Add(const CString& Name, const CString& Value) { CString name = Name; int field = GuessStr(Name,"base include lib obj cflags lflags", name,false); switch (field) { case 0: { m_Base = Value; break; } case 1: { m_Include = Value; break; } case 2: { m_Lib = Value; break; } case 3: { m_Obj = Value; break; } case 4: { m_Cflags = Value; break; } case 5: { m_Lflags = Value; break; } default: { field = m_Fields.VarIndex(Name); if (field >= 0) { m_Fields.Variable(field).SetString(Value); } else { m_Fields.InsertStringVariable(Name,Value); } } } } void CGlobalVariable::Remove(const CString& Name) { m_Fields.RemoveVariable(Name); } void CGlobalVariable::Read(const TiXmlElement *GlobalVariableRoot) { char *value = 0; if ((value = (char *)GlobalVariableRoot->Attribute("name"))) { m_Name = value; } if ((value = (char *)GlobalVariableRoot->Attribute("description"))) { m_Description = value; } const TiXmlNode *_built_in = GlobalVariableRoot->FirstChild("builtin"); if (0!=_built_in) { TiXmlElement *built_in = (TiXmlElement *)_built_in->ToElement(); if (0!=built_in) { if ((value = (char *)built_in->Attribute("base"))) { m_Base = value; } if ((value = (char *)built_in->Attribute("include"))) { m_Include = value; } if ((value = (char *)built_in->Attribute("lib"))) { m_Lib = value; } if ((value = (char *)built_in->Attribute("obj"))) { m_Obj = value; } if ((value = (char *)built_in->Attribute("cflags"))) { m_Cflags = value; } if ((value = (char *)built_in->Attribute("lflags"))) { m_Lflags = value; } /* if ((value = (char *)built_in->Attribute(""))) { m_ = value; } */ } // built_in } // _built_in const TiXmlNode *_user = GlobalVariableRoot->FirstChild("user"); if (0!=_user) { TiXmlElement *user = (TiXmlElement *)_user->ToElement(); if (0!=user) { TiXmlNode *_field = user->FirstChild("field"); while (0!=_field) { TiXmlElement *field = (TiXmlElement *)_field->ToElement(); if (0!=field) { CString field_name, field_value; char *value = 0; if ((value = (char *)field->Attribute("name"))) { field_name = value; } if ((value = (char *)field->Attribute("value"))) { field_value = value; } m_Fields.InsertStringVariable(field_name,field_value); /* if ((value = (char *)field->Attribute(""))) { m_ = value; } */ } _field = user->IterateChildren(_field); } } // user } // _user } void CGlobalVariable::Write(TiXmlElement *GlobalVariableRoot) { GlobalVariableRoot->SetAttribute("name",m_Name.GetCString()); GlobalVariableRoot->SetAttribute("description",m_Description.GetCString()); TiXmlElement *built_in = new TiXmlElement("builtin"); //built_in->SetAttribute("name",m_Name.GetCString()); built_in->SetAttribute("base",m_Base.GetCString()); built_in->SetAttribute("include",m_Include.GetCString()); built_in->SetAttribute("lib",m_Lib.GetCString()); built_in->SetAttribute("obj",m_Obj.GetCString()); built_in->SetAttribute("cflags",m_Cflags.GetCString()); built_in->SetAttribute("lflags",m_Lflags.GetCString()); //built_in->SetAttribute("",m_.GetCString()); GlobalVariableRoot->LinkEndChild(built_in); TiXmlElement *fields = new TiXmlElement("user"); GlobalVariableRoot->LinkEndChild(fields); for (int i = 0, n = m_Fields.GetCount(); i < n; i++) { CVariable& v = m_Fields.Variable(i); TiXmlElement *field = new TiXmlElement("field"); field->SetAttribute("name",v.GetName().GetCString()); field->SetAttribute("value",v.GetString().GetCString()); fields->LinkEndChild(field); } } void CGlobalVariable::Show(void) { std::cout<<"Name: "<=0)&&(IndexName() == Name) return v; } return 0; } CGlobalVariable *CGlobalVariableSet::Add(const CString& Name, const CString& Description) { CGlobalVariable *v = Find(Name); if (0==v) { v = new CGlobalVariable(); v->Name() = Name; v->Description() = Description; m_Variables.push_back(v); } return v; } void CGlobalVariableSet::Remove(const CString& Name) { CGlobalVariable *v = Find(Name); if (0!=v) { m_Variables.erase(std::find(m_Variables.begin(),m_Variables.end(),v)); delete v; } } void CGlobalVariableSet::Read(const TiXmlElement *GlobalVariableSetRoot) { char *value = 0; if ((value = (char *)GlobalVariableSetRoot->Attribute("name"))) { m_Name = value; } TiXmlNode *_v_root = (TiXmlNode *)GlobalVariableSetRoot->FirstChild("variable"); while (0!=_v_root) { TiXmlElement *v_root = _v_root->ToElement(); if (0!=v_root) { CGlobalVariable *v = new CGlobalVariable(); v->Read(v_root); m_Variables.push_back(v); } _v_root = (TiXmlNode *)GlobalVariableSetRoot->IterateChildren(_v_root); } } void CGlobalVariableSet::Write(TiXmlElement *GlobalVariableSetRoot) { GlobalVariableSetRoot->SetAttribute("name",m_Name.GetCString()); for (size_t i = 0, n = m_Variables.size(); i < n; i++) { CGlobalVariable *v = m_Variables[i]; TiXmlElement *v_root = new TiXmlElement("variable"); v_root->SetAttribute("name",m_Name.GetCString()); v->Write(v_root); GlobalVariableSetRoot->LinkEndChild(v_root); } } void CGlobalVariableSet::Show(void) { std::cout<<"Variable set name: "<Show(); } } //------------------------------------------------------------------------------ CGlobalVariableConfig::CGlobalVariableConfig(void) { Clear(); } CGlobalVariableConfig::~CGlobalVariableConfig(void) { Clear(); } void CGlobalVariableConfig::Clear(void) { for (size_t i = 0; i < m_VariableSets.size(); i++) delete m_VariableSets[i]; m_VariableSets.clear(); //m_HaveDefaults = false; } CGlobalVariableSet* CGlobalVariableConfig::Get(const size_t Index) { if ((Index>=0)&&(IndexName() == Name) return vset; } return 0; } CGlobalVariableSet* CGlobalVariableConfig::Add(const CString& Name) { CGlobalVariableSet *vset = Find(Name); if (0==vset) { vset = new CGlobalVariableSet(); vset->Name() = Name; m_VariableSets.push_back(vset); } return vset; } void CGlobalVariableConfig::AddDefault(void) { //if (m_HaveDefaults) return; CGlobalVariableSet *vset = Find("default"); if (0==vset) { vset = new CGlobalVariableSet(); vset->Name() = "default"; m_VariableSets.push_back(vset); } //m_HaveDefaults = true; } void CGlobalVariableConfig::Remove(const CString& Name) { CGlobalVariableSet *vset = Find(Name); if (0!=vset) { m_VariableSets.erase(std::find(m_VariableSets.begin(),m_VariableSets.end(),vset)); delete vset; } } void CGlobalVariableConfig::Read(const TiXmlElement *GlobalVariableConfigRoot) { TiXmlNode *_vset_root = (TiXmlNode *)GlobalVariableConfigRoot->FirstChild("variableset"); while (0!=_vset_root) { TiXmlElement *vset_root = _vset_root->ToElement(); if (0!=vset_root) { char *value = 0; CString name; if ((value = (char *)vset_root->Attribute("name"))) { name = value; } CGlobalVariableSet *vset = Find(name); bool custom_vset = (0==vset); if (custom_vset) { vset = new CGlobalVariableSet(); } vset->Read(vset_root); if (custom_vset) { m_VariableSets.push_back(vset); } } _vset_root = (TiXmlNode *)GlobalVariableConfigRoot->IterateChildren(_vset_root); } AddDefault(); } void CGlobalVariableConfig::Write(TiXmlElement *GlobalVariableConfigRoot) { for (size_t i = 0, n = m_VariableSets.size(); i < n; i++) { CGlobalVariableSet *vset = m_VariableSets[i]; TiXmlElement *vset_root = new TiXmlElement("variableset"); vset->Write(vset_root); GlobalVariableConfigRoot->LinkEndChild(vset_root); } } void CGlobalVariableConfig::Show(void) { std::cout<<"Global compiler variables: "<Show(); } } //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/cbproject.h0000644000175000017500000000655512155022124016572 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #ifndef CBPROJECT_H #define CBPROJECT_H //------------------------------------------------------------------------------ #include "stlstrings.h" #include "stlconfig.h" //#include "cbptarget.h" //#include "cbpunit.h" #include "depsearch.h" #include "makefile.h" //------------------------------------------------------------------------------ class CBuildTarget; class CVirtualTarget; class CBuildUnit; class CToolChain; class CCodeBlocksBuildConfig; class TiXmlElement; class CCodeBlocksProject { private: //bool m_ValidProject; int m_VersionMajor; int m_VersionMinor; CString m_Title; CString m_DefaultTarget; CString m_Compiler; bool m_ExtendedObjectNames; CStringList m_CompilerOptions; CStringList m_CompilerDirectories; CStringList m_LinkerOptions; CStringList m_LinkerLibraries; CStringList m_LinkerDirectories; CStringList m_ResourceCompilerDirectories; CStringList m_BeforeBuildCommands; CStringList m_AfterBuildCommands; bool m_ForceBeforeBuildCommands; bool m_ForceAfterBuildCommands; std::vector m_BuildTargets; std::vector m_VirtualTargets; std::vector m_Units; CConfiguration m_Environment; CStringList m_Platforms; // bool m_SinglePlatform; std::vector m_BuildTargetIndex; std::vector m_VirtualTargetIndex; std::vector m_UnitIndex; std::vector m_ToolChainIndex; std::vector m_TargetToolChainIndex; // CDependencyInfo m_Dependencies; //CStringList m_MakefileText; CMakefile m_Makefile; protected: //void DecorateTargetNames(void); void SortUnitsByWeight(void); public: void Clear(void); void Read(const TiXmlElement *ProjectRoot); bool LoadProject(const CString& FileName); void Show(void); private: void UpdatePlatformIndex(const size_t Platform, CCodeBlocksBuildConfig& Config); void UpdateTargetIndex(const int Target, CCodeBlocksBuildConfig& Config); public: static CString DecorateVariableName(const CString& VariableName, const int Case = 0); static CString DecorateTargetName(const CString& TargetName, const int Case = 2); CString ToolChainSuffix(const int ToolChainIndex, CCodeBlocksBuildConfig& Config); //bool GenerateMakefileText(const CString& FileName, CCodeBlocksBuildConfig& Config); bool GenerateMakefile(const CString& FileName, CCodeBlocksBuildConfig& Config); public: CCodeBlocksProject(void); ~CCodeBlocksProject(void); }; #endif //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/platforms.cpp0000644000175000017500000003765212155022125017164 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #include //------------------------------------------------------------------------------ #include "platforms.h" #include "stlconvert.h" #include "stlfutils.h" #include "tinyxml.h" //------------------------------------------------------------------------------ CPlatform::CPlatform(void) { Clear(); } CPlatform::CPlatform(const CPlatform& Platform) { Assign(Platform); } CPlatform::~CPlatform(void) { Clear(); } void CPlatform::Clear(void) { m_OS_Type = OS_Unix; m_Active = false; m_Cmd_Null.Clear(); m_Cmd_Copy.Clear(); m_Cmd_Move.Clear(); m_Cmd_Make.Clear(); m_Tool_Make.Clear(); //m_Cmd_TestFile.Clear(); m_Cmd_RemoveFile.Clear(); m_Cmd_ForceRemoveFile.Clear(); //m_Cmd_TestDir.Clear(); m_Cmd_MakeDir.Clear(); m_Cmd_TestMakeDir.Clear(); m_Cmd_ForceMakeDir.Clear(); m_Cmd_RemoveDir.Clear(); m_Cmd_PrintWorkDir.Clear(); m_Cmd_EvalWorkDir.Clear(); m_Cmd_ChangeDir.Clear(); m_PathDelimiter = '/'; } void CPlatform::Assign(const CPlatform& Platform) { m_OS_Type = Platform.m_OS_Type; m_Active = Platform.m_Active; m_Cmd_Null = Platform.m_Cmd_Null; m_Cmd_Copy = Platform.m_Cmd_Copy; m_Cmd_Move = Platform.m_Cmd_Move; m_Cmd_Make = Platform.m_Cmd_Make; m_Tool_Make = Platform.m_Tool_Make; //m_Cmd_TestFile = Platform.m_Cmd_TestFile; m_Cmd_RemoveFile = Platform.m_Cmd_RemoveFile; m_Cmd_ForceRemoveFile = Platform.m_Cmd_ForceRemoveFile; //m_Cmd_TestDir = Platform.m_Cmd_TestDir; m_Cmd_MakeDir = Platform.m_Cmd_MakeDir; m_Cmd_TestMakeDir = Platform.m_Cmd_TestMakeDir; m_Cmd_ForceMakeDir = Platform.m_Cmd_ForceMakeDir; m_Cmd_RemoveDir = Platform.m_Cmd_RemoveDir; m_Cmd_PrintWorkDir = Platform.m_Cmd_PrintWorkDir; m_Cmd_EvalWorkDir = Platform.m_Cmd_EvalWorkDir; m_Cmd_ChangeDir = Platform.m_Cmd_ChangeDir; m_PathDelimiter = Platform.m_PathDelimiter; } CString CPlatform::Name(const OS_Type PlatformOS) { switch (PlatformOS) { default: case CPlatform::OS_Other: case CPlatform::OS_Count: { } case CPlatform::OS_Unix: { return STR_UNIX; } case CPlatform::OS_Windows: { return STR_WINDOWS; } case CPlatform::OS_Mac: { return STR_MAC; } } return "Other"; } CPlatform::OS_Type CPlatform::OS(CString& PlatformName) { if (PlatformName==STR_UNIX) return CPlatform::OS_Unix; if (PlatformName==STR_WINDOWS) return CPlatform::OS_Windows; if (PlatformName==STR_MAC) return CPlatform::OS_Mac; return CPlatform::OS_Other; } CString CPlatform::Name(void) { return Name(m_OS_Type); } CString CPlatform::Pd(const CString& Path) const { if (m_OS_Type==OS_Windows) { return MakeWindowsPath(Path); } else { return MakeUnixPath(Path); } } CString CPlatform::SpecialChars(void) const { if (m_OS_Type==OS_Windows) { return " "; } else { return ALPHABET_SHELL_CHARS; } } CString CPlatform::ProtectPath(const CString& Path, const int QuoteMode) { if (m_OS_Type==OS_Windows) { //return QuoteSpaces(Path,QuoteMode); return ShieldChars(Path,this->SpecialChars()); } else { return ShieldChars(Path,this->SpecialChars()); } } CString CPlatform::Copy(const CString& Source, const CString& Destination) const { return FindReplaceStr(FindReplaceStr(m_Cmd_Copy,"$src",Source),"$dst",Destination); } CString CPlatform::Move(const CString& Source, const CString& Destination) const { return FindReplaceStr(FindReplaceStr(m_Cmd_Move,"$src",Source),"$dst",Destination); } CString CPlatform::Make(const CString& Options, const CString& Path) const { return FindReplaceStr(FindReplaceStr(m_Cmd_Make,"$opts",Options),"$file",Path); } CString CPlatform::RemoveFile(const CString& Path) const { return FindReplaceStr(m_Cmd_RemoveFile,"$file",Path); } CString CPlatform::ForceRemoveFile(const CString& Path) const { return FindReplaceStr(m_Cmd_ForceRemoveFile,"$file",Path); } CString CPlatform::MakeDir(const CString& Path) const { return FindReplaceStr(m_Cmd_MakeDir,"$dir",Path); } CString CPlatform::TestMakeDir(const CString& Path) const { return FindReplaceStr(m_Cmd_TestMakeDir,"$dir",Path); } CString CPlatform::ForceMakeDir(const CString& Path) const { return FindReplaceStr(m_Cmd_ForceMakeDir,"$dir",Path); } CString CPlatform::RemoveDir(const CString& Path) const { return FindReplaceStr(m_Cmd_RemoveDir,"$dir",Path); } CString CPlatform::PrintWorkDir(void) const { return m_Cmd_PrintWorkDir; } CString CPlatform::EvalWorkDir(void) const { return m_Cmd_EvalWorkDir; } CString CPlatform::ChangeDir(const CString& Path) const { return FindReplaceStr(m_Cmd_ChangeDir,"$dir",Path); } CString CPlatform::MakefileCmd(const CString& Command) const { if (OS_Windows==m_OS_Type) return "cmd /c "+Command; return Command; } bool CPlatform::IsStaticLibraryExtension(const CString& Ext) const { return (m_StaticLibraryExtensions.FindString(Ext) >= 0); } bool CPlatform::IsDynamicLibraryExtension(const CString& Ext) const { return (m_DynamicLibraryExtensions.FindString(Ext) >= 0); } void CPlatform::Reset(const CPlatform::OS_Type OS) { m_OS_Type = OS; switch (m_OS_Type) { default: case CPlatform::OS_Unix: { m_Cmd_Null = "/dev/null"; m_Cmd_Copy = "cp -p $src $dst"; m_Cmd_Move = "mv $src $dst"; m_Cmd_Make = "make $opts -f $file"; m_Tool_Make = "make"; //m_Cmd_TestFile = "test -f $file"; m_Cmd_RemoveFile = "rm $file"; m_Cmd_ForceRemoveFile = "rm -f $file"; //m_Cmd_TestDir = "test -d $dir"; m_Cmd_MakeDir = "mkdir $dir"; m_Cmd_TestMakeDir = "test -d $dir || mkdir -p $dir"; m_Cmd_ForceMakeDir = "mkdir -p $dir"; m_Cmd_RemoveDir = "rm -rf $dir"; m_Cmd_PrintWorkDir = "pwd"; m_Cmd_EvalWorkDir = "`pwd`"; m_Cmd_ChangeDir = "cd $dir"; m_PathDelimiter = '/'; // m_StaticLibraryExtensions.Clear()<<"a"<<"lib"; m_DynamicLibraryExtensions.Clear()<<"so"; break; } case CPlatform::OS_Windows: { m_Cmd_Null = "NUL"; m_Cmd_Copy = "copy $src $dst"; m_Cmd_Move = "move $src $dst"; m_Cmd_Make = "make $opts -f $file"; m_Tool_Make = "make"; //m_Cmd_TestFile = "if exist $file"; m_Cmd_RemoveFile = "del $file"; m_Cmd_ForceRemoveFile = "del /f $file"; //m_Cmd_TestDir = "if exist $dir"; m_Cmd_MakeDir = "md $dir"; m_Cmd_TestMakeDir = "if not exist $dir md $dir"; m_Cmd_ForceMakeDir = "md $dir"; m_Cmd_RemoveDir = "rd $dir"; m_Cmd_PrintWorkDir = "echo %cd%"; m_Cmd_EvalWorkDir = "%cd%"; m_Cmd_ChangeDir = "cd $dir"; m_PathDelimiter = '\\'; // m_StaticLibraryExtensions.Clear()<<"lib"<<"a"; m_DynamicLibraryExtensions.Clear()<<"dll"; break; } case CPlatform::OS_Mac: { m_Cmd_Null = "/dev/null"; m_Cmd_Copy = "cp -p $src $dst"; m_Cmd_Move = "mv $src $dst"; m_Cmd_Make = "make $opts -f $file"; m_Tool_Make = "make"; //m_Cmd_TestFile = "test -f $file"; m_Cmd_RemoveFile = "rm $file"; m_Cmd_ForceRemoveFile = "rm -f $file"; //m_Cmd_TestDir = "test -d $dir"; m_Cmd_MakeDir = "mkdir $dir"; m_Cmd_TestMakeDir = "test -d $dir || mkdir -p $dir"; m_Cmd_ForceMakeDir = "mkdir -p $dir"; m_Cmd_RemoveDir = "rm -rf $dir"; m_Cmd_PrintWorkDir = "pwd"; m_Cmd_EvalWorkDir = "`pwd`"; m_Cmd_ChangeDir = "cd $dir"; m_PathDelimiter = '/'; // m_StaticLibraryExtensions.Clear()<<"a"; m_DynamicLibraryExtensions.Clear()<<"dylib"; break; } } } void CPlatform::Read(const TiXmlElement *Root, const CString& Name, CString& Value) { TiXmlNode *_command = (TiXmlNode *)Root->FirstChild("command"); while (0!=_command) { TiXmlElement* command = _command->ToElement(); //if (strcmp(command->Value(),"command")!=0) break; if (0!=command) { char *value = 0; if ((value = (char *)command->Attribute(Name.GetCString()))) { Value = value; } } _command = (TiXmlNode *)Root->IterateChildren(_command); } // command } void CPlatform::Read(const TiXmlElement *PlatformRoot) { char *value = 0; if ((value = (char *)PlatformRoot->Attribute("name"))) { CString name = value; m_OS_Type = OS(name); } Reset(m_OS_Type); if ((value = (char *)PlatformRoot->Attribute("path_delimiter"))) { m_PathDelimiter = value[0]; } /* if ((value = (char *)PlatformRoot->Attribute(""))) { m_ = value; } */ Read(PlatformRoot,"make_file",m_Cmd_Make); Read(PlatformRoot,"make_tool",m_Tool_Make); Read(PlatformRoot,"copy_file",m_Cmd_Copy); Read(PlatformRoot,"move_file",m_Cmd_Move); Read(PlatformRoot,"remove_file",m_Cmd_RemoveFile); Read(PlatformRoot,"force_remove_file",m_Cmd_ForceRemoveFile); Read(PlatformRoot,"make_dir",m_Cmd_MakeDir); Read(PlatformRoot,"test_make_dir",m_Cmd_TestMakeDir); Read(PlatformRoot,"force_make_dir",m_Cmd_ForceMakeDir); Read(PlatformRoot,"remove_dir",m_Cmd_RemoveDir); Read(PlatformRoot,"print_work_dir",m_Cmd_PrintWorkDir); Read(PlatformRoot,"eval_work_dir",m_Cmd_EvalWorkDir); Read(PlatformRoot,"change_dir",m_Cmd_ChangeDir); { CString s; CStringList l; Read(PlatformRoot,"static_lib_ext",s); if (!s.IsEmpty()) { ParseStr(s,' ',l); l.RemoveDuplicates(); l.RemoveEmpty(); if (!l.IsEmpty()) { m_StaticLibraryExtensions = l; } } } { CString s; CStringList l; Read(PlatformRoot,"dynamic_lib_ext",s); if (!s.IsEmpty()) { ParseStr(s,' ',l); l.RemoveDuplicates(); l.RemoveEmpty(); if (!l.IsEmpty()) { m_DynamicLibraryExtensions = l; } } } //Read(PlatformRoot,"",m_); } void CPlatform::Write(TiXmlElement *Root, const CString& Name, const CString& Value) { TiXmlElement *command = new TiXmlElement("command"); command->SetAttribute(Name.GetCString(),Value.GetCString()); Root->LinkEndChild(command); } void CPlatform::Write(TiXmlElement *PlatformRoot) { PlatformRoot->SetAttribute("name",Name().GetCString()); PlatformRoot->SetAttribute("path_delimiter",CString(m_PathDelimiter).GetCString()); //PlatformRoot->SetAttribute("",m_.GetCString()); Write(PlatformRoot,"make_file",m_Cmd_Make); Write(PlatformRoot,"make_tool",m_Tool_Make); Write(PlatformRoot,"copy_file",m_Cmd_Copy); Write(PlatformRoot,"move_file",m_Cmd_Move); Write(PlatformRoot,"remove_file",m_Cmd_RemoveFile); Write(PlatformRoot,"force_remove_file",m_Cmd_ForceRemoveFile); Write(PlatformRoot,"make_dir",m_Cmd_MakeDir); Write(PlatformRoot,"test_make_dir",m_Cmd_TestMakeDir); Write(PlatformRoot,"force_make_dir",m_Cmd_ForceMakeDir); Write(PlatformRoot,"remove_dir",m_Cmd_RemoveDir); Write(PlatformRoot,"print_work_dir",m_Cmd_PrintWorkDir); Write(PlatformRoot,"eval_work_dir",m_Cmd_EvalWorkDir); Write(PlatformRoot,"change_dir",m_Cmd_ChangeDir); Write(PlatformRoot,"static_lib_ext",m_StaticLibraryExtensions.Join(" ")); Write(PlatformRoot,"dynamic_lib_ext",m_DynamicLibraryExtensions.Join(" ")); //Write(PlatformRoot,"",m_); } void CPlatform::Show(void) { std::cout<<"Platform name: "<=0)&&(IndexOS() == OS) return p; } return 0; } void CPlatformSet::AddDefault(void) { if (m_Locked) return; CPlatform *p = Find(CPlatform::OS_Unix); if (0==p) { p = new CPlatform(); p->Reset(CPlatform::OS_Unix); m_Platforms.push_back(p); } p = Find(CPlatform::OS_Windows); if (0==p) { p = new CPlatform(); p->Reset(CPlatform::OS_Windows); m_Platforms.push_back(p); } p = Find(CPlatform::OS_Mac); if (0==p) { p = new CPlatform(); p->Reset(CPlatform::OS_Mac); m_Platforms.push_back(p); } } /* CPlatform *CPlatformSet::Add(const CString& Platform) { if (m_Locked) return 0; CPlatform *p = new CPlatform(); p->m_Name = Platform; m_Platforms.push_back(p); return p; } void CPlatformSet::Remove(const CString& Platform) { if (m_Locked) return; CPlatform *p = Find(Platform); if (0!=p) { m_Platforms.erase(std::find(m_Platforms.begin(),m_Platforms.end(),p)); delete p; } } */ void CPlatformSet::Read(const TiXmlElement *ConfigRoot) { TiXmlNode *_platform = (TiXmlNode *)ConfigRoot->FirstChild("platform"); while (0!=_platform) { TiXmlElement* platform = _platform->ToElement(); if (strcmp(platform->Value(),"platform")!=0) break; if (0!=platform) { CPlatform *p = new CPlatform(); p->Read(platform); m_Platforms.push_back(p); } _platform = (TiXmlNode *)ConfigRoot->IterateChildren(_platform); } // platform } void CPlatformSet::Write(TiXmlElement *ConfigRoot) { for (int i = 0, n = m_Platforms.size(); i < n; i++) { CPlatform *p = m_Platforms[i]; TiXmlElement *p_root = new TiXmlElement("platform"); p->Write(p_root); ConfigRoot->LinkEndChild(p_root); } } /* bool CPlatformSet::Load(const CString& FileName) { if (m_Locked) return false; TiXmlDocument cfg; if (!cfg.LoadFile(FileName.GetCString())) return false; const TiXmlElement *root = cfg.RootElement(); if (0==strcmp(root->Value(),"cbp2make")) { Read(root); } // root if (0==m_Platforms.size()) AddDefault(); return true; } bool CPlatformSet::Save(const CString& FileName) { TiXmlDocument cfg; TiXmlDeclaration *xmld = new TiXmlDeclaration("1.0", "", ""); cfg.LinkEndChild(xmld); TiXmlElement *root = new TiXmlElement("cbp2make"); cfg.LinkEndChild(root); Write(root); return cfg.SaveFile(FileName.GetCString()); } */ void CPlatformSet::Show(void) { if (m_Platforms.size()) { std::cout<<"Configued "<Show(); } } else { std::cout<<"No platforms configured"<. */ //------------------------------------------------------------------------------ #ifndef CBBUILDMGR_H #define CBBUILDMGR_H //------------------------------------------------------------------------------ #include "stlstrings.h" #include "cbproject.h" #include "cbworkspace.h" //#include "toolchains.h" #include "cbbuildcfg.h" //------------------------------------------------------------------------------ class TiXmlElement; class CCodeBlocksBuildManager { private: CCodeBlocksWorkspace m_Workspace; CCodeBlocksProject m_Project; CCodeBlocksBuildConfig m_Config; bool m_ProjectLoaded; bool m_WorkspaceLoaded; protected: public: CPlatformSet& Platforms(void) { return m_Config.Platforms(); } CToolChainSet& ToolChains(void) { return m_Config.ToolChains(); } CCodeBlocksBuildConfig& Config(void) { return m_Config; } void Clear(void); bool LoadProjectOrWorkspace(const CString& FileName); void Show(void); void GenerateMakefile(const CString& FileName); public: CCodeBlocksBuildManager(void); ~CCodeBlocksBuildManager(void); }; #endif //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/cbworkspace.h0000644000175000017500000000507012155022125017112 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #ifndef CBWORKSPACE_H #define CBWORKSPACE_H //------------------------------------------------------------------------------ #include "stlstrings.h" #include "cbproject.h" //------------------------------------------------------------------------------ class TiXmlElement; class CToolChainSet; class CCodeBlocksWorkspace; class CProjectWeightComparison; class CWorkspaceUnit { friend class CCodeBlocksWorkspace; friend class CProjectWeightComparison; private: CString m_FileName; CStringList m_Depends; CCodeBlocksProject m_Project; int m_Weight; public: void Clear(void); void Read(const TiXmlElement* UnitRoot); void Show(void); bool LoadProject(const CString& WorkspacePath); public: CWorkspaceUnit(void); ~CWorkspaceUnit(void); }; class CCodeBlocksWorkspace { private: CString m_Title; std::vector m_Units; CStringList m_TargetNames; CStringList m_MakefileNames; CStringList m_MakefilePaths; CStringList m_TargetDeps; CStringList m_MakefileText; CMakefile m_Makefile; protected: int CalculateProjectWeight(const size_t Index = 0); void ResolveProjectDependencies(void); void SortProjectsByWeight(void); public: void Clear(void); void Read(const TiXmlElement* WorkspaceRoot); bool LoadWorkspaceProjects(const CString& WorkspacePath); bool LoadWorkspace(const CString& FileName); void Show(const bool ShowProjects = false); bool GenerateMakefile(const CString& FileName, CCodeBlocksBuildConfig& Config); void GenerateMakefileText(const CString& FileName, CCodeBlocksBuildConfig& Config); public: CCodeBlocksWorkspace(void); ~CCodeBlocksWorkspace(void); }; #endif //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/depsearch.cpp0000644000175000017500000006225312155022125017106 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #include #include "cbhelper.h" #include "stlfutils.h" #include "depsearch.h" //------------------------------------------------------------------------------ CDependencyRecord::CDependencyRecord(void) { Clear(); } CDependencyRecord::~CDependencyRecord(void) { Clear(); } void CDependencyRecord::SetName(const CString& Name) { m_Name = Name; m_Hash = sdbm_hash((unsigned char *)Name.GetCString(),Name.GetLength()); } void CDependencyRecord::Clear(void) { m_Hash = 0; m_Name.Clear(); m_Dependencies.clear(); m_CrossReferences.clear(); m_DependenciesComplete = false; m_CrossReferencesComplete = false; m_Marker = 0; } void CDependencyRecord::Show(void) { std::cout<<"Unit: "< 0) { std::cout<<"Unit dependens on "<GetName().GetCString()< 0) { std::cout<<"Unit is used by"<GetName().GetCString()<=0)&&(Index=0)&&(Index 0) { std::cout<<"Dependency info collected for "<GetName().GetCString()<<"' has " <DependenciesCount()<<" direct and "<DependenciesCount(); if (r->DependenciesComplete()) std::cout<<"*"; std::cout<<"\t\t"<CrossReferencesCount(); if (r->CrossReferencesComplete()) std::cout<<"*"; std::cout<<"\t\t"<GetName().GetCString()<=0)&&(IndexDependenciesCount()) + "/"+IntegerToString(IndirectDependenciesCount(Index)) + "/"+IntegerToString(AllDependenciesCount(Index)) + "]"; } if (Deps && XRefs) result += " "; if (XRefs) { result += " XRefs ["+IntegerToString(r->CrossReferencesCount()) + "/"+IntegerToString(IndirectCrossReferencesCount(Index)) + "/"+IntegerToString(AllCrossReferencesCount(Index))+"]"; } result += " (direct/indirect/all)"; } return result; } void CDependencyInfo::ResetMarkers(void) { for (size_t i = 0; i < m_Records.size(); i++) { m_Records[i]->Marker() = 0; } } size_t CDependencyInfo::DependenciesCount(CDependencyRecord *Record) { size_t result = 0; if (0!=Record) { //ResetMarkers(); result += Record->DependenciesCount(); Record->Marker()++; for (size_t i = 0, n = Record->DependenciesCount(); i < n; i++) { if (0==Record->Dependency(i)->Marker()) { result += DependenciesCount(Record->Dependency(i)); Record->Dependency(i)->Marker()++; } } } return result; } CStringList CDependencyInfo::Dependencies(CDependencyRecord *Record) { CStringList result; if (0!=Record) { //ResetMarkers(); result.Insert(Record->GetName()); Record->Marker()++; for (size_t i = 0, n = Record->DependenciesCount(); i < n; i++) { if (0==Record->Dependency(i)->Marker()) { result.Insert(Dependencies(Record->Dependency(i))); Record->Dependency(i)->Marker()++; } } } return result; } size_t CDependencyInfo::CrossReferencesCount(CDependencyRecord *Record) { size_t result = 0; if (0!=Record) { //ResetMarkers(); result += Record->CrossReferencesCount(); Record->Marker()++; for (size_t i = 0, n = Record->CrossReferencesCount(); i < n; i++) { if (0==Record->CrossReference(i)->Marker()) { result += CrossReferencesCount(Record->CrossReference(i)); Record->CrossReference(i)->Marker()++; } } } return result; } CStringList CDependencyInfo::CrossReferences(CDependencyRecord *Record) { CStringList result; if (0!=Record) { //ResetMarkers(); result.Insert(Record->GetName()); Record->Marker()++; for (size_t i = 0, n = Record->CrossReferencesCount(); i < n; i++) { if (0==Record->CrossReference(i)->Marker()) { result.Insert(CrossReferences(Record->CrossReference(i))); Record->CrossReference(i)->Marker()++; } } } return result; } size_t CDependencyInfo::RecordsCount(void) const { return m_Records.size(); } size_t CDependencyInfo::DirectDependenciesCount(const size_t Index) const { size_t result = 0; if ((Index>=0)&&(IndexDependenciesCount(); } return result; } size_t CDependencyInfo::IndirectDependenciesCount(const size_t Index) { size_t result = 0; if ((Index>=0)&&(IndexDependenciesCount(); i < n; i++) { result += DependenciesCount(r->Dependency(i)); } } return result; } size_t CDependencyInfo::AllDependenciesCount(const size_t Index) { size_t result = 0; if ((Index>=0)&&(Index=0)&&(IndexGetName(); } return ""; } CStringList CDependencyInfo::DirectDependencies(const size_t Index) const { CStringList result; if ((Index>=0)&&(IndexDependenciesCount(); i < n; i++) { result.Insert(r->Dependency(i)->GetName()); } } return result; } CStringList CDependencyInfo::IndirectDependencies(const size_t Index) { CStringList result; if ((Index>=0)&&(IndexDependenciesCount(); i < n; i++) { const CDependencyRecord *rr = r->Dependency(i); for (size_t j = 0, m = rr->DependenciesCount(); j < m; j++) { result.Insert(Dependencies(rr->Dependency(j))); } } } return result; } CStringList CDependencyInfo::AllDependencies(const size_t Index) { CStringList result; if ((Index>=0)&&(IndexDependenciesCount(); i < n; i++) { result.Insert(Dependencies(r->Dependency(i))); } } return result; } size_t CDependencyInfo::DirectCrossReferencesCount(const size_t Index) const { size_t result = 0; if ((Index>=0)&&(IndexCrossReferencesCount(); } return result; } size_t CDependencyInfo::IndirectCrossReferencesCount(const size_t Index) { size_t result = 0; if ((Index>=0)&&(IndexCrossReferencesCount(); i < n; i++) { result += CrossReferencesCount(r->CrossReference(i)); } } return result; } size_t CDependencyInfo::AllCrossReferencesCount(const size_t Index) { size_t result = 0; if ((Index>=0)&&(Index=0)&&(IndexCrossReferencesCount(); i < n; i++) { result.Insert(r->CrossReference(i)->GetName()); } } return result; } CStringList CDependencyInfo::IndirectCrossReferences(const size_t Index) { CStringList result; if ((Index>=0)&&(IndexCrossReferencesCount(); i < n; i++) { const CDependencyRecord *rr = r->CrossReference(i); for (size_t j = 0, m = rr->CrossReferencesCount(); j < m; j++) { result.Insert(CrossReferences(rr->CrossReference(j))); } } } return result; } CStringList CDependencyInfo::AllCrossReferences(const size_t Index) { CStringList result; if ((Index>=0)&&(IndexCrossReferencesCount(); i < n; i++) { result.Insert(CrossReferences(r->CrossReference(i))); } } return result; } bool CDependencyInfo::AreDependenciesComplete(const size_t Index) { if ((Index>=0)&&(IndexDependenciesComplete(); } return false; } bool CDependencyInfo::AreCrossReferencesComplete(const size_t Index) { if ((Index>=0)&&(IndexCrossReferencesComplete(); } return false; } void CDependencyInfo::SetDependenciesComplete(const size_t Index, const bool State) { if ((Index>=0)&&(IndexDependenciesComplete() = State; } } void CDependencyInfo::SetCrossReferencesComplete(const size_t Index, const bool State) { if ((Index>=0)&&(IndexCrossReferencesComplete() = State; } } int CDependencyInfo::FindRecord(const CString& Name) { const hash_t h = sdbm_hash((unsigned char *)Name.GetCString(),Name.GetLength()); for (size_t i = 0; i < m_Records.size(); i++) { CDependencyRecord *r = m_Records[i]; if (r->Hash() == h) { if (r->GetName() == Name) { return i; } } } return -1; } size_t CDependencyInfo::AddRecord(const CString& Name) { int Index = FindRecord(Name); if (Index>=0) { return Index; } else { CDependencyRecord *r = new CDependencyRecord; r->SetName(Name); m_Records.push_back(r); Index = m_Records.size()-1; } return Index; } bool CDependencyInfo::AddDependency(const size_t Index, const CString& DependencyName) { if ((Index>=0)&&(IndexAddDependency(d); d->AddCrossReference(r); return true; } return false; } size_t CDependencyInfo::AddDependency(const CString& Name, const CString& DependencyName) { size_t rec_index = AddRecord(Name); size_t dep_index = AddRecord(DependencyName); CDependencyRecord *r = m_Records[rec_index]; CDependencyRecord *d = m_Records[dep_index]; r->AddDependency(d); d->AddCrossReference(r); return rec_index; } void CDependencyInfo::MakeRules(CMakefile& Makefile, const int Section, const bool Multiline) { for (size_t i = 0; i < m_Records.size(); i++) { const CDependencyRecord *r = m_Records[i]; CStringList deps(DirectDependencies(i)); if (deps.GetCount() > 0) { deps.RemoveDuplicates(); CMakefileRule& rule = Makefile.AddRule(Platform().Pd(r->GetName()),Section); rule.Multiline() = Multiline; for (int j = 0; j < deps.GetCount(); j++) { rule.Dependencies().Insert(Platform().Pd(deps[j])); } } } } //------------------------------------------------------------------------------ CIncludeSearchFilter::CIncludeSearchFilter(void) { Clear(); } CIncludeSearchFilter::CIncludeSearchFilter(const CIncludeSearchFilter& Filter) { Assign(Filter); } CIncludeSearchFilter::~CIncludeSearchFilter(void) { Clear(); } void CIncludeSearchFilter::Clear(void) { m_IncludeDirectories.Clear(); m_DefinedMacros.Clear(); } void CIncludeSearchFilter::Show(void) { // } void CIncludeSearchFilter::Assign(const CIncludeSearchFilter& Filter) { m_IncludeDirectories = Filter.m_IncludeDirectories; m_DefinedMacros = Filter.m_DefinedMacros; } bool CIncludeSearchFilter::Execute(const CString& FileName, CStringList& Includes) { return false; } bool CIncludeSearchFilter::Execute(const CString& FileName, CDependencyInfo& Dependencies) { return false; } void CIncludeSearchFilter::AddIncludeDirectory(const CString& Path) { m_IncludeDirectories.Insert(Path); } void CIncludeSearchFilter::AddIncludeDirectories(const CStringList& Paths) { m_IncludeDirectories.Insert(Paths); } void CIncludeSearchFilter::AddMacroDefiniton(const CString& Macro) { m_DefinedMacros.Insert(Macro); } void CIncludeSearchFilter::AddMacroDefinitons(const CStringList& Macros) { m_DefinedMacros.Insert(Macros); } CString CIncludeSearchFilter::ResolveIncludePath(const CString& IncludeName) { CString name = ExtractFileName(IncludeName); //std::cout<<"include = "<') { state = STATE_UNDEFINED; } if (it.This()=='"') { state = STATE_UNDEFINED; } if (state == STATE_INCLUDE_FILENAME) { include_filename.Append(it.This()); } else { local_includes.Insert(include_filename); include_filename.Clear(); } break; } case STATE_END_OF_INPUT: { break; } } eol = (it.This()=='\0'); it.Next(); } } bool result = true; //ShowStringList("Local includes","include",local_includes); for (int i = 0; i < local_includes.GetCount(); i++) { CString resolved_include = ResolveIncludePath(local_includes[i]); if (!resolved_include.IsEmpty()) { if (INVALID_INDEX==Includes.FindString(resolved_include)) { Includes.Insert(resolved_include); result = result && Execute(resolved_include,Includes); } } } Includes.RemoveDuplicates(); return result; } bool CCppIncludeSearchFilter::Execute(const CString& FileName, CDependencyInfo& Dependencies) { const int STATE_UNDEFINED = 0; const int STATE_ENTER_COMMENT = 1; const int STATE_CHAR = 2; const int STATE_STRING = 3; const int STATE_BEGIN_DIRECTIVE = 4; const int STATE_ONELINE_COMMENT = 5; const int STATE_MULTILINE_COMMENT = 6; const int STATE_EXIT_COMMENT = 7; const int STATE_CHAR_ESC_SEQ = 8; const int STATE_STRING_ESC_SEQ = 9; const int STATE_INCLUDE_DIRECTIVE = 10; const int STATE_INCLUDE_FILENAME = 11; const int STATE_END_OF_INPUT = -1; // bool result = true; CString file_name = MakeNativePath(FileName); // check if unit is already scanned bool scan_unit = true; const size_t unit_index = Dependencies.AddRecord(file_name); if (unit_index >= 0) { scan_unit = !Dependencies.AreDependenciesComplete(unit_index); } if (scan_unit) { CStringList source; if (!source.LoadFromFile(file_name)) return false; if (source.GetCount()==0) return false; //debug //std::cout<<"CWD: "<') { state = STATE_UNDEFINED; } if (it.This()=='"') { state = STATE_UNDEFINED; } if (state == STATE_INCLUDE_FILENAME) { include_filename.Append(it.This()); } else { direct_includes.Insert(include_filename); include_filename.Clear(); } break; } case STATE_END_OF_INPUT: { break; } } eol = (it.This()=='\0'); it.Next(); } } // //ShowStringList("Direct includes","include",direct_includes);//debug Dependencies.SetDependenciesComplete(unit_index); int resolved_count = 0; for (int i = 0; i < direct_includes.GetCount(); i++) { CString resolved_include = ResolveIncludePath(direct_includes[i]); //std::cout< "<. */ //------------------------------------------------------------------------------ #include //------------------------------------------------------------------------------ #include "cbhelper.h" //------------------------------------------------------------------------------ void ShowStringList(const CString& Title, const CString& LinePrefix, const CStringList& StringList) { std::cout<. */ //------------------------------------------------------------------------------ #ifndef CBGLOBALVAR_H #define CBGLOBALVAR_H //------------------------------------------------------------------------------ #include "stlstrings.h" #include "stlconfig.h" //------------------------------------------------------------------------------ class TiXmlElement; class CGlobalVariableSet; class CGlobalVariable { private: CString m_Name; CString m_Description; // standard fields CString m_Base; CString m_Include; CString m_Lib; CString m_Obj; CString m_Cflags; CString m_Lflags; // user fields CConfiguration m_Fields; public: CString& Name(void) { return m_Name; } CString& Description(void) { return m_Description; } CString Base(void); CString Include(void); CString Lib(void); CString& Obj(void) { return m_Obj; } CString& Cflags(void) { return m_Cflags; } CString& Lflags(void) { return m_Lflags; } public: static CString Convert(const CString& Value, const int Case = 0); int Count(void); CString GetField(const int Index); CString GetValue(const int Index); void Clear(void); void Add(const CString& Name, const CString& Value); void Remove(const CString& Name); void Read(const TiXmlElement *GlobalVariableRoot); void Write(TiXmlElement *GlobalVariableRoot); void Show(void); public: CGlobalVariable(void); ~CGlobalVariable(void); }; class CGlobalVariableSet { private: CString m_Name; std::vector m_Variables; bool m_Active; //bool m_HaveDefaults; public: CString& Name(void) { return m_Name; } bool& Active(void) { return m_Active; } public: void Clear(void); size_t Count(void) const { return m_Variables.size(); }; CGlobalVariable *Get(const size_t Index); CGlobalVariable *Find(const CString& Name); CGlobalVariable *Add(const CString& Name, const CString& Description = ""); void Remove(const CString& Name); void Read(const TiXmlElement *GlobalVariableSetRoot); void Write(TiXmlElement *GlobalVariableSetRoot); void Show(void); public: CGlobalVariableSet(void); ~CGlobalVariableSet(void); }; class CGlobalVariableConfig { private: std::vector m_VariableSets; public: public: void Clear(void); size_t Count(void) const { return m_VariableSets.size(); }; CGlobalVariableSet *Get(const size_t Index); CGlobalVariableSet *Find(const CString& Name); CGlobalVariableSet *Add(const CString& Name); void AddDefault(void); void Remove(const CString& Name); void Read(const TiXmlElement *GlobalVariableConfigRoot); void Write(TiXmlElement *GlobalVariableConfigRoot); void Show(void); public: CGlobalVariableConfig(void); ~CGlobalVariableConfig(void); }; #endif //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/cbbuildmgr.cpp0000644000175000017500000000520412155022125017253 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #include //------------------------------------------------------------------------------ #include "stlfutils.h" #include "cbbuildmgr.h" #include "tinyxml.h" //------------------------------------------------------------------------------ CCodeBlocksBuildManager::CCodeBlocksBuildManager(void) { Clear(); } CCodeBlocksBuildManager::~CCodeBlocksBuildManager(void) { Clear(); } void CCodeBlocksBuildManager::Clear(void) { m_ProjectLoaded = false; m_WorkspaceLoaded = false; m_Project.Clear(); m_Workspace.Clear(); } bool CCodeBlocksBuildManager::LoadProjectOrWorkspace(const CString& FileName) { bool result = false; TiXmlDocument cbpw; result = cbpw.LoadFile(FileName.GetCString()); if (!result) return false; Clear(); const TiXmlElement *root = cbpw.RootElement(); if (0==strcmp(root->Value(),"CodeBlocks_project_file")) { m_Project.Read(root); m_ProjectLoaded = true; result = true; } else if (0==strcmp(root->Value(),"CodeBlocks_workspace_file")) { m_Workspace.Read(root); m_Workspace.LoadWorkspaceProjects(ExtractFilePath(FileName)); m_WorkspaceLoaded = true; result = true; } return result; } void CCodeBlocksBuildManager::Show(void) { if (m_ProjectLoaded) { std::cout<<"Loaded file is Code::Blocks project."<. */ //------------------------------------------------------------------------------ #ifndef TOOLCHAINS_H #define TOOLCHAINS_H //------------------------------------------------------------------------------ #include "stlstrings.h" #include "platforms.h" #include "buildtools.h" //------------------------------------------------------------------------------ class TiXmlElement; class CToolChainSet; class CToolChain { private: CPlatform::OS_Type m_Platform; CString m_Alias; protected: CString m_GenericSwitch; CString m_DefineSwitch; CString m_IncludeDirSwitch; CString m_LibraryDirSwitch; CString m_LinkLibrarySwitch; //CString m_; protected: std::vector m_BuildTools; std::vector m_Preprocessors; std::vector m_Assemblers; std::vector m_Compilers; std::vector m_ResourceCompilers; std::vector m_StaticLinkers; std::vector m_DynamicLinkers; std::vector m_ExecutableLinkers; protected: void GatherBuildTools(std::vector& Source, std::vector& Target); void GatherBuildTools(void); CBuildTool *FindBuildTool(const CString& FileExtension, const std::vector& Tools); std::vector& GetTools(const CBuildTool::ToolType Type = CBuildTool::btOther); void RemoveTool(const CBuildTool* BuildTool, std::vector& Tools); void RemoveTool(const CBuildTool* BuildTool); protected: void Read(const TiXmlElement *Root, const CString& Name, CString& Value); void Read(const TiXmlElement *Root, const CString& Name, bool& Value); void Write(TiXmlElement *Root, const CString& Name, const CString& Value); void Write(TiXmlElement *Root, const CString& Name, const bool Value); public: CPlatform::OS_Type OS(void) const { return m_Platform; } CString Alias(void) const { return m_Alias; } CString& GenericSwitch(void) { return m_GenericSwitch; } CString& DefineSwitch(void) { return m_DefineSwitch; } CString& IncludeDirSwitch(void) { return m_IncludeDirSwitch; } CString& LibraryDirSwitch(void) { return m_LibraryDirSwitch; } CString& LinkLibrarySwitch(void) { return m_LinkLibrarySwitch; } CString sw(void) const { return m_GenericSwitch; } CString sw(const CString& ASwitch) const; //CString (void) const { return m_; } CBuildTool *CreateBuildTool(const CBuildTool::ToolType Type = CBuildTool::btOther); public: virtual void Assign(const CToolChain& ToolChain); virtual CToolChain *CreateInstance(void) const; virtual void Clear(void); virtual void Reset(const CPlatform::OS_Type OS); virtual bool Supports(const CPlatform::OS_Type OS) const; virtual void Read(const TiXmlElement *ToolChainRoot); virtual void Write(TiXmlElement *ToolChainRoot); virtual void Show(void); size_t ToolsCount(const CBuildTool::ToolType Type = CBuildTool::btOther); CBuildTool *GetBuildTool(const size_t index, const CBuildTool::ToolType Type = CBuildTool::btOther); CBuildTool *FindBuildToolByName(const CString& ToolName); CBuildTool *FindBuildTool(const CString& FileExtension); CAssembler *FindAssembler(const CString& FileExtension); CCompiler *FindCompiler(const CString& FileExtension); //std::vector FindTools(const CString& FileExtension); bool RemoveToolByName(const CString& ToolName); public: explicit CToolChain(const CString& Alias); CToolChain(const CToolChain& ToolChain); virtual ~CToolChain(void); }; //------------------------------------------------------------------------------ class CGNUToolChain: public CToolChain { public: virtual CToolChain *CreateInstance(void) const; virtual void Reset(const CPlatform::OS_Type OS); public: CGNUToolChain(void); virtual ~CGNUToolChain(void); }; class CBorlandToolChain: public CToolChain { public: virtual CToolChain *CreateInstance(void) const; virtual void Reset(const CPlatform::OS_Type OS); public: CBorlandToolChain(void); virtual ~CBorlandToolChain(void); }; class CIntelToolChain: public CToolChain { public: virtual CToolChain *CreateInstance(void) const; virtual void Reset(const CPlatform::OS_Type OS); public: CIntelToolChain(void); virtual ~CIntelToolChain(void); }; class CMSVCToolChain: public CToolChain { public: virtual CToolChain *CreateInstance(void) const; virtual void Reset(const CPlatform::OS_Type OS); bool Supports(const CPlatform::OS_Type OS) const; public: CMSVCToolChain(void); virtual ~CMSVCToolChain(void); }; //------------------------------------------------------------------------------ class CToolChainSet { private: std::vector > m_ToolChains; bool m_Locked; bool m_HaveDefaults; protected: void AddToolChain(const CToolChain *AToolChain); public: void Lock(void); void Unlock(void); void Clear(void); size_t GetCount(const CPlatform::OS_Type OS) const; CToolChain *ToolChain(const CPlatform::OS_Type OS, const size_t Index) const; CToolChain *Find(const CPlatform::OS_Type OS, const CString& Alias); void AddDefault(void); CToolChain *Add(const CPlatform::OS_Type OS, const CString& Alias); void Remove(const CPlatform::OS_Type OS, const CString& Alias); void Read(const TiXmlElement *ConfigRoot); void Write(TiXmlElement *ConfigRoot); //bool Load(const CString& FileName); //bool Save(const CString& FileName); void Show(void); public: CToolChainSet(void); ~CToolChainSet(void); }; #endif //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/doc/0000755000175000017500000000000012155022223015200 5ustar moellermoellercbp2make-147+dfsg/src/doc/cbglobalvar.dox0000644000175000017500000002526412155022124020203 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /*! \file cbglobalvar.h \brief Description of global compiler variables. */ /*! \file cbglobalvar.cpp \brief Description of global compiler variables. */ /*! \class CGlobalVariable \brief Contains properties of global compiler variables. Global compiler variables store installation-specific file paths and build options. */ /*! \var CGlobalVariable::m_Name \brief Name of the variable. */ /*! \var CGlobalVariable::m_Description \brief Description of the variable. */ /*! \var CGlobalVariable::m_Base \brief Value of the built-in default field of the variable. When a global variable field is not specified, this value should used as variable's value. The base field usually points to root directory of a library. */ /*! \var CGlobalVariable::m_Include \brief Value of the built-in "Include" field of the variable. */ /*! \var CGlobalVariable::m_Lib \brief Value of the built-in "Lib" field of the variable. */ /*! \var CGlobalVariable::m_Obj \brief Value of the built-in "Obj" field of the variable. */ /*! \var CGlobalVariable::m_Cflags \brief Value of the built-in "Cflags" field of the variable. */ /*! \var CGlobalVariable::m_Lflags \brief Value of the built-in "Lflags" field of the variable. */ /*! \var CGlobalVariable::m_Fields \brief User-defined fields of the global compiler variable. */ /* ! \var CGlobalVariable:: \brief . */ /*! \fn CGlobalVariable::Name(void) \brief Name of the variable. \return reference to CGlobalVariable::m_Name. */ /*! \fn CGlobalVariable::Description(void) \brief Description of the variable. \return reference to CGlobalVariable::m_Description. */ /*! \fn CGlobalVariable::Base(void) \brief Value of the built-in default field of the variable. \return default field value. */ /*! \fn CGlobalVariable::Include(void) \brief Value of the built-in "Include" field of the variable. \return "Include" field value. */ /*! \fn CGlobalVariable::Lib(void) \brief Value of the built-in "Lib" field of the variable. \return "Lib" field value. */ /*! \fn CGlobalVariable::Obj(void) \brief Value of the built-in "Obj" field of the variable. \return reference to . */ /*! \fn CGlobalVariable::Cflags(void) \brief Value of the built-in "Cflags" field of the variable. \return reference to . */ /*! \fn CGlobalVariable::Lflags(void) \brief Value of the built-in "Lflags" field of the variable. \return reference to . */ /*! \fn CGlobalVariable::CString Convert(const CString& Value, const int Case = 0) \brief Converts global compiler variable into macro variable for makefile. \param Value global compiler variable value. \param Case variale name casing. \return makefile variable value. The \a Case parameter defines how casing of characters will change. Valid values are: 0 - keep existing casing, don't change anything, 1 - make all characters into lower case, 2 - make all characters into upper case. */ /*! \fn CGlobalVariable::Count(void) \brief Returns number of user-defined fields. \return number of user-defined fields. */ /*! \fn CGlobalVariable::GetField(const int Index) \brief Returns name of user-defined field. \param Index index of user-defined field. \return field name. */ /*! \fn CGlobalVariable::GetValue(const int Index) \brief Returns value of user-defined field. \param Index index of user-defined field. \return field value. */ /*! \fn CGlobalVariable::Clear(void) \brief Resets the global compiler variable to the initial state. */ /*! \fn CGlobalVariable::Add(const CString& Name, const CString& Value) \brief Adds new user-defined field. \param Name field name. \param Value field value. */ /*! \fn CGlobalVariable::Remove(const CString& Name) \brief Removes user-defined field. \param Name field name. */ /*! \fn CGlobalVariable::Read(const TiXmlElement *GlobalVariableRoot) \brief Reads the global variable settings from an XML document. \param GlobalVariableRoot an element of XML document. */ /*! \fn CGlobalVariable::Write(TiXmlElement *GlobalVariableRoot) \brief Writes the global variable settings to an XML document. \param GlobalVariableRoot an element of XML document. */ /*! \fn CGlobalVariable::Show(void) \brief Prints the global compiler variable contents to standard output. */ /*! \fn CGlobalVariable::CGlobalVariable(void) \brief Creates global compiler variable. */ /*! \fn CGlobalVariable::~CGlobalVariable(void) \brief Destroys global compiler variable. */ /* ! \fn CGlobalVariable:: \brief . \param . \return . */ /*! \class CGlobalVariableSet \brief Manages a set of global compiler variables. */ /*! \var CGlobalVariableSet::m_Name \brief Name of the variable set. */ /*! \var CGlobalVariableSet::m_Variables \brief List of global compiler variables. */ /*! \var CGlobalVariableSet::m_Active \brief Indicates that this variable set should be defined in makefile. */ /* ! \var CGlobalVariableSet:: \brief . */ /*! \fn CGlobalVariableSet::Name(void) \brief Name of the set. \return reference to CGlobalVariableSet::m_Name. */ /*! \fn CGlobalVariableSet::Active(void) \brief Indicates that this variable set should be defined in makefile. \return CGlobalVariableSet::m_Active. */ /*! \fn CGlobalVariableSet::Clear(void) \brief Resets the set of variables to the initial state. */ /*! \fn CGlobalVariableSet::Count(void) const \brief Returns number of variables. \return number of variables. */ /*! \fn CGlobalVariableSet::Get(const size_t Index) \brief Returns a variable by index. \param Index index of a variable. \return pointer to a variable or \a NULL if a variable with index \a Index does not exist. */ /*! \fn CGlobalVariableSet::Find(const CString& Name) \brief Returns a variable by name. \param Name name of a variable. \return pointer to the variable or \a NULL if variable with index \a Index does not exist. */ /*! \fn CGlobalVariableSet::Add(const CString& Name, const CString& Description = "") \brief Adds new variable with name \a Name and description \a Description. \param Name name of the variable. \param Description description of the variable (optional). \return pointer to global compiler variable. If a variable with name \a Name already exists, new variable will not be created. */ /*! \fn CGlobalVariableSet::Remove(const CString& Name) \brief Removes variable with name \a Name. \param Name name of a variable. */ /*! \fn CGlobalVariableSet::Read(const TiXmlElement *GlobalVariableSetRoot) \brief Reads the global variable set settings from an XML document. \param GlobalVariableSetRoot an element of XML document. */ /*! \fn CGlobalVariableSet::Write(TiXmlElement *GlobalVariableSetRoot) \brief Writes the global variable set settings to an XML document. \param GlobalVariableSetRoot an element of XML document. */ /*! \fn CGlobalVariableSet::Show(void) \brief Prints the global compiler variable set contents to standard output. */ /*! \fn CGlobalVariableSet::CGlobalVariableSet(void) \brief Creates global compiler variable set. */ /*! \fn CGlobalVariableSet::~CGlobalVariableSet(void) \brief Destroys global compiler variable set. */ /* ! \fn CGlobalVariableSet:: \brief . \param . \return . */ /*! \class CGlobalVariableConfig \brief Manages global compiler variables configuration. Configuration consists of a number of sets of variables. */ /*! \var CGlobalVariableConfig::m_VariableSets \brief List of variable sets. */ /* ! \var CGlobalVariableConfig:: \brief . */ /*! \fn CGlobalVariableConfig::Clear(void) \brief Resets the configuration to the initial state. */ /*! \fn CGlobalVariableConfig::Count(void) const \brief Returns the number of variable sets in configuration. \return number of sets. */ /*! \fn CGlobalVariableConfig::Get(const size_t Index) \brief Returns a set of variables by index. \param Index index of a set of variables. \return pointer to a set of variables or \a NULL if a set with index \a Index does not exist. */ /*! \fn CGlobalVariableConfig::Find(const CString& Name) \brief Returns a set of variables by name. \param Name name of a set of variables. \return pointer to a set of variables or \a NULL if a set with name \a Name does not exist. */ /*! \fn CGlobalVariableConfig::Add(const CString& Name) \brief Adds new set of global compiler variables. \param Name name of the set. \return pointer to the set of variables. If a variable set with name \a Name already exists, new variable set will not be created. */ /*! \fn CGlobalVariableConfig::AddDefault(void) \brief Adds the 'default' set of variables. The default set cannot be removed. However, it can be cleared by a call Remove("default") which removes the existing default set and creates an empty default set again right away. */ /*! \fn CGlobalVariableConfig::Remove(const CString& Name) \brief Removes a set of variables. \param Name name of set of global compiler variables. */ /*! \fn CGlobalVariableConfig::Read(const TiXmlElement *GlobalVariableConfigRoot) \brief Reads the global compiler variable configuration from an XML document. \param GlobalVariableConfigRoot an element of XML document. */ /*! \fn CGlobalVariableConfig::Write(TiXmlElement *GlobalVariableConfigRoot) \brief Writes the global compiler variable configuration to an XML document. \param GlobalVariableConfigRoot an element of XML document. */ /*! \fn CGlobalVariableConfig::Show(void) \brief Prints the global compiler variable configuration contents to standard output. */ /*! \fn CGlobalVariableConfig::CGlobalVariableConfig(void) \brief Creates global compiler variable configuration. */ /*! \fn CGlobalVariableConfig::~CGlobalVariableConfig(void) \brief Destroys global compiler variable configuration. */ /* ! \fn CGlobalVariableConfig:: \brief . \param . \return . */ //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/doc/makefile.dox0000644000175000017500000003346712155022125017507 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /*! \file makefile.h \brief Object-based makefile generation. */ /*! \file makefile.cpp \brief Object-based makefile generation. */ /*! \class CMakefileVariable \brief Makefile macro variable definition. Manages variable properties and generates its text representation. */ /*! \var CMakefileVariable::m_Name \brief Name of the makefile macro variable. */ /*! \var CMakefileVariable::m_Values \brief A list of strings which concatenation gives the actual value of the macro variable. */ /*! \var CMakefileVariable::m_Multiline \brief Allows line-wrapping of variable's value text. */ /* ! \var CMakefileVariable:: \brief . */ /*! \fn CMakefileVariable::Name(void) \brief Returns the name of the macro variable. \return referece to CMakefileVariable::m_Name. */ /*! \fn CMakefileVariable::Values(void) \brief Returns the value of the macro variable as a list of strings. \return reference to CMakefileVariable::m_Values. */ /*! \fn CMakefileVariable::GetValue(const int Index = 0) \brief Returns a string number \a Index from the value strings. \param Index a number of the value string. \return a value string or an empty string. */ /*! \fn CMakefileVariable::SetValue(const CString& NewValue, const int Index = 0) \brief Replaces a string number \a Index in the value strings with the \a NewValue string. \param NewValue a new value of the value string. \param Index a number of the value string. */ /*! \fn CMakefileVariable::AddValue(const CString& NewValue) \brief Appends a list of value strings with the \a NewValue string. \param NewValue a new value string. */ /*! \fn CMakefileVariable::Multiline(void) \brief Allows line-wrapping of variable's value text. \return reference to CMakefileVariable::m_Multiline. */ /*! \fn CMakefileVariable::JoinValues(void) \brief Returns the variable value as a single string. \return concatenation of value strings. The value strings CMakefileVariable::m_Values are joined with space character if multiline mode is disabled or with ' \\\\\\n\\t' (space backslash eol tab) sequence otherwise. */ /*! \fn CMakefileVariable::Clear(void) \brief Resets the macro variable to the initial state. */ /*! \fn CMakefileVariable::Show(void) \brief Prints properties of the macro variable to the standard output. */ /*! \fn CMakefileVariable::CMakefileVariable(void) \brief Creates macro variable. */ /*! \fn CMakefileVariable::~CMakefileVariable(void) \brief Destroys macro variable. */ /* ! \fn CMakefileVariable:: \brief . \param . \return . */ /*! \class CMakefileRule \brief Makefile rule definition. Manages makefile rule properties and generates its text representation. */ /*! \var CMakefileRule::m_Target \brief Name of a makefile target. */ /*! \var CMakefileRule::m_Dependencies \brief A list of dependencies (prerequirements) for the target. Dependencies should be names of other makefile targets or file names. */ /*! \var CMakefileRule::m_Commands \brief A list of commands to be executed to build the target. */ /*! \var CMakefileRule::m_Multiline \brief Allows line-wrapping of the list of dependencies. */ /* ! \var CMakefileRule:: \brief . */ /*! \fn CMakefileRule::Target(void) \brief Name of a makefile target. \return reference to CMakefileRule::m_Target. */ /*! \fn CMakefileRule::Dependencies(void) \brief A list of dependencies (prerequirements) for the target. \return reference to CMakefileRule::m_Dependencies. */ /*! \fn CMakefileRule::Commands(void) \brief A list of commands to be executed to build the target. \return reference to CMakefileRule::m_Commands. */ /*! \fn CMakefileRule::Multiline(void) \brief Allows line-wrapping of the list of dependencies. \return reference to CMakefileRule::m_Multiline. */ /*! \fn CMakefileRule::JoinDependencies(void) \brief Returns dependencies as a single string. \return concatenation of CMakefileRule::m_Dependencies strings. Strings of CMakefileRule::m_Dependencies are joined with space character if multiline mode is disabled or with ' \\\\\\n\\t' (space backslash eol tab) sequence otherwise. */ /*! \fn CMakefileRule::Clear(void) \brief Resets the makefile rule to the initial state. */ /*! \fn CMakefileRule::Show(void) \brief Prints the makefile rule properties to the standard output. */ /*! \fn CMakefileRule::CMakefileRule(void) \brief Creates makefile rule. */ /*! \fn CMakefileRule::~CMakefileRule(void) \brief Destroys makefile rule. */ /* ! \fn CMakefileRule:: \brief . \param . \return . */ /*! \class CMakefileSection \brief Makefile section definition. Manages makefile section data. A makefile section is a logical block of text with common structure: header, macros, environment variables, rules. A makefile may consist of one or more sections to maintain strict logical structure of the makefile text. */ /*! \var CMakefileSection::m_Header \brief Section header, describes makefile section contents. Contains lines of text that precide other parts of the section. */ /*! \var CMakefileSection::m_Macros \brief A list of macro variables in the section. Macro variable definitions follow the section header and precide enviroment variables. */ /*! \var CMakefileSection::m_EnvVars \brief A list of environment variables in the section. Enviroment variable definitions follow macro variables and precide rules. */ /*! \var CMakefileSection::m_Rules \brief A list of makefile rules in the section. Rule definitions follow environment variables and finish the section. */ /*! \var CMakefileSection::m_NullVariable \brief A substitute variable, it is returned when no variable satisfies search conditions. */ /*! \var CMakefileSection::m_NullRule \brief A substitute rule, it is returned when no rule satisfies search conditions. */ /* ! \var CMakefileSection:: \brief . */ /*! \fn CMakefileSection::FindMacro(const CString& Name) \brief Searches macro variables by name. \param Name a macro variable name. \return reference to a macro variable or CMakefileSection::m_NullVariable if no variable has the \a Name name. */ /*! \fn CMakefileSection::FindEnvVar(const CString& Name) \brief Searches environment variables by name. \param Name an environment variable name. \return reference to an environment variable or CMakefileSection::m_NullVariable if no variable has the \a Name name. */ /*! \fn CMakefileSection::Clear(void) \brief Resets the makefile section to the initial state. */ /*! \fn CMakefileSection::Show(void) \brief Prints contents of the makefile section to the standard output. */ /*! \fn CMakefileSection::Header(void) \brief Section header, describes makefile section contents. \return reference to CMakefileSection::m_Header. */ /*! \fn CMakefileSection::Macros(void) \brief A list of macro variables in the section. \return reference to CMakefileSection::m_Macros. */ /*! \fn CMakefileSection::EnvVars(void) \brief A list of environment variables in the section. \return reference to CMakefileSection::m_Macros. */ /*! \fn CMakefileSection::AddMacro(const CString& Name, const CString& Value) \brief Creates a new macro variable and adds it to the section. \param Name name of a macro variable. \param Value default value of a macro variable. \return reference to the new variable. If a macro variable with name \a Name already exists, a new variable will not be created. */ /*! \fn CMakefileSection::AddEnvVar(const CString& Name, const CString& Value) \brief Creates a new environment variable and adds it to the section. \param Name name of an environment variable. \param Value default value of an environment variable. \return reference to the new variable. If an environment variable with name \a Name already exists, a new variable will not be created. */ /*! \fn CMakefileSection::RulesCount(void) const \brief Counts makefile rules in the section. \return section rules count. */ /*! \fn CMakefileSection::GetRule(const size_t Index) \brief Returns makefile rule by the \a Index number. \param Index number of a rule. \return reference to a makefile rule. */ /*! \fn CMakefileSection::AddRule(const CString& TargetName) \brief Creates a new makefile rule and adds it to the section. \param TargetName name of makefile target for the rule. \return reference to the new rule. If a makefile rule with target name \a TargetName already exists, a new rule will not be created. */ /*! \fn CMakefileSection::CMakefileSection(void) \brief Creates makefile section. */ /*! \fn CMakefileSection::~CMakefileSection(void) \brief Destroys makefile section. */ /* ! \fn CMakefileSection:: \brief . \param . \return . */ /*! \class CMakefile \brief Makefile definition. Manages structured makefile and generates its text representation. */ /*! \var CMakefile::m_Sections \brief A list of makefile sections. A section is similar in structure to an elementary and complete makefile, so a minimal makefile consists of one regular makefile section. In order to maintain a good style of makefile text, leading sections of makefile should contain headers and variable definitions and trailing sections should contain headers and rules while middle one may contain all of section parts. Any part of any section is optional and may be omitted. \sa CMakefileSection. */ /*! \var CMakefile::m_Text \brief Plain text representation of the makefile. */ /* ! \var CMakefile:: \brief . */ /*! \fn CMakefile::Clear(void) \brief Resets the makefile to the initial state. */ /*! \fn CMakefile::Show(void) \brief Prints contents of the makefile to the standard output. */ /*! \fn CMakefile::SectionCount(void) const \brief Counts makefile sections. \return number of makefile sections. */ /*! \fn CMakefile::GetSection(const size_t Section) \brief Returns a makefile section by a number. \param Section number of a makefile section. \return reference to a makefile section. */ /*! \fn CMakefile::Header(const size_t Section = 0) \brief Header of a makefile section number \a Section. \param Section number of a makefile section. \return reference to a list of strings. */ /*! \fn CMakefile::AddSection(size_t *Section = 0) \brief Creates a new makefile section and adds it to the makefile. \param Section desired number for a makefile section. \return reference to the new makefile section. This function creates all sections through from the last existing section to a desired number \a Section. */ /*! \fn CMakefile::AddMacro(const CString& Name, const CString& Value, const size_t Section = 0) \brief Creates a new macro variable and adds it to a section number \a Section. \param Name name of a macro variable. \param Value default value of a macro variable. \param Section number of a makefile section. \return reference to the new variable. If a macro variable with name \a Name already exists, a new variable will not be created. */ /*! \fn CMakefile::AddEnvVar(const CString& Name, const CString& Value, const size_t Section = 0) \brief Creates a new environment variable and adds it to a section number \a Section. \param Name name of an environment variable. \param Value default value of an environment variable. \param Section number of a makefile section. \return reference to the new variable. If an environment variable with name \a Name already exists, a new variable will not be created. */ /*! \fn CMakefile::RulesCount(const size_t Section = 0) \brief Counts makefile rules in a section number \a Section. \param Section number of a makefile section. \return section rules count. */ /*! \fn CMakefile::GetRule(const size_t Index, const size_t Section = 0) \brief Returns makefile rule by the \a Index number in a section number \a Section. \param Index number of a rule. \param Section number of a makefile section. \return reference to a makefile rule. */ /*! \fn CMakefile::AddRule(const CString& TargetName, const size_t Section = 0) \brief Creates a new makefile rule and adds it to a section number \a Section. \param TargetName name of makefile target for the rule. \param Section number of a makefile section. \return reference to the new makefile rule. If a makefile rule with target name \a TargetName already exists, a new rule will not be created. */ /*! \fn CMakefile::GetText(void) \brief Returns a plain text representation of the makefile. \return reference to CMakefile::m_Text. Make a call to CMakefile::Update(void) before using this function to convert object representation of the makefile to plain text. */ /*! \fn CMakefile::Update(void) \brief Creates plain text representation of the makefile from objects. \return makefile text (reference to CMakefile::m_Text). */ /*! \fn CMakefile::CMakefile(void) \brief Creates makefile. */ /*! \fn CMakefile::~CMakefile(void) \brief Destroys makefile. */ /* ! \fn CMakefile:: \brief . \param . \return . */ //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/doc/usage.txt0000644000175000017500000000555512143137414017065 0ustar moellermoellerUsage syntax: Generate makefile: cbp2make -in [-cfg ] [-out ] [-unix] [-windows] [-mac] [--all-os] [-targets "[,[, ...]]"] [--flat-objects] [--flat-objpath] [--wrap-objects] [--wrap-options] [--with-deps] [--keep-objdir] [--keep-outdir] [--target-case keep|lower|upper] [--macros-case keep|lower|upper] [--quote-path auto|never|always] cbp2make -list -in [-cfg ] [-unix] [-windows] [-mac] [--all-os] [-targets "[,[, ...]]"] [--flat-objects] [--flat-objpath] [--wrap-objects] [--wrap-options] [--with-deps] [--keep-objdir] [--keep-outdir] [--target-case keep|lower|upper] [--macros-case keep|lower|upper] [--quote-path auto|never|always] Manage toolchains: cbp2make --config toolchain --add [-unix|-windows|-mac] -chain cbp2make --config toolchain --remove [-unix|-windows|-mac] -chain Manage build tools: cbp2make --config tool --add [-unix|-windows|-mac] -chain -tool -type cbp2make --config tool --remove [-unix|-windows|-mac] -chain -tool Tool types: pp=preprocessor as=assembler cc=compiler rc=resource compiler sl=static linker dl=dynamic linker el=executable linker nl=native linker Tool options (common): -desc -program -command -mkv -srcext -outext -quotepath -fullpath -unixpath Tool options (compiler): -incsw -defsw -deps Tool options (linker): -ldsw -llsw -lpfx -lext -objext -lflat Manage platforms: cbp2make --config platform [-unix|-windows|-mac] [-pwd ] [-cd ] [-rm ] [-rmf ] [-rmd ] [-cp ] [-mv ] [-md ] [-mdf ] [-make ] Manage global compiler variables: cbp2make --config variable --add [-set ] -name [-desc ] [-field ] -value cbp2make --config variable --remove [-set ] [-name ] [-field ] Manage options: cbp2make --config options --default-options "" cbp2make --config show Common options: cbp2make --local // use configuration from current directory cbp2make --global // use configuration from home directory cbp2make --verbose // show project information cbp2make --quiet // hide all messages cbp2make --help // display this message cbp2make --version // display version information cbp2make-147+dfsg/src/doc/toolchains.dox0000644000175000017500000001717712155022124020074 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /*! \file toolchains.h \brief Toolchain description. */ /*! \file toolchains.cpp \brief Toolchain description. */ /*! \class CToolChain \brief Toolchain description. Contains properties of a toolchain (a set of build tools). */ /*! \var CToolChain::m_OS_Type \brief Platform (operating system) to which this toolchain belongs. */ /*! \var CToolChain::m_Alias \brief Name (alias) of the toolchain. Alias identifies the toolchain and primarily used for toolchain lookup. */ /*! \var CToolChain::m_C_Compiler \brief Name of C compiler. */ /*! \var CToolChain::m_Cpp_Compiler \brief Name of C++ compiler. */ /*! \var CToolChain::m_F77_Compiler \brief Name of Fortran77 compiler. */ /*! \var CToolChain::m_F9x_Compiler \brief Name of Fortran90/95 compiler. */ /*! \var CToolChain::m_Dynamic_Linker \brief Name of dynamic library linker. */ /*! \var CToolChain::m_Static_Linker \brief Name of static library linker. */ /*! \var CToolChain::m_Ranlib_Tool \brief Name of RANLIB tool for processing static libraries. */ /*! \var CToolChain::m_Windres_Tool \brief Name of WINDRES resource compiler. */ /*! \var CToolChain::m_Make_Tool \brief Name of MAKE build tool. */ /* ! \var CToolChain:: \brief . */ /*! \fn CToolChain::OS(void) \brief Platform (operating system) to which this toolchain belongs. \return reference to CToolChain::m_OS_Type. */ /*! \fn CToolChain::Alias(void) \brief Name (alias) of the toolchain. \return reference to CToolChain::m_Alias. */ /*! \fn CToolChain::C_Compiler(void) \brief Name of C compiler. \return reference to CToolChain::m_C_Compiler. */ /*! \fn CToolChain::Cpp_Compiler(void) \brief Name of C++ compiler. \return reference to CToolChain::m_Cpp_Compiler. */ /*! \fn CToolChain::F77_Compiler(void) \brief Name of Fortran77 compiler. \return reference to CToolChain::m_F77_Compiler. */ /*! \fn CToolChain::F9x_Compiler(void) \brief Name of Fortran90/95 compiler. \return reference to CToolChain::m_F9x_Compiler. */ /*! \fn CToolChain::Dynamic_Linker(void) \brief Name of dynamic library linker. \return reference to CToolChain::m_Dynamic_Linker. */ /*! \fn CToolChain::Static_Linker(void) \brief Name of static library linker. \return reference to CToolChain::m_Static_Linker. */ /*! \fn CToolChain::Ranlib_Tool(void) \brief Name of RANLIB tool for processing static libraries. \return reference to CToolChain::m_Ranlib_Tool. */ /*! \fn CToolChain::Windres_Tool(void) \brief Name of WINDRES resource compiler. \return reference to CToolChain::m_Windres_Tool. */ /*! \fn CToolChain::Make_Tool(void) \brief Name of MAKE build tool. \return reference to CToolChain::m_Make_Tool. */ /*! \fn CToolChain::Clear(void) \brief Resets the toolchain to the initial state. */ /*! \fn CToolChain::Default(const CPlatform::OS_Type OS) \brief Initializes the toolchain with default properties for platform \a OS. \param OS platform (operating system) identifier. */ /*! \fn CToolChain::Read(const TiXmlElement *ToolChainRoot) \brief Reads the toolchain settings from an XML document. \param ToolChainRoot an element of XML document. */ /*! \fn CToolChain::Write(TiXmlElement *ToolChainRoot) \brief Writes the toolchain settings to an XML document. \param ToolChainRoot an element of XML document. */ /*! \fn CToolChain::Show(void) \brief Prints the toolchain contents to standard output.. */ /*! \fn CToolChain::CToolChain(void) \brief Creates toolchain. */ /*! \fn CToolChain::~CToolChain(void) \brief Destroys toolchain. */ /* ! \fn CToolChain:: \brief . */ /*! \class CToolChainSet \brief Manages a set of toolchains. */ /*! \var CToolChainSet::m_ToolChains \brief List of toolchains. Contains pointers to CToolChain objects and owns them (i.e. objects sould be destroyed before the list is cleared). */ /*! \var CToolChainSet::m_Locked \brief Indicates that the set of toolchains cannot be modified. This property should be set by CToolChainSet::Lock(void) to prevent accidental modification and unset by CToolChainSet::Unlock(void) to release the lock. */ /* ! \var CToolChainSet:: \brief . */ /*! \fn CToolChainSet::Lock(void) \brief Locks the set of toolchains to prevent accidental modification. */ /*! \fn CToolChainSet::Unlock(void) \brief Unlocks the set of toolchains to allow modifications. */ /*! \fn CToolChainSet::Clear(void) \brief Resets the set of toolchains to the initial state. */ /*! \fn CToolChainSet::GetCount(void) const \brief Returns the number of toolchains in the set. \return number of toolchains in the set. */ /*! \fn CToolChainSet::ToolChain(const CPlatform::OS_Type OS, const size_t Index) const \brief Returns toolchain with number \a Index for \a OS platform. \param Index toolchain number. \param OS platform type. \return pointer to CToolChain. Returns \a NULL if a toolchain with number \a Index does not exist. */ /*! \fn CToolChainSet::Find(const CString& Alias, const CPlatform::OS_Type OS) \brief Searches toolchain with alias \a Alias for platform \a OS. \param Alias toolchain name (alias). \param OS platform (operating system) identifier. \return pointer to CToolChain. Returns \a NULL if no toolchain is found. */ /*! \fn CToolChainSet::AddDefault(void) \brief Initializes the default set of GNU toolchains for all known platforms. */ /*! \fn CToolChainSet::Add(const CString& Alias, const CPlatform::OS_Type OS) \brief Creates new toolchain with alias \a Alias for platform \a OS. \param Alias toolchain name (alias). \param OS platform (operating system) identifier. \return pointer to CToolChain. If the desired toolchain already exists, new toolchain is not created. */ /*! \fn CToolChainSet::Remove(const CString& Alias, const CPlatform::OS_Type OS) \brief Destroys a toolchain with alias \a Alias for platform \a OS. \param Alias toolchain name (alias). \param OS platform (operating system) identifier. \return . */ /*! \fn CToolChainSet::Read(const TiXmlElement *ConfigRoot) \brief Reads the set of toolchains from an XML document. \param ConfigRoot an element of XML document. */ /*! \fn CToolChainSet::Write(TiXmlElement *ConfigRoot) \brief Writes the set of toolchains to an XML document. \param ConfigRoot an element of XML document. */ /*! \fn CToolChainSet::Show(void) \brief Prints contents of all toolchains to standard output. */ /*! \fn CToolChainSet::CToolChain(const CPlatform::OS_Type OS, const CString& Alias) \brief Creates set of toolchains. \param OS platform (operating system) to which this toolchain belongs. \param Alias name (alias) of the toolchain. */ /*! \fn CToolChainSet::~CToolChainSet(void) \brief Destroys set of toolchains. */ /* ! \fn CToolChainSet:: \brief . \return . */ //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/doc/cbworkspace.dox0000644000175000017500000001772312155022125020232 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /*! \file cbworkspace.h \brief Workspace unit and workspace descriptions. */ /*! \file cbworkspace.cpp \brief Workspace unit and workspace descriptions. */ /*! \class CWorkspaceUnit \brief Workspace unit description. Contains properties of Code::Blocks workspace: subprojects, their dependencies and priorities. */ /*! \var CWorkspaceUnit::m_FileName \brief Workspace unit file name. */ /*! \var CWorkspaceUnit::m_Depends \brief List of workspace unit dependencies. Contains list of other workspace unit (project) names that this workspace unit requires to be built before itself. */ /*! \var CWorkspaceUnit::m_Project \brief Contains project properties. \sa CCodeBlocksProject. */ /*! \var CWorkspaceUnit::m_Weight \brief Weight (priority) of the workspace unit. Normally workspace unit weights range from 0 to 100. Lower weight means higher priority and vice versa. Workspace units with lower weights are compiled and linked first. */ /* ! \var CWorkspaceUnit:: \brief . */ /*! \fn CWorkspaceUnit::Clear(void) \brief Resets the workspace unit to the initial state. */ /*! \fn CWorkspaceUnit::Read(const TiXmlElement* UnitRoot) \brief Reads the workspace unit settings from an XML document. \param UnitRoot an element of XML document. */ /*! \fn CWorkspaceUnit::Show(void) \brief Prints the workspace unit contents to standard output. */ /*! \fn CWorkspaceUnit::LoadProject(void) \brief Loads the workspace unit (project) from file. \return \a true if the workspace unit was successfully loaded, \a false otherwise. Uses CBuildProject::LoadProject(const CString& FileName) with CWorkspaceUnit::m_FileName as the workspace unit file name. */ /*! \fn CWorkspaceUnit::CWorkspaceUnit(void) \brief Creates workspace unit. */ /*! \fn CWorkspaceUnit::~CWorkspaceUnit(void) \brief Destroys workspace unit. */ /* ! \fn CWorkspaceUnit:: \brief . \param . \return . */ /*! \class CCodeBlocksWorkspace \brief Workspace description. Contains properties of Code::Blocks workspace. */ /*! \var CCodeBlocksWorkspace::m_Title \brief Title of the workspace. */ /*! \var CCodeBlocksWorkspace::m_Units \brief List of workspace units (projects) in the workspace. \sa CWorkspaceUnit. */ /*! \var CCodeBlocksWorkspace::m_TargetNames \brief List of build target names of workspace units. This list is automatically refreshed by CCodeBlocksWorkspace::GenerateMakefile(const CString& FileName, CCodeBlocksBuildConfig& Config). */ /*! \var CCodeBlocksWorkspace::m_MakefileNames \brief List of makefile names of workspace units. This list is automatically refreshed by CCodeBlocksWorkspace::GenerateMakefile(const CString& FileName, CCodeBlocksBuildConfig& Config). */ /*! \var CCodeBlocksWorkspace::m_MakefilePaths \brief List of makefile paths of workspace units. This list is automatically refreshed by CCodeBlocksWorkspace::GenerateMakefile(const CString& FileName, CCodeBlocksBuildConfig& Config). */ /*! \var CCodeBlocksWorkspace::m_TargetDeps \brief List of dependencies of workspace units. Each line of the list contains decorated project names separated by space character and represents dependencies of corresponding project contained in the workspace. Decorated names are used as makefile target names. This list is automatically refreshed by CCodeBlocksWorkspace::GenerateMakefile(const CString& FileName, CCodeBlocksBuildConfig& Config). */ /*! \var CCodeBlocksWorkspace::m_MakefileText \brief Contains plain text of makefile for the workspace. Contents of makefile are generated by CCodeBlocksWorkspace::GenerateMakefileText(const CString& FileName, CCodeBlocksBuildConfig& Config) before saving to a file. */ /*! \var CCodeBlocksWorkspace::m_Makefile \brief Contains object-based makefile for the workspace. Contents of makefile are generated by CCodeBlocksWorkspace::GenerateMakefile(const CString& FileName, CCodeBlocksBuildConfig& Config) before saving to a file. */ /* ! \var CCodeBlocksWorkspace:: \brief . */ /*! \fn CCodeBlocksWorkspace::CalculateProjectWeight(const size_t Index = 0) \brief Calculates weight (priority) of a single workspace unit (project) with number \a Index. \param Index number of a workspace unit (project). \return weight of a project. This function is a part of the core mechanism for resolving project dependencies. \sa CCodeBlocksWorkspace::ResolveProjectDependencies(void) */ /*! \fn CCodeBlocksWorkspace::ResolveProjectDependencies(void) \brief Resolves workspace unit (project) dependencies by calculating project weights. \sa CCodeBlocksWorkspace::CalculateProjectWeight(const size_t Index = 0) */ /*! \fn CCodeBlocksWorkspace::SortProjectsByWeight(void) \brief Sorts workspace units (projects) by weight in ascending order. This function is a part of the core mechanism for resolving project dependencies. \sa CCodeBlocksWorkspace::ResolveProjectDependencies(void) */ /*! \fn CCodeBlocksWorkspace::Clear(void) \brief Resets the workspace to the initial state. */ /*! \fn CCodeBlocksWorkspace::Read(const TiXmlElement* WorkspaceRoot) \brief Reads the workspace settings from an XML document. \param WorkspaceRoot an element of XML document. */ /*! \fn CCodeBlocksWorkspace::LoadWorkspaceProjects(void) \brief Loads all workspace units (projects) in the workspace. \return \a true if all of projects were successfully loaded, \a false otherwise. */ /*! \fn CCodeBlocksWorkspace::LoadWorkspace(const CString& FileName) \brief Loads a workspace from a file specified by \a FileName. \param FileName name of Code::Blocks workspace file. \return \a true if specified workspace and all of its units (projects) were successfully loaded, \a false otherwise. */ /*! \fn CCodeBlocksWorkspace::Show(const bool ShowProjects = false) \brief Prints the workspace contents and (optionally) contents of workspace units (projects) to standard output. \param ShowProjects tell to display contents of workspace units. */ /*! \fn CCodeBlocksWorkspace::GenerateMakefile(const CString& FileName, CCodeBlocksBuildConfig& Config) \brief Generates makefile and writes its text representation to a file specified by \a FileName. \param FileName a file name for makefile of the workspace. \param Config build configuration. This function generates makefile text only for the workspace, makefiles for individual projects in the workspace are generated by CCodeBlocksProject. */ /*! \fn CCodeBlocksWorkspace::GenerateMakefileText(const CString& FileName, CCodeBlocksBuildConfig& Config) \brief Generates makefile text and writes it to a file specified by \a FileName. \param FileName a file name for makefile of the workspace. \param Config build configuration. This function generates makefile text only for the workspace, makefiles for individual projects in the workspace are generated by CCodeBlocksProject. */ /*! \fn CCodeBlocksWorkspace::CCodeBlocksWorkspace(void) \brief Create workspace. */ /*! \fn CCodeBlocksWorkspace::~CCodeBlocksWorkspace(void) \brief Destroys workspace. */ /* ! \fn CCodeBlocksWorkspace:: \brief . \param . \return . */ //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/doc/cbpunit.dox0000644000175000017500000000642112155022124017363 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /*! \file cbpunit.h \brief Build unit description. */ /*! \file cbpunit.cpp \brief Build unit description. */ /*! \class CBuildUnit \brief Build unit description. Contains properties of a build unit. */ /*! \typedef CBuildUnit::UnitType \brief Defines known types of build units. */ /*! \var CBuildUnit::m_FileName \brief File name of the build unit. */ /*! \var CBuildUnit::m_Targets \brief List of build target names to which this build unit belong. */ /*! \var CBuildUnit::m_CompileVariable \brief Selects compiler variable ("CC", "CXX", etc) for the build unit. If the value is not an empty string, it overrides the default compiler variable for the build unit. */ /*! \var CBuildUnit::m_DoCompile \brief Allows compilation of the build unit. */ /*! \var CBuildUnit::m_DoLink \brief Allows linking of the build unit. */ /*! \var CBuildUnit::m_Type \brief Type of the build unit (source file, resource, header file, etc). \sa CBuildUnit::UnitType */ /*! \var CBuildUnit::m_Weight \brief Weight (priority) of the build unit. Normally build unit weights range from 0 to 100. Lower weight means higher priority and vice versa. Build units with lower weights are compiled and linked first. */ /*! \var CBuildUnit::m_ObjectFileName \brief File name of the object file (a result of compilation) of this build unit. */ /*! \fn CBuildUnit::GetUnitType(const CString& Extension) \brief Returns build unit type for units with file extension specified by \a Extension. \param Extension file extension without leading dot separator. \return type of build unit. */ /*! \fn CBuildUnit::IsCompilable(void) \brief Tells if the build unit requires compilation. \return \a true if the build unit requires compilation, \a false otherwise. Compilability of a build unit is decided from the type of the build unit. */ /*! \fn CBuildUnit::Clear(void) \brief Resets the build unit to the initial state. */ /*! \fn CBuildUnit::Read(const TiXmlElement *UnitRoot) \brief Reads the build unit settings from an XML document. \param UnitRoot an element of an XML document. */ /*! \fn CBuildUnit::Show(void) \brief Prints the build unit contents to standard output. */ /*! \fn CBuildUnit::CBuildUnit(void) \brief Creates build unit. */ /*! \fn CBuildUnit::~CBuildUnit(void) \brief Destroys build unit. */ /* ! \fn CBuildUnit:: \brief . \param . \return . */ //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/doc/cbproject.dox0000644000175000017500000002600612155022124017673 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /*! \file cbproject.h \brief Project description. */ /*! \file cbproject.cpp \brief Project description. */ /*! \class CCodeBlocksProject \brief Project description. Contains properties of a project and generates makefiles. */ /* ! \var CCodeBlocksProject::m_ValidProject \brief . */ /*! \var CCodeBlocksProject::m_VersionMajor \brief Major version number. */ /*! \var CCodeBlocksProject::m_VersionMinor \brief Minor version number. */ /*! \var CCodeBlocksProject::m_Title \brief Title of the project. */ /*! \var CCodeBlocksProject::m_DefaultTarget \brief Name of the default build target of the project. */ /*! \var CCodeBlocksProject::m_Compiler \brief Name (alias) of the default toolchain for the project. */ /*! \var CCodeBlocksProject::m_ExtendedObjectNames \brief Controls how object files are named. When set to \a true, an object file extension (e.g. ".o" or ".obj") is appended to a build unit file name (e.g. "unit.cpp" becomes "unit.cpp.o"), otherwise, when set to \a false, a build unit file extension is replaced by an object file extension (e.g. "unit.cpp" becomes "unit.o"). */ /*! \var CCodeBlocksProject::m_CompilerOptions \brief Project-wide list of compiler options. */ /*! \var CCodeBlocksProject::m_CompilerDirectories \brief Project-wide list of search directories for compiler(s). */ /*! \var CCodeBlocksProject::m_LinkerOptions \brief Project-wide list of linker options. */ /*! \var CCodeBlocksProject::m_LinkerLibraries \brief Project-wide list of libraries to link with the project. */ /*! \var CCodeBlocksProject::m_LinkerDirectories \brief Project-wide list of search directories for linker. */ /*! \var CCodeBlocksProject::m_ResourceCompilerDirectories \brief Project-wide list of search directories for resource compiler. */ /*! \var CCodeBlocksProject::m_BeforeBuildCommands \brief Project-wide list of commands that should be executed prior to starting the build process. */ /*! \var CCodeBlocksProject::m_AfterBuildCommands \brief Project-wide list of commands that should be executed after the build process is finished. */ /*! \var CCodeBlocksProject::m_ForceBeforeBuildCommands \brief Makes the execution of the project-wide before-build commands unconditional. \sa CCodeBlocksProject::m_BeforeBuildCommands */ /*! \var CCodeBlocksProject::m_ForceAfterBuildCommands \brief Makes the execution of the project-wide after-build commands unconditional. \sa CCodeBlocksProject::m_AfterBuildCommands */ /*! \var CCodeBlocksProject::m_BuildTargets \brief List of build targets of the project. Contains pointers to CBuildTarget objects and owns them (i.e. objects sould be destroyed before the list is cleared). */ /*! \var CCodeBlocksProject::m_VirtualTargets \brief List of virtual build targets of the project. Contains pointers to CVirtualTarget objects and owns them (i.e. objects sould be destroyed before the list is cleared). */ /*! \var CCodeBlocksProject::m_Units \brief List of build units of the project. Contains pointers to CBuildUnit objects and owns them (i.e. objects sould be destroyed before the list is cleared). */ /*! \var CCodeBlocksProject::m_Environment \brief Symbol table for environment variables. */ /*! \var CCodeBlocksProject::m_Platforms \brief List of platforms used in the project. Contains pointers to CPlatform objects and owns them (i.e. objects sould be destroyed before the list is cleared). */ /*! \var CCodeBlocksProject::m_SinglePlatform \brief Indicates that makefile should be generated only for one platform. This property is automatically refreshed by CCodeBlocksProject::GenerateMakefileText(const CString& FileName, CCodeBlocksBuildConfig& Config) or CCodeBlocksProject::GenerateMakefile(const CString& FileName, CCodeBlocksBuildConfig& Config). */ /*! \var CCodeBlocksProject::m_BuildTargetIndex \brief List of build targets valid for a platform. Contains pointers to CBuildTarget objects but does not own them (i.e. objects sould not be destroyed before the list is cleared). This property is automatically refreshed by CCodeBlocksProject::UpdatePlatformIndex(const size_t Platform, CCodeBlocksBuildConfig& Config). */ /*! \var CCodeBlocksProject::m_VirtualTargetIndex \brief List of virtual build targets valid for a platform. Contains pointers to CVirtualTarget objects but does not own them (i.e. objects sould not be destroyed before the list is cleared). This property is automatically refreshed by CCodeBlocksProject::UpdatePlatformIndex(const size_t Platform, CCodeBlocksBuildConfig& Config). */ /*! \var CCodeBlocksProject::m_UnitIndex \brief List of build units valid for a build target. Contains pointers to CBuildUnit objects but does not own them (i.e. objects sould not be destroyed before the list is cleared). This property is automatically refreshed by CCodeBlocksProject::UpdateTargetIndex(const int Target, CCodeBlocksBuildConfig& Config). */ /*! \var CCodeBlocksProject::m_ToolChainIndex \brief List of toolchains valid for a platform. Contains pointers to CPlatform objects but does not own them (i.e. objects sould not be destroyed before the list is cleared). This property is automatically refreshed by CCodeBlocksProject::UpdatePlatformIndex(const size_t Platform, CCodeBlocksBuildConfig& Config). */ /*! \var CCodeBlocksProject::m_Dependencies \brief Stores dependencies of build units. CDependencyInfo is used to store information about relationship between build units in order to generate makefule rules for unit dependencies. See depsearch.h for additional information on gathering unit dependencies. */ /* ! \var CCodeBlocksProject::m_MakefileText \brief Contains plain text of makefile for the project. Contents of makefile are generated by CCodeBlocksProject::GenerateMakefileText(const CString& FileName, CCodeBlocksBuildConfig& Config) before saving to a file. */ /*! \var CCodeBlocksProject::m_Makefile \brief Contains object-based description of makefile for the project. Contents of makefile are generated by CCodeBlocksProject::GenerateMakefile(const CString& FileName, CCodeBlocksBuildConfig& Config) before saving to a file. */ /* ! \var CCodeBlocksProject:: \brief . */ /*! \fn CCodeBlocksProject::DecorateTargetNames(void) \brief Makes makefile-compatible build target names for all build targets. \sa CCodeBlocksProject::DecorateTargetName(const CString& TargetName). */ /*! \fn CCodeBlocksProject::SortUnitsByWeight(void) \brief Sorts project units by weight in ascending order. \sa CBuildUnit::m_Weight. */ /*! \fn CCodeBlocksProject::Clear(void) \brief Resets the project to the initial state. */ /*! \fn CCodeBlocksProject::Read(const TiXmlElement *ProjectRoot) \brief Reads the project settings from an XML document. \param ProjectRoot an element of XML document. */ /*! \fn CCodeBlocksProject::LoadProject(const CString& FileName) \brief Loads a project from a file specified by \a FileName. \param FileName name of Code::Blocks project file. \return \a true if specified project is successfully loaded, \a false otherwise. */ /*! \fn CCodeBlocksProject::Show(void) \brief Prints the project contents to standard output. */ /*! \fn CCodeBlocksProject::UpdatePlatformIndex(const size_t Platform, CCodeBlocksBuildConfig& Config) \brief Updates lists of build targets, virtual build targets and toolchains. \param Platform index of a platform in the build configuration. \param Config build configuration. Refreshes CCodeBlocksProject::m_BuildTargetIndex, CCodeBlocksProject::m_VirtualTargetIndex and CCodeBlocksProject::m_ToolChainIndex by selecting only items valid for the specified platform. */ /*! \fn CCodeBlocksProject::UpdateTargetIndex(const int Target, CCodeBlocksBuildConfig& Config) \brief Updates list of build units. \param Target index of a target in the build configuration. \param Config build configuration. Refreshes CCodeBlocksProject::m_UnitIndex by selecting only units valid for the specified build target. */ /*! \fn CCodeBlocksProject::DecorateVariableName(const CString& VariableName, const int Case = 0) \brief Makes a makefile-compatible macro variable name from the given name. \param VariableName an unprepared macro variable name. \param Case casing of the variable name: \li 0 - don't change existing case (default) \li 1 - make all characters lower case \li 2 - make all characters upper case \return makefile-compatible macro variable name. This function uses MakefileFriendly(const CString& AString) for the job. */ /*! \fn CCodeBlocksProject::DecorateTargetName(const CString& TargetName, const int Case = 2) \brief Makes a makefile-compatible build target name from the given name. \param TargetName an unprepared build target name. \param Case casing of the variable name: \li 0 - don't change existing case \li 1 - make all characters lower case \li 2 - make all characters upper case (default) \return makefile-compatible build target name. This function uses MakefileFriendly(const CString& AString) for the job. */ /*! \fn CCodeBlocksProject::GenerateMakefileText(const CString& FileName, CCodeBlocksBuildConfig& Config) \brief Generates makefile text and writes it to the file specified by \a FileName. \param FileName a file name for makefile of the project. \param Config build configuration. \return \a true if makefile was successfully generated, \a false otherwise. */ /*! \fn CCodeBlocksProject::GenerateMakefile(const CString& FileName, CCodeBlocksBuildConfig& Config) \brief Generates makefile text and writes it to the file specified by \a FileName. \param FileName a file name for makefile of the project. \param Config build configuration. \return \a true if makefile was successfully generated, \a false otherwise. This function uses intermediate object-based makefile description CCodeBlocksProject::m_Makefile to generate plain text makefile. */ /*! \fn CCodeBlocksProject::CCodeBlocksProject(void) \brief Creates project. */ /*! \fn CCodeBlocksProject::~CCodeBlocksProject(void) \brief Destroys project. */ /* ! \fn CCodeBlocksProject:: \brief . \param . \return . */ //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/doc/platforms.dox0000644000175000017500000003433612155022125017735 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /*! \file platforms.h \brief Platform / Operating System specific functions. */ /*! \file platforms.cpp \brief Platform / Operating System specific functions. */ /*! \var STR_UNIX \brief UNIX platform name for configuration files. */ /*! \var STR_WINDOWS \brief Windows platform name for configuration files. */ /*! \var STR_MAC \brief Mac platform name for configuration files. */ /*! \class CPlatform \brief Contains platform-specific settings and generates commands from templates. Command templates use few special macros that should be substituted to get a working command: \li \a $src for source file or directory name. \li \a $dst for destination file or directory name. \li \a $opts for command options \li \a $file for file name \li \a $dir for directory name A command template looks like this: "make $opts -f $file" (make tool invocation). */ /*! \enum CPlatform::OS_Type \brief Type of Operating System for a platform. */ /*! \var CPlatform::OS_Type CPlatform::OS_Other \brief Type for undefined or unknown OS. */ /*! \var CPlatform::OS_Type CPlatform::OS_Unix \brief Type for UNIX-like OS. */ /*! \var CPlatform::OS_Type CPlatform::OS_Windows \brief Type for OS Windows. */ /*! \var CPlatform::OS_Type CPlatform::OS_Mac \brief Type for MacOS. */ /*! \var CPlatform::OS_Type CPlatform::OS_Count \brief Number of OS types. */ /*! \var CPlatform::m_Active \brief Indicates that this platform is used by a build target. This property is modified by CCodeBlocksProject during makefile creation. */ /*! \var CPlatform::m_OS_Type \brief Type of operating system for this platform. */ /*! \var CPlatform::m_Cmd_Null \brief Name of the NULL device (/dev/null etc). */ /*! \var CPlatform::m_Cmd_Copy \brief File copying command template. */ /*! \var CPlatform::m_Cmd_Move \brief File moving command template. */ /*! \var CPlatform::m_Cmd_Make \brief Make tool invocation template. */ /*! \var CPlatform::m_Tool_Make \brief File name of the make tool. */ /* ! \var CPlatform::m_Cmd_TestFile \brief . */ /*! \var CPlatform::m_Cmd_RemoveFile \brief File removing (deleting) command template. */ /*! \var CPlatform::m_Cmd_ForceRemoveFile \brief Forced file removing command template. */ /* ! \var CPlatform::m_Cmd_TestDir \brief . */ /*! \var CPlatform::m_Cmd_MakeDir \brief Directory creation command template. */ /*! \var CPlatform::m_Cmd_TestMakeDir \brief Directory existence checking and creation command template. */ /*! \var CPlatform::m_Cmd_ForceMakeDir \brief Forced directory creation (including parent directories) command template. */ /*! \var CPlatform::m_Cmd_RemoveDir \brief Directory removing command template. */ /*! \var CPlatform::m_Cmd_PrintWorkDir \brief Template of command to print working directory. */ /*! \var CPlatform::m_Cmd_EvalWorkDir \brief Template of command that evaluates working directory to assign it to a variable. */ /*! \var CPlatform::m_Cmd_ChangeDir \brief Current directory changing command template. */ /*! \var CPlatform::m_PathDelimiter \brief File system path delimiter (separator). */ /* ! \var CPlatform:: \brief . */ /*! \fn CPlatform::Name(const OS_Type PlatformOS) \brief Returns name of platform for type \a PlatformOS. \param PlatformOS a platform / operating system type. \return name of platform. */ /*! \fn CPlatform::OS(CString& PlatformName) \brief Returns platform type for name \a PlatformName. \param PlatformName a name of platform / operating system. \return type of platform. */ /*! \fn CPlatform::Active(void) \brief Indicates that this platform is used by a build target. \return reference to CPlatform::m_Active. */ /*! \fn CPlatform::OS(void) const \brief Type of operating system for this platform. \return value of CPlatform::m_OS_Type. */ /*! \fn CPlatform::Name(void) \brief Returns the name of this platform. \return name of this platform. */ /*! \fn CPlatform::Cmd_Copy(void) \brief File copying command template. \return reference to CPlatform::m_Cmd_Copy. */ /*! \fn CPlatform::Cmd_Move(void) \brief File moving command template. \return reference to CPlatform::m_Cmd_Move. */ /*! \fn CPlatform::Cmd_Make(void) \brief Make tool invocation template. \return reference to CPlatform::m_Cmd_Make. */ /*! \fn CPlatform::Tool_Make(void) \brief File name of the 'make' tool. \return reference to CPlatform::m_Tool_Make. */ /*! \fn CPlatform::Cmd_RemoveFile(void) \brief File removing (deleting) command template. \return reference to CPlatform::m_Cmd_RemoveFile. */ /*! \fn CPlatform::Cmd_ForceRemoveFile(void) \brief Forced file removing command template. \return reference to CPlatform::m_Cmd_ForceRemoveFile. */ /*! \fn CPlatform::Cmd_MakeDir(void) \brief Directory creation command template. \return reference to CPlatform::m_Cmd_ForceMakeDir. */ /*! \fn CPlatform::Cmd_TestMakeDir(void) \brief Directory existence checking and creation command template. \return reference to CPlatform::m_Cmd_TestMakeDir. */ /*! \fn CPlatform::Cmd_ForceMakeDir(void) \brief Forced directory creation (including parent directories) command template. \return reference to CPlatform::m_Cmd_ForceMakeDir. */ /*! \fn CPlatform::Cmd_RemoveDir(void) \brief Directory removing command template. \return reference to CPlatform::m_Cmd_RemoveDir. */ /*! \fn CPlatform::Cmd_PrintWorkDir(void) \brief Template of command to print working directory. \return reference to CPlatform::m_Cmd_PrintWorkDir. */ /*! \fn CPlatform::Cmd_EvalWorkDir(void) \brief Template of command that evaluates working directory to assign it to a variable. \return reference to CPlatform::m_Cmd_EvalWorkDir. */ /*! \fn CPlatform::Cmd_ChangeDir(void) \brief Current directory changing command template. \return reference to CPlatform::m_Cmd_ChangeDir. */ /*! \fn CPlatform::Pd(void) const \brief Returns path delimiter (separator) for this platform. \return path delimiter (separator) for this platform. */ /*! \fn CPlatform::Pd(const CString& Path) const \brief Converts path separators in given path to valid for this platform. \param Path a file path. \return file path with valid separators. */ /*! \fn CPlatform::Copy(const CString& Source, const CString& Destination) const \brief Generates file copying command from template. \param Source source file. \param Destination target file. \return file copying command. \sa CPlatform::Cmd_Copy(). */ /*! \fn CPlatform::Move(const CString& Source, const CString& Destination) const \brief Generates file moving command from template. \param Source source file. \param Destination target file. \return file moving command. \sa CPlatform::Cmd_Move(). */ /*! \fn CPlatform::Make(const CString& Options, const CString& Path) const \brief Generates command to invoke make tool from template. \param Options make tool options. \param Path path to a makefile. \return make tool invocation command. \sa CPlatform::Cmd_Make(). */ /*! \fn CPlatform::RemoveFile(const CString& Path) const \brief Generates file removing command from template. \param Path a file path. \return file removing command. \sa CPlatform::Cmd_RemoveFile(). */ /*! \fn CPlatform::ForceRemoveFile(const CString& Path) const \brief Generates forced file removing command from template. \param Path a file path. \return forced file removing command. \sa CPlatform::Cmd_ForceRemoveFile(). */ /*! \fn CPlatform::MakeDir(const CString& Path) const \brief Generates directory creation command from template. \param Path a directory path. \return directory creation command. \sa CPlatform::Cmd_MakeDir(). */ /*! \fn CPlatform::TestMakeDir(const CString& Path) const \brief Generates conditional (by existence) directory creation command from template. \param Path a directory path. \return conditional directory creation command. \sa CPlatform::Cmd_TestMakeDir(). */ /*! \fn CPlatform::ForceMakeDir(const CString& Path) const \brief Generates forced directory creation command from template. \param Path a directory path. \return forced directory creation command. \sa CPlatform::Cmd_ForceMakeDir(). */ /*! \fn CPlatform::RemoveDir(const CString& Path) const \brief Generates directory removing command from template. \param Path a directory path. \return directory removing command. \sa CPlatform::Cmd_RemoveDir(). */ /*! \fn CPlatform::PrintWorkDir(void) const \brief Generates command to print current working directory from template. \return command to print current working directory. \sa CPlatform::Cmd_PrintWorkDir(). */ /*! \fn CPlatform::EvalWorkDir(void) const \brief Generates command to evaluate working directory value from template. \return working directory expression for assignment to a variable. \sa CPlatform::Cmd_EvalWorkDir(). */ /*! \fn CPlatform::ChangeDir(const CString& Path) const \brief Generates current directory changing command from template. \param Path a directory path. \return current directory changing command. \sa CPlatform::Cmd_ChangeDir(). */ /*! \fn CPlatform::MakefileCmd(const CString& Command) const \brief Converts raw command text to makefile-compatible form. \param Command a command text. \return makefile-compatible command. In Windows, it is required to prepend commands with "cmd /c" in order to make them work as intended from the makefile, while in UNIX is is not required to change commands anyhow. This function is invented to deal with compatibility issues for other platforms as well. */ /*! \fn CPlatform::Read(const TiXmlElement *Root, const CString& Name, CString& Value) \brief Reads template of command \a Name to \a Value from an XML document. \param Root an element of an XML document. \param Name name of a command. \param Value command template. */ /*! \fn CPlatform::Write(TiXmlElement *Root, const CString& Name, const CString& Value) \brief Writes template of command \a Name to \a Value from an XML document. \param Root an element of an XML document. \param Name name of a command. \param Value command template. */ /*! \fn CPlatform::Assign(const CPlatform& Platform) \brief Copies another platform to this platform. \param Platform another platform. */ /*! \fn CPlatform::Clear(void) \brief Resets the platform to the initial state. */ /*! \fn CPlatform::Reset(const CPlatform::OS_Type OS) \brief Resets the platform to default settings for specified OS. \param OS operating system type. */ /*! \fn CPlatform::Read(const TiXmlElement *PlatformRoot) \brief Reads the platform settings from an XML document. \param PlatformRoot an element of an XML document. */ /*! \fn CPlatform::Write(TiXmlElement *PlatformRoot) \brief Writes the platform settings to an XML document. \param PlatformRoot an element of an XML document. */ /*! \fn CPlatform::Show(void) \brief Prints the platform settings to the standard output. */ /*! \fn CPlatform::operator =(const CPlatform& Platform) \brief Copies another platform to this platform. \param Platform another platform. \return reference to this platform. */ /*! \fn CPlatform::CPlatform(void) \brief Creates platform description. */ /*! \fn CPlatform::CPlatform(const CPlatform& Platform) \brief Copies another platform to this platform. \param Platform another platform. */ /* ! \fn CPlatform::~CPlatform(void) \brief Destroys platform description. */ /* ! \fn CPlatform:: \brief . \param . \return . */ /*! \class CPlatformSet \brief Manages a set of platforms. */ /*! \var CPlatformSet::m_Platforms \brief A collection of known platfroms. */ /*! \var CPlatformSet::m_Locked \brief A lock for preventing from accidental changes during makefile generation. */ /* ! \var CPlatformSet:: \brief . */ /*! \fn CPlatformSet::Lock(void) \brief Locks the platform set to avoid accidental changes. */ /*! \fn CPlatformSet::Unlock(void) \brief Unlocks the platform set. */ /*! \fn CPlatformSet::Clear(void) \brief Resets the platform set to the initial state. */ /*! \fn CPlatformSet::GetCount(void) const \brief Returns the number of platforms in the set. \return number of platforms. */ /*! \fn CPlatformSet::Platform(const size_t Index) const \brief Returns a plafrorm by index. \param Index a platform index. \return pointer to CPlatform or \a NULL if the \a Index parameter is not valid. */ /*! \fn CPlatformSet::Find(const CPlatform::OS_Type OS) \brief Searches a platform by operating system type. \param OS an operating system type. \return pointer to CPlatform or \a NULL if the \a OS parameter is not valid. */ /*! \fn CPlatformSet::AddDefault(void) \brief Registers three default platforms: UNIX, MacOS, Windows. */ /*! \fn CPlatformSet::Read(const TiXmlElement *ConfigRoot) \brief Reads a platform set configuration from an XML document. \param ConfigRoot an XML document. */ /*! \fn CPlatformSet::Write(TiXmlElement *ConfigRoot) \brief Writes a platform set configuration to an XML document. \param ConfigRoot an XML document. */ /*! \fn CPlatformSet::Show(void) \brief Prints the platform set contents to the standard output. */ /*! \fn CPlatformSet::CPlatformSet(void) \brief Creates set of platforms. */ /*! \fn CPlatformSet::~CPlatformSet(void) \brief Destroys set of platforms. */ /* ! \fn CPlatformSet:: \brief . \param . \return . */ //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/doc/mainpage.dox0000644000175000017500000000013012143137414017475 0ustar moellermoeller/*! \mainpage \section sec_usage Usage \verbinclude usage.txt */ cbp2make-147+dfsg/src/doc/cbhelper.dox0000644000175000017500000000440012155022125017477 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /*! \file cbhelper.h \brief Auxiliary functions for strings processing. */ /*! \file cbhelper.cpp \brief Auxiliary functions for strings processing. */ /*! \fn ShowStringList(const CString& Title, const CString& LinePrefix, const CStringList& StringList) \brief Prints titled string list to standard output. \param Title title of the string list. \param LinePrefix prefix string pritned at the beginning of each line. \param StringList list of strings to display. */ /*! \fn MakefileFriendly(const CString& AString) \brief Makes a makefile compatible identifier string from the given string. \param AString an identifier name. Custom strings may contain characters that are not allowed inside makefile, therefore these characters are replaced with allowed characters (underscore, etc). */ /*! \fn XMLFriendly(const CString& AString) \brief Makes an XML compatible identifier string from the given string. \param AString an identifier name. Custom strings may contain characters that are not allowed for XML tags, therefore these characters are replaced with allowed characters (underscore, etc). */ /*! \fn FlatFileName(const CString& FileName) \brief Converts given file path to another file name without path delimiters. \param FileName a file name possibly containing path to a file. Example: "path/to/file/source.o" will be converted to "path_to_file_source.o" */ //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/doc/depsearch.dox0000644000175000017500000004505312155022125017662 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /*! \file depsearch.h \brief Unit dependency information gathering. */ /*! \file depsearch.cpp \brief Unit dependency information gathering. */ /*! \class CDependencyRecord \brief Dependency record for a single build unit. Contains a list of units (pointers to other CDependencyRecord objects) that this unit depends on and a list of cross-references to this unit. This class is used by CDependencyInfo to store information about every single build unit. */ /*! \var CDependencyRecord::m_Name \brief File name of the build unit. */ /*! \var CDependencyRecord::m_Hash \brief String hash of the unit name CDependencyRecord::m_Name. */ /*! \var CDependencyRecord::m_Dependencies \brief List of units that this unit depends on. */ /*! \var CDependencyRecord::m_CrossReferences \brief List of units that depend on this unit. */ /*! \var CDependencyRecord::m_DependenciesComplete \brief Indicates that the list of dependencies is fully gathered. */ /*! \var CDependencyRecord::m_CrossReferencesComplete \brief Indicates that the list of cross-references is fully gathered. */ /*! \var CDependencyRecord::m_Marker \brief Indicates that this unit was already walked through by a dependency unwinding process to avoid infinite loops. */ /* ! \var CDependencyRecord:: \brief . */ /*! \fn CDependencyRecord::GetName(void) const \brief Returns the file name of the build unit. \return name of the build unit. */ /*! \fn CDependencyRecord::SetName(const CString& Name) \brief Changes the file name of the build unit. */ /*! \fn CDependencyRecord::Hash(void) const \brief Returns string hash for the file name. */ /*! \fn CDependencyRecord::DependenciesCount(void) const \brief Returns the number of unit denpendencies. \return denpendencies count. */ /*! \fn CDependencyRecord::Dependency(const size_t Index) const \brief Returns dependency record with number \a Index. \param Index number of a dependency. \return dependency record. */ /*! \fn CDependencyRecord::AddDependency(const CDependencyRecord *Record) \brief Adds new dependency for this build unit. \param Record dependency record of another build unit. Adding a dependency means telling that this build unit depends on another build unit. */ /*! \fn CDependencyRecord::CrossReferencesCount(void) const \brief Returns the number of cross references to this unit. \return cross references count. */ /*! \fn CDependencyRecord::CrossReference(const size_t Index) const \brief Returns cross reference with number \a Index. \param Index number of a cross reference. \return cross reference. */ /*! \fn CDependencyRecord::AddCrossReference(const CDependencyRecord *Record) \brief Adds new cross reference for this build unit. \param Record dependency record of another build unit. Adding a cross reference means telling that another build unit depends on this build unit. */ /*! \fn CDependencyRecord::DependenciesComplete(void) \brief Indicates that the list of dependencies is fully gathered. \return reference to CDependencyRecord::m_DependenciesComplete. */ /*! \fn CDependencyRecord::CrossReferencesComplete(void) \brief Indicates that the list of cross-references is fully gathered. \return reference to CDependencyRecord::m_CrossReferencesComplete. */ /*! \fn CDependencyRecord::Marker(void) \brief Indicates that this unit was already walked through by a dependency unwinding process to avoid infinite loops. \return reference to CDependencyRecord::m_Marker. */ /*! \fn CDependencyRecord::Clear(void) \brief Resets a dependency record to the initial state. */ /*! \fn CDependencyRecord::Show(void) \brief Prints the build unit dependecy record contents to the standard output. */ /*! \fn CDependencyRecord::CDependencyRecord(void) \brief Creates dependency record. */ /*! \fn CDependencyRecord::~CDependencyRecord(void) \brief Destroys dependency record. */ /* ! \fn CDependencyRecord:: \brief . \param . \return . */ /*! \class CDependencyInfo \brief Dependency information for build units in a project. Stores a database of build unit dependencies and cross references, searches and unwinds dependncies of a particular unit, writes makefile rules for unit dependencies. Generally speaking, CDependencyInfo tracks only dependencies between abstract names (strings), it doesn't really care whether those names are real file names or build units or not. The only exception to that is providing platform information to a dependency search filter like CIncludeSearchFilter and its descendants for building compatible file paths. */ /*! \var CDependencyInfo::m_Platform \brief Platform/OS type, generally used for creating compatible file paths. */ /*! \var CDependencyInfo::m_Records \brief Database of build unit dependencies. */ /* ! \var CDependencyInfo:: \brief . */ /*! \fn CDependencyInfo::ResetMarkers(void) \brief Clears CDependencyRecord::m_Marker for all records in CDependencyInfo::m_Records. This function should be called before unwinding a new dependency. */ /*! \fn CDependencyInfo::DependenciesCount(CDependencyRecord *Record) \brief Returns the number of dependencies for a build unit pointed by \a Record. \param Record dependency record of a build unit. \return dependencies count. */ /*! \fn CDependencyInfo::Dependencies(CDependencyRecord *Record) \brief Returns the list of file names of build units that a build unit pointed by \a Record depends on. \param Record dependency record of a build unit. \return list of file names. */ /*! \fn CDependencyInfo::CrossReferencesCount(CDependencyRecord *Record) \brief Returns the number of cross references for a build unit pointed by \a Record. \param Record dependency record of a build unit. \return cross references count. */ /*! \fn CDependencyInfo::CrossReferences(CDependencyRecord *Record) \brief Returns the list of file names of build units that depend on a build unit pointed by \a Record. \param Record dependency record of a build unit. \return list of file names. */ /*! \fn CDependencyInfo::Platform(void) \brief Platform/OS type, generally used for creating compatible file paths. \return reference to CDependencyInfo::m_Platform. */ /*! \fn CDependencyInfo::Clear(void) \brief Resets the unit dependency database to the initial state. */ /*! \fn CDependencyInfo::Show(void) \brief Print dependency information for all of build units to the standard output. */ /*! \fn CDependencyInfo::OneLineReport(const size_t Index, const bool Deps, const bool XRefs) \brief Returns a short string representation of dependency information. \param Index number a dependency record. \param Deps enables output of dependencies. \param XRefs enables output of cross references. \return string representation of dependency information. */ /*! \fn CDependencyInfo::RecordsCount(void) const \brief Returns the number of dependency records. \return dependency records count. */ /*! \fn CDependencyInfo::Name(const size_t Index) const \brief Returns name of a build unit with dependency record number \a Index. \param Index number of a dependency record. \return name of the build unit. */ /*! \fn CDependencyInfo::DirectDependenciesCount(const size_t Index) const \brief Counts direct dependencies of a build unit with dependency record number \a Index. \param Index number of a dependency record. \return dependencies count. */ /*! \fn CDependencyInfo::IndirectDependenciesCount(const size_t Index) \brief Counts only indirect dependencies of a build unit with number \a Index. \param Index number of a build unit. \return dependencies count. Indirect dependencies are dependencies of all build units that selected build unit with number \a Index depends on excluding these units. */ /*! \fn CDependencyInfo::AllDependenciesCount(const size_t Index) \brief Returns the total count of dependencies of a build unit with dependency record number \a Index. \param Index number of a dependency record. \return sum of direct and indirect dependencies. */ /*! \fn CDependencyInfo::DirectDependencies(const size_t Index) const \brief Returns a list of build unit names that a build unit with dependency record number \a Index depends on directly. \param Index number of a dependency record. \return list of build unit names. */ /*! \fn CDependencyInfo::IndirectDependencies(const size_t Index) \brief Returns a list of build unit names that a build unit with dependency record number \a Index depends on indirectly. \param Index number of a dependency record. \return list of build unit names. */ /*! \fn CDependencyInfo::AllDependencies(const size_t Index) \brief Returns a complete list of build unit names that a build unit with dependency record number \a Index depends on directly or indirectly. \param Index number of a dependency record. \return list of build unit names. */ /*! \fn CDependencyInfo::DirectCrossReferencesCount(const size_t Index) const \brief Counts direct cross references to a build unit with dependency record number \a Index. \param Index number of a build unit. \return cross references count. */ /*! \fn CDependencyInfo::IndirectCrossReferencesCount(const size_t Index) \brief Counts indirect cross references to a build unit with dependency record number \a Index. \param Index number of a dependency record. \return cross references count. */ /*! \fn CDependencyInfo::AllCrossReferencesCount(const size_t Index) \brief Returns the total count of cross references of a build unit with dependency record number \a Index. \param Index number of a dependency record. \return cross references count. */ /*! \fn CDependencyInfo::DirectCrossReferences(const size_t Index) const \brief Returns a list of build unit names that directly depend on a build unit with dependency record number \a Index. \param Index number of a dependency record. \return list of build unit names. */ /*! \fn CDependencyInfo::IndirectCrossReferences(const size_t Index) \brief Returns a list of build unit names that indirectly depend on a build unit with dependency record number \a Index. \param Index number of a dependency record. \return list of build unit names. */ /*! \fn CDependencyInfo::AllCrossReferences(const size_t Index) \brief Returns a complete list of build unit names that depend on a build unit with dependency record number \a Index either directly or indirectly. \param Index number of a dependency record. \return list of build unit names. */ /*! \fn CDependencyInfo::AreDependenciesComplete(const size_t Index) \brief Verifies if a dependency list for a build unit with dependency record number \a Index is marked as complete. \param Index number of a dependency record. \return \a true if a dependency list is complete, \a false otherwise. */ /*! \fn CDependencyInfo::AreCrossReferencesComplete(const size_t Index) \brief Verifies if a cross reference list for a build unit with dependency record number \a Index is marked as complete. \param Index number of a dependency record. \return \a true if a cross rference list is complete, \a false otherwise. */ /*! \fn CDependencyInfo::SetDependenciesComplete(const size_t Index, const bool State = true) \brief Marks a dependency list for a build unit with dependency record number \a Index as complete. \param Index number of a dependency record. \param State state of completeness. */ /*! \fn CDependencyInfo::SetCrossReferencesComplete(const size_t Index, const bool State = true) \brief Marks a cross reference list for a build unit with number \a Index as complete. \param Index number of a build unit. \param State state of completeness. */ /*! \fn CDependencyInfo::FindRecord(const CString& Name) \brief Performs dependency record lookup by a build unit name. \param Name name of a build unit. \return number (index) of the corresponding dependency record or -1 if no dependency record for the \a Name build unit is found. */ /*! \fn CDependencyInfo::AddRecord(const CString& Name) \brief Adds a new dependency record for the \a Name build unit. \param Name name of a build unit. \return number (index) of the new dependency record. */ /*! \fn CDependencyInfo::AddDependency(const size_t Index, const CString& DependencyName) \brief Adds the \a DependencyName build unit to a dependency record with number \a Index. \param Index number of a dependency record of a build unit. \param DependencyName name of another build unit. \return true, if \a Index is a valid number of a dependency record, \a false otherwise. */ /*! \fn CDependencyInfo::AddDependency(const CString& Name, const CString& DependencyName) \brief Adds the \a DependencyName build unit to a dependency record of the \a Name build unit. \param Name name of a build unit. \param DependencyName name of another build unit. \return number of a dependency record of the \a Name build unit. */ /*! \fn CDependencyInfo::MakeRules(CMakefile& Makefile, const int Section, const bool Multiline) \brief Generates makefile rules for build unit dependencies. \param Makefile a makefile object. \param Section number of makefile section. \param Multiline allows multi-line rules. */ /*! \fn CDependencyInfo::CDependencyInfo(void) \brief Creates build unit dependency database. */ /*! \fn CDependencyInfo::~CDependencyInfo(void) \brief Destroys build unit dependency database. */ /* ! \fn CDependencyInfo:: \brief . \param . \return . */ /*! \class CIncludeSearchFilter \brief Declares interface for gathering build unit dependencies from project files into build unit dependency database. */ /*! \var CIncludeSearchFilter::m_IncludeDirectories \brief a list of directories to look for build units. */ /*! \var CIncludeSearchFilter::m_DefinedMacros \brief a list of preprocessor's macro defnitions. */ /* ! \var CIncludeSearchFilter:: \brief . */ /*! \fn CIncludeSearchFilter::Clear(void) \brief Resets the filter to the initial state. */ /*! \fn CIncludeSearchFilter::Show(void) \brief Prints filter settings to standard output. */ /*! \fn CIncludeSearchFilter::Assign(const CIncludeSearchFilter& Filter) \brief Copies filter settings from another filter. \param Filter another filter. */ /*! \deprecated Use CIncludeSearchFilter::Execute(const CString& FileName, CDependencyInfo& Dependencies). \fn CIncludeSearchFilter::Execute(const CString& FileName, CStringList& Includes) \brief Gathers dependencies to \a Includes string list starting from \a FileName file. \param FileName a build unit name. \param Includes a list of build unit names. \return \a true if dependencies were gather from at least one (starting) file, \a false otherwise. */ /*! \fn CIncludeSearchFilter::Execute(const CString& FileName, CDependencyInfo& Dependencies) \brief Gathers dependencies to \a Dependencies database starting from \a FileName file. \param FileName a build unit name. \param Dependencies a build unit dependency database. \return \a true if dependencies were gather from at least one (starting) file, \a false otherwise. */ /*! \fn CIncludeSearchFilter::AddIncludeDirectory(const CString& Path) \brief Adds \a Path path to the list of unit lookup directories. \param Path a directory path. */ /*! \fn CIncludeSearchFilter::AddIncludeDirectories(const CStringList& Paths) \brief Adds \a Paths list of paths to the list of unit lookup directories. \param Paths a list of directories. */ /*! \fn CIncludeSearchFilter::AddMacroDefiniton(const CString& Macro) \brief Adds \a Macro macro to the list of macros. \param Macro name of a macro definition. */ /*! \fn CIncludeSearchFilter::AddMacroDefinitons(const CStringList& Macros) \brief Adds \a Macros macros to the list of macros. \param Macros a list of names of macro definitions. */ /*! \fn CIncludeSearchFilter::ResolveIncludePath(const CString& IncludeName) \brief Resolves a build unit file name into complete file path. \param IncludeName a build unit file name. \return file path to the build unit if it is successfully found or an empty string if it can't be found. */ /*! \fn CIncludeSearchFilter::CIncludeSearchFilter(void) \brief Creates dependency search filter. */ /*! \fn CIncludeSearchFilter::CIncludeSearchFilter(const CIncludeSearchFilter& Filter) \brief Copies dependency search filter from another filter. \param Filter another dependency search filter. */ /*! \fn CIncludeSearchFilter::~CIncludeSearchFilter(void) \brief Destroys dependency search filter. */ /* ! \fn CIncludeSearchFilter:: \brief . \param . \return . */ /*! \class CCppIncludeSearchFilter \brief Gathers build unit dependencies from C/C++ source files withing project into build unit dependency database. */ /* ! \var CCppIncludeSearchFilter:: \brief . */ /*! \fn CCppIncludeSearchFilter::Assign(const CCppIncludeSearchFilter& Filter) \brief Copies filter settings from another filter. \param Filter another filter. */ /* ! \fn CCppIncludeSearchFilter::Execute(const CString& FileName, CStringList& Includes) \brief . \param . \return . */ /* ! \fn CCppIncludeSearchFilter::Execute(const CString& FileName, CDependencyInfo& Dependencies) \brief . \param . \return . */ /*! \fn CCppIncludeSearchFilter::CCppIncludeSearchFilter(void) \brief Creates dependency search filter. */ /*! \fn CCppIncludeSearchFilter::CCppIncludeSearchFilter(const CCppIncludeSearchFilter& Filter) \brief Copies dependency search filter from another filter. \param Filter another dependency search filter. */ /*! \fn CCppIncludeSearchFilter::~CCppIncludeSearchFilter(void) \brief Destroys dependency search filter. */ /* ! \fn CCppIncludeSearchFilter:: \brief . \param . \return . */ //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/doc/cbbuildcfg.dox0000644000175000017500000001175712155022124020013 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /*! \file cbbuildcfg.h \brief Build configuration. */ /*! \file cbbuildcfg.cpp \brief Build configuration. */ /*! \class CCodeBlocksBuildConfig \brief Build configuration. Contains configurations for platforms (operating systems), build utilities, i.e., toolchains, global compiler variables (installation-specefic options), makefile generation options. */ /*! \var CCodeBlocksBuildConfig::m_Platforms \brief Configuration of a set of platforms. \sa CPlatformSet. */ /*! \var CCodeBlocksBuildConfig::m_ToolChains \brief Configuration of a set of build utilities. \sa CToolChainSet. */ /*! \var CCodeBlocksBuildConfig::m_GlobalVariables \brief Configuration of a set of global variables. \sa CGlobalVariableConfig. */ /*! \var CCodeBlocksBuildConfig::m_FlatObjectNames \brief Controls the way of object file names generation. When \a m_FlatObjectNames is set to \a true, file names of build units are processed depending on CCodeBlocksBuildConfig::m_FlatObjectNames value. */ /*! \var CCodeBlocksBuildConfig::m_FlatObjectPaths \brief Controls the way of object file names generation. When \a m_FlatObjectPaths is set to \a true, file names of build units including file path are processed using FlatFileName(const CString& FileName) function, otherwise, path to build unit is not used for composing path to corresponding object file and all object files will be created in one directory. This option works only if CCodeBlocksBuildConfig::m_FlatObjectNames is set to \a true. */ /*! \var CCodeBlocksBuildConfig::m_MultilineObjects \brief Allows generation of multi-line object file lists. */ /*! \var CCodeBlocksBuildConfig::m_MultilineOptions \brief Allows generation of multi-line option lists. */ /* ! \var CCodeBlocksBuildConfig:: \brief . */ /*! \fn CCodeBlocksBuildConfig::Platforms(void) \brief Returns reference to the set of platforms in build configuration. \return reference to CCodeBlocksBuildConfig::m_Platforms. */ /*! \fn CCodeBlocksBuildConfig::ToolChains(void) \brief Returns reference to the set of toolchains in build configuration. \return reference to CCodeBlocksBuildConfig::m_ToolChains. */ /*! \fn CCodeBlocksBuildConfig::GlobalVariables(void) \brief Returns reference to the set of global variables in build configuration. \return reference to CCodeBlocksBuildConfig::m_GlobalVariables. */ /*! \fn CCodeBlocksBuildConfig::FlatObjectNames(void) \brief Controls the way of object file names generation. \return reference to CCodeBlocksBuildConfig::m_FlatObjectNames. */ /*! \fn CCodeBlocksBuildConfig::FlatObjectPaths(void) \brief Controls the way of object file names generation. \return reference to CCodeBlocksBuildConfig::m_FlatObjectPaths. */ /*! \fn CCodeBlocksBuildConfig::MultilineObjects(void) \brief Allows generation of multi-line object file lists. \return reference to CCodeBlocksBuildConfig::m_MultilineObjects. */ /*! \fn CCodeBlocksBuildConfig::MultilineOptions(void) \brief Allows generation of multi-line option lists. \return reference to CCodeBlocksBuildConfig::m_MultilineOptions. */ /*! \fn CCodeBlocksBuildConfig::Clear(void) \brief Resets the build configuration to the initial state. */ /*! \fn CCodeBlocksBuildConfig::Load(const CString& FileName) \brief Loads a build configuration from a file specified by \a FileName. \param FileName name of build configuration file. \return \a true if configuration was successfully loaded, \a false otherwise. */ /*! \fn CCodeBlocksBuildConfig::Save(const CString& FileName) \brief Saves the build configuration to a file specified by \a FileName. \param FileName name of build configuration file. \return \a true if configuration was successfully saved, \a false otherwise. */ /*! \fn CCodeBlocksBuildConfig::Show(void) \brief Prints build configuration contents to standard output. */ /*! \fn CCodeBlocksBuildConfig::CCodeBlocksBuildConfig(void) \brief Creates build configuration. */ /*! \fn CCodeBlocksBuildConfig::~CCodeBlocksBuildConfig(void) \brief Destroys build configuration. */ /* ! \fn CCodeBlocksBuildConfig:: \brief . \param . \return . */ //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/doc/cbbuildmgr.dox0000644000175000017500000000773512155022124020042 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /*! \file cbbuildmgr.h \brief Build manager for Code::Blocks projects. */ /*! \file cbbuildmgr.cpp \brief Build manager for Code::Blocks projects. */ /*! \class CCodeBlocksBuildManager \brief Build manager for Code::Blocks projects. Manages workspace and project settings and starts makefile generation process. */ /*! \var CCodeBlocksBuildManager::m_Workspace \brief Code::Blocks workspace object. */ /*! \var CCodeBlocksBuildManager::m_Project \brief Code::Blocks project object. */ /*! \var CCodeBlocksBuildManager::m_Config \brief Build configuration. Includes installation-specific parametes such as compilers, toolchains and global variables. */ /*! \var CCodeBlocksBuildManager::m_ProjectLoaded \brief Indicated that a Code::Blocks project was loaded. Build manager CCodeBlocksBuildManager can load both Code::Blocks workspace (.workspace) and Code::Blocks project (.cbp) files. A flag is required to tell if a file is loaded and what kind of file it is. */ /*! \var CCodeBlocksBuildManager::m_WorkspaceLoaded \brief Indicates that a Code::Blocks workspace was loaded. Build manager CCodeBlocksBuildManager can load both Code::Blocks workspace (.workspace) and Code::Blocks project (.cbp) files. A flag is required to tell if a file is loaded and what kind of file it is. */ /* ! \var CCodeBlocksBuildManager:: \brief . */ /*! \fn CCodeBlocksBuildManager::Platforms(void) \brief Returns reference to the set of platforms in build configuration. \return reference to CCodeBlocksBuildManager::m_Platforms. */ /*! \fn CCodeBlocksBuildManager::ToolChains(void) \brief Returns reference to the set of toolchains in build configuration. \return reference to CCodeBlocksBuildManager::m_ToolChains. */ /*! \fn CCodeBlocksBuildManager::Config(void) \brief Returns reference to the build configuration. \return reference to CCodeBlocksBuildManager::m_Config. */ /*! \fn CCodeBlocksBuildManager::Clear(void) \brief Resets build manager to the initial state. */ /*! \fn CCodeBlocksBuildManager::LoadProjectOrWorkspace(const CString& FileName) \brief Loads a workspace or a project file whichever specified by \a FileName. \param FileName a file name of a project or workspace. \return \a true if the project or workspace is successfully loaded, \a false otherwise. */ /*! \fn CCodeBlocksBuildManager::Show(void) \brief Prints project or workspace contents to standard output. */ /*! \fn CCodeBlocksBuildManager::GenerateMakefile(const CString& FileName) \brief Generates makefile text and writes it to the file specified by \a FileName. \param FileName a file name for makefile. Build manager does not generate makefile text by itself, makefile for workspace is generated by CCodeBlocksWorkspace and makefiles for individual projects in a workspace are generated by CCodeBlocksProject. */ /*! \fn CCodeBlocksBuildManager::CCodeBlocksBuildManager(void) \brief Creates build manager. */ /*! \fn CCodeBlocksBuildManager::~CCodeBlocksBuildManager(void) \brief Destroys build manager. */ /* ! \fn CCodeBlocksBuildManager:: \brief . \param . \return . */ //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/cbbuildcfg.h0000644000175000017500000000613212155022124016672 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #ifndef CBBUILDCFG_H #define CBBUILDCFG_H //------------------------------------------------------------------------------ #include "stlstrings.h" #include "platforms.h" #include "toolchains.h" #include "cbglobalvar.h" #include "cbhelper.h" //------------------------------------------------------------------------------ class TiXmlElement; class CCodeBlocksBuildConfig { private: CPlatformSet m_Platforms; CToolChainSet m_ToolChains; CGlobalVariableConfig m_GlobalVariables; CStringList m_Targets; CString m_DefaultOptions; int m_TargetNameCase; int m_MacroVariableCase; int m_QuotePathMode; bool m_NumericToolchainSuffix; bool m_FlatObjectNames; bool m_FlatObjectPaths; bool m_MultilineObjects; bool m_MultilineOptions; bool m_IncludeDependencies; bool m_KeepObjectDirectories; bool m_KeepOutputDirectories; bool m_BeQuiet; bool m_BeVerbose; public: CPlatformSet& Platforms(void) { return m_Platforms; } CToolChainSet& ToolChains(void) { return m_ToolChains; } CGlobalVariableConfig& GlobalVariables(void) { return m_GlobalVariables; } CStringList& Targets(void) { return m_Targets; } CString& DefaultOptions(void) { return m_DefaultOptions; } int& TargetNameCase(void) { return m_TargetNameCase; } int& MacroVariableCase(void) { return m_MacroVariableCase; } int& QuotePathMode(void) { return m_QuotePathMode; } bool& NumericToolchainSuffix(void) { return m_NumericToolchainSuffix; } bool& FlatObjectNames(void) { return m_FlatObjectNames; } bool& FlatObjectPaths(void) { return m_FlatObjectPaths; } bool& MultilineObjects(void) { return m_MultilineObjects; } bool& MultilineOptions(void) { return m_MultilineOptions; } bool& IncludeDependencies(void) { return m_IncludeDependencies; } bool& KeepObjectDirectories(void) { return m_KeepObjectDirectories; } bool& KeepOutputDirectories(void) { return m_KeepOutputDirectories; } bool& BeQuiet(void) { return m_BeQuiet; } bool& BeVerbose(void) { return m_BeVerbose; } public: void Clear(void); bool Load(const CString& FileName); bool Save(const CString& FileName); void Show(void); public: CCodeBlocksBuildConfig(void); ~CCodeBlocksBuildConfig(void); }; #endif //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/revision.h0000644000175000017500000000011412155023206016440 0ustar moellermoeller#ifndef REVISION_H #define REVISION_H #define REVISION_NUMBER 147 #endif cbp2make-147+dfsg/src/cbbuildcfg.cpp0000644000175000017500000001012312155022124017220 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #include //------------------------------------------------------------------------------ #include "cbbuildcfg.h" #include "stlconvert.h" #include "tinyxml.h" //------------------------------------------------------------------------------ CCodeBlocksBuildConfig::CCodeBlocksBuildConfig(void) { Clear(); } CCodeBlocksBuildConfig::~CCodeBlocksBuildConfig(void) { Clear(); } void CCodeBlocksBuildConfig::Clear(void) { m_Platforms.Clear(); m_ToolChains.Clear(); m_GlobalVariables.Clear(); m_DefaultOptions.Clear(); m_Targets.Clear(); m_TargetNameCase = CASE_KEEP; m_MacroVariableCase = CASE_KEEP; m_QuotePathMode = QUOTE_AUTO; m_NumericToolchainSuffix = true; m_FlatObjectNames = false; m_FlatObjectPaths = false; m_MultilineObjects = false; m_MultilineOptions = false; m_IncludeDependencies = false; m_KeepObjectDirectories = false; m_KeepOutputDirectories = false; m_BeQuiet = false; m_BeVerbose = false; } bool CCodeBlocksBuildConfig::Load(const CString& FileName) { Clear(); m_ToolChains.AddDefault(); m_GlobalVariables.AddDefault(); // TiXmlDocument cfg; if (!cfg.LoadFile(FileName.GetCString())) return false; const TiXmlElement *root = cfg.RootElement(); if (0==strcmp(root->Value(),"cbp2make")) { const TiXmlNode *_platforms = root->FirstChild("platforms"); if (0!=_platforms) { const TiXmlElement *platforms = _platforms->ToElement(); if (0!=platforms) { m_Platforms.Read(platforms); } } const TiXmlNode *_toolchains = root->FirstChild("toolchains"); if (0!=_toolchains) { const TiXmlElement *toolchains = _toolchains->ToElement(); if (0!=toolchains) { m_ToolChains.Read(toolchains); } } const TiXmlNode *_globvars = root->FirstChild("globalvariables"); if (0!=_globvars) { const TiXmlElement *globvars = _globvars->ToElement(); if (0!=globvars) { m_GlobalVariables.Read(globvars); } } const TiXmlNode *_options = root->FirstChild("options"); if (0!=_options) { const TiXmlElement *options = _options->ToElement(); if (0!=options) { char *value = 0; if ((value = (char *)options->Attribute("default"))) { m_DefaultOptions = value; } } } } return true; } bool CCodeBlocksBuildConfig::Save(const CString& FileName) { m_ToolChains.AddDefault(); m_GlobalVariables.AddDefault(); // TiXmlDocument cfg; TiXmlDeclaration *xmld = new TiXmlDeclaration("1.0", "", ""); cfg.LinkEndChild(xmld); TiXmlElement *root = new TiXmlElement("cbp2make"); cfg.LinkEndChild(root); TiXmlElement *platforms = new TiXmlElement("platforms"); root->LinkEndChild(platforms); m_Platforms.Write(platforms); TiXmlElement *toolchains = new TiXmlElement("toolchains"); root->LinkEndChild(toolchains); m_ToolChains.Write(toolchains); TiXmlElement *globvars = new TiXmlElement("globalvariables"); root->LinkEndChild(globvars); m_GlobalVariables.Write(globvars); TiXmlElement *options = new TiXmlElement("options"); root->LinkEndChild(options); options->SetAttribute("default",m_DefaultOptions.GetCString()); return cfg.SaveFile(FileName.GetCString()); } void CCodeBlocksBuildConfig::Show(void) { m_Platforms.Show(); m_ToolChains.Show(); m_GlobalVariables.Show(); } //------------------------------------------------------------------------------ cbp2make-147+dfsg/src/makefile.cpp0000644000175000017500000002204712155022124016721 0ustar moellermoeller/* cbp2make : Makefile generation tool for the Code::Blocks IDE Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //------------------------------------------------------------------------------ #include //------------------------------------------------------------------------------ #include "tinyxml.h" #include "stlconvert.h" #include "cbhelper.h" #include "makefile.h" //------------------------------------------------------------------------------ CMakefileVariable::CMakefileVariable(void) { Clear(); } CMakefileVariable::~CMakefileVariable(void) { Clear(); } CString CMakefileVariable::GetValue(const int Index) { return m_Values.GetString(Index); } void CMakefileVariable::SetValue(const CString& NewValue, const int Index) { while (Index >= m_Values.GetCount()) { m_Values.Insert(""); } m_Values[Index] = NewValue; } CString CMakefileVariable::JoinValues(void) { if (m_Multiline) return m_Values.Join(" \\\n\t"); else return m_Values.Join(" "); } void CMakefileVariable::AddValue(const CString& NewValue) { m_Values.Insert(NewValue); } void CMakefileVariable::Clear(void) { m_Name.Clear(); m_Values.Clear(); m_Multiline = false; } void CMakefileVariable::Show(void) { std::cout<<"Variable: "<& CMakefileSection::Macros(void) { return m_Macros; } std::vector& CMakefileSection::EnvVars(void) { return m_EnvVars; } CMakefileVariable *CMakefileSection::FindMacro(const CString& Name) { for (size_t i = 0; i < m_Macros.size(); i++) { CMakefileVariable *v = m_Macros[i]; if (Name == v->Name()) return v; } return 0; } CMakefileVariable *CMakefileSection::FindEnvVar(const CString& Name) { for (size_t i = 0; i < m_EnvVars.size(); i++) { CMakefileVariable *v = m_EnvVars[i]; if (Name == v->Name()) return v; } return 0; } CMakefileVariable& CMakefileSection::AddMacro(const CString& Name, const CString& Value) { if (!Name.IsEmpty())//if (!Value.IsEmpty()) { CMakefileVariable *v = FindMacro(Name); if (0==v) { v = new CMakefileVariable; m_Macros.push_back(v); } v->Name() = Name; v->SetValue(Value); return *v; } return m_NullVariable; } CMakefileVariable& CMakefileSection::AddEnvVar(const CString& Name, const CString& Value) { if (!Name.IsEmpty())//if (!Value.IsEmpty()) { CMakefileVariable *v = FindEnvVar(Name); if (0==v) { v = new CMakefileVariable; m_EnvVars.push_back(v); } v->Name() = Name; v->SetValue(Value); return *v; } return m_NullVariable; } size_t CMakefileSection::RulesCount(void) const { return m_Rules.size(); } CMakefileRule& CMakefileSection::GetRule(const size_t Index) { if ((Index>=0) && (IndexTarget() == TargetName) { return *r; } } r = new CMakefileRule(); r->Target() = TargetName; m_Rules.push_back(r); return *r; } //------------------------------------------------------------------------------ CMakefile::CMakefile(void) { Clear(); m_Sections.push_back(new CMakefileSection); } CMakefile::~CMakefile(void) { Clear(); } void CMakefile::Clear(void) { for (size_t i = 0; i < m_Sections.size(); i++) delete m_Sections[i]; m_Sections.clear(); m_Text.Clear(); } void CMakefile::Show(void) { //m_Header.Print(std::cout); } size_t CMakefile::SectionCount(void) const { return m_Sections.size(); } CMakefileSection& CMakefile::GetSection(const size_t Section) { while (Section >= m_Sections.size()) { AddSection(); } return *m_Sections[Section]; /* if (m_Sections.size() > 0) { if (Section < m_Sections.size()) { return *m_Sections[Section]; } return *m_Sections[0]; } else { return AddSection(); } */ } CStringList& CMakefile::Header(const size_t Section) { return GetSection(Section).Header(); } CMakefileSection& CMakefile::AddSection(size_t *Section) { CMakefileSection *section = new CMakefileSection; m_Sections.push_back(section); if (0!=Section) *Section = m_Sections.size()-1; return *section; } CMakefileVariable& CMakefile::AddMacro(const CString& Name, const CString& Value, const size_t Section) { return GetSection(Section).AddMacro(Name,Value); } CMakefileVariable& CMakefile::AddEnvVar(const CString& Name, const CString& Value, const size_t Section) { return GetSection(Section).AddEnvVar(Name,Value); } size_t CMakefile::RulesCount(const size_t Section) { return GetSection(Section).RulesCount(); } CMakefileRule& CMakefile::GetRule(const size_t Index, const size_t Section) { return GetSection(Section).GetRule(Index); } CMakefileRule& CMakefile::AddRule(const CString& TargetName, const size_t Section) { return GetSection(Section).AddRule(TargetName); } CStringList& CMakefile::GetText(void) { return m_Text; } CStringList& CMakefile::Update(void) { CStringList phony_targets; // m_Text.Clear(); for (size_t i = 0; i < m_Sections.size(); i++) { CMakefileSection& section = *m_Sections[i]; // add header if (section.Header().GetLength() > 0) { m_Text.Insert(section.Header()).Insert(""); } // add macro variables std::vector& macros = section.Macros(); for (size_t j = 0; j < macros.size(); j++) { CMakefileVariable& v = *macros[j]; v.Values().RemoveEmpty(); m_Text.Insert(v.Name()+" = "+v.JoinValues()); } if (macros.size() > 0) { m_Text.Insert(""); } // add environment variables std::vector& env_vars = section.EnvVars(); for (size_t j = 0; j < env_vars.size(); j++) { CMakefileVariable& v = *env_vars[j]; v.Values().RemoveEmpty(); m_Text.Insert(v.Name()+" = "+v.JoinValues()); } if (env_vars.size() > 0) { m_Text.Insert(""); } // add rules for (size_t j = 0; j < section.RulesCount(); j++) { CMakefileRule& r = section.GetRule(j); m_Text.Insert(r.Target()+": "+r.JoinDependencies()); for (int k = 0; k < r.Commands().GetCount(); k++) { m_Text.Insert("\t"+r.Commands().GetString(k)); } m_Text.Insert(""); if (0 == r.Dependencies().GetCount()) { phony_targets.Insert(r.Target()); } } } // add phony targets m_Text.Insert(".PHONY: "+phony_targets.Join(" ")); m_Text.Insert(""); // return GetText(); } //------------------------------------------------------------------------------ cbp2make-147+dfsg/usage.txt0000644000175000017500000000555512143137414015531 0ustar moellermoellerUsage syntax: Generate makefile: cbp2make -in [-cfg ] [-out ] [-unix] [-windows] [-mac] [--all-os] [-targets "[,[, ...]]"] [--flat-objects] [--flat-objpath] [--wrap-objects] [--wrap-options] [--with-deps] [--keep-objdir] [--keep-outdir] [--target-case keep|lower|upper] [--macros-case keep|lower|upper] [--quote-path auto|never|always] cbp2make -list -in [-cfg ] [-unix] [-windows] [-mac] [--all-os] [-targets "[,[, ...]]"] [--flat-objects] [--flat-objpath] [--wrap-objects] [--wrap-options] [--with-deps] [--keep-objdir] [--keep-outdir] [--target-case keep|lower|upper] [--macros-case keep|lower|upper] [--quote-path auto|never|always] Manage toolchains: cbp2make --config toolchain --add [-unix|-windows|-mac] -chain cbp2make --config toolchain --remove [-unix|-windows|-mac] -chain Manage build tools: cbp2make --config tool --add [-unix|-windows|-mac] -chain -tool -type cbp2make --config tool --remove [-unix|-windows|-mac] -chain -tool Tool types: pp=preprocessor as=assembler cc=compiler rc=resource compiler sl=static linker dl=dynamic linker el=executable linker nl=native linker Tool options (common): -desc -program -command -mkv -srcext -outext -quotepath -fullpath -unixpath Tool options (compiler): -incsw -defsw -deps Tool options (linker): -ldsw -llsw -lpfx -lext -objext -lflat Manage platforms: cbp2make --config platform [-unix|-windows|-mac] [-pwd ] [-cd ] [-rm ] [-rmf ] [-rmd ] [-cp ] [-mv ] [-md ] [-mdf ] [-make ] Manage global compiler variables: cbp2make --config variable --add [-set ] -name [-desc ] [-field ] -value cbp2make --config variable --remove [-set ] [-name ] [-field ] Manage options: cbp2make --config options --default-options "" cbp2make --config show Common options: cbp2make --local // use configuration from current directory cbp2make --global // use configuration from home directory cbp2make --verbose // show project information cbp2make --quiet // hide all messages cbp2make --help // display this message cbp2make --version // display version information cbp2make-147+dfsg/cbp2make.cbp.mak.windows0000644000175000017500000005367412143777603020315 0ustar moellermoeller#------------------------------------------------------------------------------# # This makefile was generated by 'cbp2make' tool rev.138 # #------------------------------------------------------------------------------# WORKDIR = %cd% CC = gcc.exe CXX = g++.exe AR = ar.exe LD = g++.exe WINDRES = windres.exe INC = -Ilib -Ilib\\tinyxml -Isrc CFLAGS = -Wall -fexceptions -fno-strict-aliasing -Wno-write-strings RESINC = LIBDIR = LIB = LDFLAGS = INC_DEBUG = $(INC) CFLAGS_DEBUG = $(CFLAGS) -g RESINC_DEBUG = $(RESINC) RCFLAGS_DEBUG = $(RCFLAGS) LIBDIR_DEBUG = $(LIBDIR) LIB_DEBUG = $(LIB) LDFLAGS_DEBUG = $(LDFLAGS) OBJDIR_DEBUG = obj\\Debug DEP_DEBUG = OUT_DEBUG = bin\\Debug\\cbp2make.exe INC_RELEASE = $(INC) CFLAGS_RELEASE = $(CFLAGS) -O2 RESINC_RELEASE = $(RESINC) RCFLAGS_RELEASE = $(RCFLAGS) LIBDIR_RELEASE = $(LIBDIR) LIB_RELEASE = $(LIB) LDFLAGS_RELEASE = $(LDFLAGS) -s OBJDIR_RELEASE = obj\\Release DEP_RELEASE = OUT_RELEASE = bin\\Release\\cbp2make.exe INC_DOXYGEN = $(INC) CFLAGS_DOXYGEN = $(CFLAGS) RESINC_DOXYGEN = $(RESINC) RCFLAGS_DOXYGEN = $(RCFLAGS) LIBDIR_DOXYGEN = $(LIBDIR) LIB_DOXYGEN = $(LIB) LDFLAGS_DOXYGEN = $(LDFLAGS) OBJDIR_DOXYGEN = .objs DEP_DOXYGEN = INC_PROFILE = $(INC) CFLAGS_PROFILE = $(CFLAGS) -pg -g RESINC_PROFILE = $(RESINC) RCFLAGS_PROFILE = $(RCFLAGS) LIBDIR_PROFILE = $(LIBDIR) LIB_PROFILE = $(LIB) LDFLAGS_PROFILE = $(LDFLAGS) -pg OBJDIR_PROFILE = obj\\Profile DEP_PROFILE = OUT_PROFILE = bin\\Profile\\cbp2make.exe OBJ_DEBUG = $(OBJDIR_DEBUG)\\src\\cbp2make.o \ $(OBJDIR_DEBUG)\\src\\cbproject.o \ $(OBJDIR_DEBUG)\\src\\cbptarget.o \ $(OBJDIR_DEBUG)\\src\\cbpunit.o \ $(OBJDIR_DEBUG)\\src\\cbworkspace.o \ $(OBJDIR_DEBUG)\\src\\depsearch.o \ $(OBJDIR_DEBUG)\\src\\cbhelper.o \ $(OBJDIR_DEBUG)\\src\\makefile.o \ $(OBJDIR_DEBUG)\\src\\platforms.o \ $(OBJDIR_DEBUG)\\src\\toolchains.o \ $(OBJDIR_DEBUG)\\lib\\stlconfig.o \ $(OBJDIR_DEBUG)\\lib\\stlconvert.o \ $(OBJDIR_DEBUG)\\lib\\stlfutils.o \ $(OBJDIR_DEBUG)\\lib\\stlgpm.o \ $(OBJDIR_DEBUG)\\lib\\stlstrings.o \ $(OBJDIR_DEBUG)\\lib\\stlvariables.o \ $(OBJDIR_DEBUG)\\lib\\stringhash.o \ $(OBJDIR_DEBUG)\\lib\\tinyxml\\tinystr.o \ $(OBJDIR_DEBUG)\\lib\\tinyxml\\tinyxml.o \ $(OBJDIR_DEBUG)\\lib\\tinyxml\\tinyxmlerror.o \ $(OBJDIR_DEBUG)\\lib\\tinyxml\\tinyxmlparser.o \ $(OBJDIR_DEBUG)\\src\\buildtools.o \ $(OBJDIR_DEBUG)\\src\\cbbuildcfg.o \ $(OBJDIR_DEBUG)\\src\\cbbuildmgr.o \ $(OBJDIR_DEBUG)\\src\\cbglobalvar.o OBJ_RELEASE = $(OBJDIR_RELEASE)\\src\\cbp2make.o \ $(OBJDIR_RELEASE)\\src\\cbproject.o \ $(OBJDIR_RELEASE)\\src\\cbptarget.o \ $(OBJDIR_RELEASE)\\src\\cbpunit.o \ $(OBJDIR_RELEASE)\\src\\cbworkspace.o \ $(OBJDIR_RELEASE)\\src\\depsearch.o \ $(OBJDIR_RELEASE)\\src\\cbhelper.o \ $(OBJDIR_RELEASE)\\src\\makefile.o \ $(OBJDIR_RELEASE)\\src\\platforms.o \ $(OBJDIR_RELEASE)\\src\\toolchains.o \ $(OBJDIR_RELEASE)\\lib\\stlconfig.o \ $(OBJDIR_RELEASE)\\lib\\stlconvert.o \ $(OBJDIR_RELEASE)\\lib\\stlfutils.o \ $(OBJDIR_RELEASE)\\lib\\stlgpm.o \ $(OBJDIR_RELEASE)\\lib\\stlstrings.o \ $(OBJDIR_RELEASE)\\lib\\stlvariables.o \ $(OBJDIR_RELEASE)\\lib\\stringhash.o \ $(OBJDIR_RELEASE)\\lib\\tinyxml\\tinystr.o \ $(OBJDIR_RELEASE)\\lib\\tinyxml\\tinyxml.o \ $(OBJDIR_RELEASE)\\lib\\tinyxml\\tinyxmlerror.o \ $(OBJDIR_RELEASE)\\lib\\tinyxml\\tinyxmlparser.o \ $(OBJDIR_RELEASE)\\src\\buildtools.o \ $(OBJDIR_RELEASE)\\src\\cbbuildcfg.o \ $(OBJDIR_RELEASE)\\src\\cbbuildmgr.o \ $(OBJDIR_RELEASE)\\src\\cbglobalvar.o OBJ_PROFILE = $(OBJDIR_PROFILE)\\src\\cbp2make.o \ $(OBJDIR_PROFILE)\\src\\cbproject.o \ $(OBJDIR_PROFILE)\\src\\cbptarget.o \ $(OBJDIR_PROFILE)\\src\\cbpunit.o \ $(OBJDIR_PROFILE)\\src\\cbworkspace.o \ $(OBJDIR_PROFILE)\\src\\depsearch.o \ $(OBJDIR_PROFILE)\\src\\cbhelper.o \ $(OBJDIR_PROFILE)\\src\\makefile.o \ $(OBJDIR_PROFILE)\\src\\platforms.o \ $(OBJDIR_PROFILE)\\src\\toolchains.o \ $(OBJDIR_PROFILE)\\lib\\stlconfig.o \ $(OBJDIR_PROFILE)\\lib\\stlconvert.o \ $(OBJDIR_PROFILE)\\lib\\stlfutils.o \ $(OBJDIR_PROFILE)\\lib\\stlgpm.o \ $(OBJDIR_PROFILE)\\lib\\stlstrings.o \ $(OBJDIR_PROFILE)\\lib\\stlvariables.o \ $(OBJDIR_PROFILE)\\lib\\stringhash.o \ $(OBJDIR_PROFILE)\\lib\\tinyxml\\tinystr.o \ $(OBJDIR_PROFILE)\\lib\\tinyxml\\tinyxml.o \ $(OBJDIR_PROFILE)\\lib\\tinyxml\\tinyxmlerror.o \ $(OBJDIR_PROFILE)\\lib\\tinyxml\\tinyxmlparser.o \ $(OBJDIR_PROFILE)\\src\\buildtools.o \ $(OBJDIR_PROFILE)\\src\\cbbuildcfg.o \ $(OBJDIR_PROFILE)\\src\\cbbuildmgr.o \ $(OBJDIR_PROFILE)\\src\\cbglobalvar.o all: debug release doxygen profile clean: clean_debug clean_release clean_profile before_debug: cmd /c if not exist bin\\Debug md bin\\Debug cmd /c if not exist $(OBJDIR_DEBUG)\\src md $(OBJDIR_DEBUG)\\src cmd /c if not exist $(OBJDIR_DEBUG)\\lib md $(OBJDIR_DEBUG)\\lib cmd /c if not exist $(OBJDIR_DEBUG)\\lib\\tinyxml md $(OBJDIR_DEBUG)\\lib\\tinyxml after_debug: debug: before_debug out_debug after_debug out_debug: before_debug $(OBJ_DEBUG) $(DEP_DEBUG) $(LD) $(LDFLAGS_DEBUG) $(LIBDIR_DEBUG) $(OBJ_DEBUG) $(LIB_DEBUG) -o $(OUT_DEBUG) $(OBJDIR_DEBUG)\\src\\cbp2make.o: src\\cbp2make.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src\\cbp2make.cpp -o $(OBJDIR_DEBUG)\\src\\cbp2make.o $(OBJDIR_DEBUG)\\src\\cbproject.o: src\\cbproject.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src\\cbproject.cpp -o $(OBJDIR_DEBUG)\\src\\cbproject.o $(OBJDIR_DEBUG)\\src\\cbptarget.o: src\\cbptarget.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src\\cbptarget.cpp -o $(OBJDIR_DEBUG)\\src\\cbptarget.o $(OBJDIR_DEBUG)\\src\\cbpunit.o: src\\cbpunit.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src\\cbpunit.cpp -o $(OBJDIR_DEBUG)\\src\\cbpunit.o $(OBJDIR_DEBUG)\\src\\cbworkspace.o: src\\cbworkspace.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src\\cbworkspace.cpp -o $(OBJDIR_DEBUG)\\src\\cbworkspace.o $(OBJDIR_DEBUG)\\src\\depsearch.o: src\\depsearch.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src\\depsearch.cpp -o $(OBJDIR_DEBUG)\\src\\depsearch.o $(OBJDIR_DEBUG)\\src\\cbhelper.o: src\\cbhelper.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src\\cbhelper.cpp -o $(OBJDIR_DEBUG)\\src\\cbhelper.o $(OBJDIR_DEBUG)\\src\\makefile.o: src\\makefile.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src\\makefile.cpp -o $(OBJDIR_DEBUG)\\src\\makefile.o $(OBJDIR_DEBUG)\\src\\platforms.o: src\\platforms.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src\\platforms.cpp -o $(OBJDIR_DEBUG)\\src\\platforms.o $(OBJDIR_DEBUG)\\src\\toolchains.o: src\\toolchains.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src\\toolchains.cpp -o $(OBJDIR_DEBUG)\\src\\toolchains.o $(OBJDIR_DEBUG)\\lib\\stlconfig.o: lib\\stlconfig.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib\\stlconfig.cpp -o $(OBJDIR_DEBUG)\\lib\\stlconfig.o $(OBJDIR_DEBUG)\\lib\\stlconvert.o: lib\\stlconvert.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib\\stlconvert.cpp -o $(OBJDIR_DEBUG)\\lib\\stlconvert.o $(OBJDIR_DEBUG)\\lib\\stlfutils.o: lib\\stlfutils.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib\\stlfutils.cpp -o $(OBJDIR_DEBUG)\\lib\\stlfutils.o $(OBJDIR_DEBUG)\\lib\\stlgpm.o: lib\\stlgpm.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib\\stlgpm.cpp -o $(OBJDIR_DEBUG)\\lib\\stlgpm.o $(OBJDIR_DEBUG)\\lib\\stlstrings.o: lib\\stlstrings.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib\\stlstrings.cpp -o $(OBJDIR_DEBUG)\\lib\\stlstrings.o $(OBJDIR_DEBUG)\\lib\\stlvariables.o: lib\\stlvariables.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib\\stlvariables.cpp -o $(OBJDIR_DEBUG)\\lib\\stlvariables.o $(OBJDIR_DEBUG)\\lib\\stringhash.o: lib\\stringhash.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib\\stringhash.cpp -o $(OBJDIR_DEBUG)\\lib\\stringhash.o $(OBJDIR_DEBUG)\\lib\\tinyxml\\tinystr.o: lib\\tinyxml\\tinystr.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib\\tinyxml\\tinystr.cpp -o $(OBJDIR_DEBUG)\\lib\\tinyxml\\tinystr.o $(OBJDIR_DEBUG)\\lib\\tinyxml\\tinyxml.o: lib\\tinyxml\\tinyxml.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib\\tinyxml\\tinyxml.cpp -o $(OBJDIR_DEBUG)\\lib\\tinyxml\\tinyxml.o $(OBJDIR_DEBUG)\\lib\\tinyxml\\tinyxmlerror.o: lib\\tinyxml\\tinyxmlerror.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib\\tinyxml\\tinyxmlerror.cpp -o $(OBJDIR_DEBUG)\\lib\\tinyxml\\tinyxmlerror.o $(OBJDIR_DEBUG)\\lib\\tinyxml\\tinyxmlparser.o: lib\\tinyxml\\tinyxmlparser.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c lib\\tinyxml\\tinyxmlparser.cpp -o $(OBJDIR_DEBUG)\\lib\\tinyxml\\tinyxmlparser.o $(OBJDIR_DEBUG)\\src\\buildtools.o: src\\buildtools.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src\\buildtools.cpp -o $(OBJDIR_DEBUG)\\src\\buildtools.o $(OBJDIR_DEBUG)\\src\\cbbuildcfg.o: src\\cbbuildcfg.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src\\cbbuildcfg.cpp -o $(OBJDIR_DEBUG)\\src\\cbbuildcfg.o $(OBJDIR_DEBUG)\\src\\cbbuildmgr.o: src\\cbbuildmgr.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src\\cbbuildmgr.cpp -o $(OBJDIR_DEBUG)\\src\\cbbuildmgr.o $(OBJDIR_DEBUG)\\src\\cbglobalvar.o: src\\cbglobalvar.cpp $(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src\\cbglobalvar.cpp -o $(OBJDIR_DEBUG)\\src\\cbglobalvar.o clean_debug: cmd /c del /f $(OBJ_DEBUG) $(OUT_DEBUG) cmd /c rd bin\\Debug cmd /c rd $(OBJDIR_DEBUG)\\src cmd /c rd $(OBJDIR_DEBUG)\\lib cmd /c rd $(OBJDIR_DEBUG)\\lib\\tinyxml before_release: cmd /c if not exist bin\\Release md bin\\Release cmd /c if not exist $(OBJDIR_RELEASE)\\src md $(OBJDIR_RELEASE)\\src cmd /c if not exist $(OBJDIR_RELEASE)\\lib md $(OBJDIR_RELEASE)\\lib cmd /c if not exist $(OBJDIR_RELEASE)\\lib\\tinyxml md $(OBJDIR_RELEASE)\\lib\\tinyxml after_release: release: before_release out_release after_release out_release: before_release $(OBJ_RELEASE) $(DEP_RELEASE) $(LD) $(LDFLAGS_RELEASE) $(LIBDIR_RELEASE) $(OBJ_RELEASE) $(LIB_RELEASE) -o $(OUT_RELEASE) $(OBJDIR_RELEASE)\\src\\cbp2make.o: src\\cbp2make.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src\\cbp2make.cpp -o $(OBJDIR_RELEASE)\\src\\cbp2make.o $(OBJDIR_RELEASE)\\src\\cbproject.o: src\\cbproject.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src\\cbproject.cpp -o $(OBJDIR_RELEASE)\\src\\cbproject.o $(OBJDIR_RELEASE)\\src\\cbptarget.o: src\\cbptarget.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src\\cbptarget.cpp -o $(OBJDIR_RELEASE)\\src\\cbptarget.o $(OBJDIR_RELEASE)\\src\\cbpunit.o: src\\cbpunit.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src\\cbpunit.cpp -o $(OBJDIR_RELEASE)\\src\\cbpunit.o $(OBJDIR_RELEASE)\\src\\cbworkspace.o: src\\cbworkspace.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src\\cbworkspace.cpp -o $(OBJDIR_RELEASE)\\src\\cbworkspace.o $(OBJDIR_RELEASE)\\src\\depsearch.o: src\\depsearch.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src\\depsearch.cpp -o $(OBJDIR_RELEASE)\\src\\depsearch.o $(OBJDIR_RELEASE)\\src\\cbhelper.o: src\\cbhelper.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src\\cbhelper.cpp -o $(OBJDIR_RELEASE)\\src\\cbhelper.o $(OBJDIR_RELEASE)\\src\\makefile.o: src\\makefile.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src\\makefile.cpp -o $(OBJDIR_RELEASE)\\src\\makefile.o $(OBJDIR_RELEASE)\\src\\platforms.o: src\\platforms.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src\\platforms.cpp -o $(OBJDIR_RELEASE)\\src\\platforms.o $(OBJDIR_RELEASE)\\src\\toolchains.o: src\\toolchains.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src\\toolchains.cpp -o $(OBJDIR_RELEASE)\\src\\toolchains.o $(OBJDIR_RELEASE)\\lib\\stlconfig.o: lib\\stlconfig.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib\\stlconfig.cpp -o $(OBJDIR_RELEASE)\\lib\\stlconfig.o $(OBJDIR_RELEASE)\\lib\\stlconvert.o: lib\\stlconvert.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib\\stlconvert.cpp -o $(OBJDIR_RELEASE)\\lib\\stlconvert.o $(OBJDIR_RELEASE)\\lib\\stlfutils.o: lib\\stlfutils.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib\\stlfutils.cpp -o $(OBJDIR_RELEASE)\\lib\\stlfutils.o $(OBJDIR_RELEASE)\\lib\\stlgpm.o: lib\\stlgpm.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib\\stlgpm.cpp -o $(OBJDIR_RELEASE)\\lib\\stlgpm.o $(OBJDIR_RELEASE)\\lib\\stlstrings.o: lib\\stlstrings.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib\\stlstrings.cpp -o $(OBJDIR_RELEASE)\\lib\\stlstrings.o $(OBJDIR_RELEASE)\\lib\\stlvariables.o: lib\\stlvariables.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib\\stlvariables.cpp -o $(OBJDIR_RELEASE)\\lib\\stlvariables.o $(OBJDIR_RELEASE)\\lib\\stringhash.o: lib\\stringhash.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib\\stringhash.cpp -o $(OBJDIR_RELEASE)\\lib\\stringhash.o $(OBJDIR_RELEASE)\\lib\\tinyxml\\tinystr.o: lib\\tinyxml\\tinystr.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib\\tinyxml\\tinystr.cpp -o $(OBJDIR_RELEASE)\\lib\\tinyxml\\tinystr.o $(OBJDIR_RELEASE)\\lib\\tinyxml\\tinyxml.o: lib\\tinyxml\\tinyxml.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib\\tinyxml\\tinyxml.cpp -o $(OBJDIR_RELEASE)\\lib\\tinyxml\\tinyxml.o $(OBJDIR_RELEASE)\\lib\\tinyxml\\tinyxmlerror.o: lib\\tinyxml\\tinyxmlerror.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib\\tinyxml\\tinyxmlerror.cpp -o $(OBJDIR_RELEASE)\\lib\\tinyxml\\tinyxmlerror.o $(OBJDIR_RELEASE)\\lib\\tinyxml\\tinyxmlparser.o: lib\\tinyxml\\tinyxmlparser.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c lib\\tinyxml\\tinyxmlparser.cpp -o $(OBJDIR_RELEASE)\\lib\\tinyxml\\tinyxmlparser.o $(OBJDIR_RELEASE)\\src\\buildtools.o: src\\buildtools.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src\\buildtools.cpp -o $(OBJDIR_RELEASE)\\src\\buildtools.o $(OBJDIR_RELEASE)\\src\\cbbuildcfg.o: src\\cbbuildcfg.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src\\cbbuildcfg.cpp -o $(OBJDIR_RELEASE)\\src\\cbbuildcfg.o $(OBJDIR_RELEASE)\\src\\cbbuildmgr.o: src\\cbbuildmgr.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src\\cbbuildmgr.cpp -o $(OBJDIR_RELEASE)\\src\\cbbuildmgr.o $(OBJDIR_RELEASE)\\src\\cbglobalvar.o: src\\cbglobalvar.cpp $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src\\cbglobalvar.cpp -o $(OBJDIR_RELEASE)\\src\\cbglobalvar.o clean_release: cmd /c del /f $(OBJ_RELEASE) $(OUT_RELEASE) cmd /c rd bin\\Release cmd /c rd $(OBJDIR_RELEASE)\\src cmd /c rd $(OBJDIR_RELEASE)\\lib cmd /c rd $(OBJDIR_RELEASE)\\lib\\tinyxml before_doxygen: doxygen Doxyfile after_doxygen: doxygen: before_doxygen after_doxygen before_profile: cmd /c if not exist bin\\Profile md bin\\Profile cmd /c if not exist $(OBJDIR_PROFILE)\\src md $(OBJDIR_PROFILE)\\src cmd /c if not exist $(OBJDIR_PROFILE)\\lib md $(OBJDIR_PROFILE)\\lib cmd /c if not exist $(OBJDIR_PROFILE)\\lib\\tinyxml md $(OBJDIR_PROFILE)\\lib\\tinyxml after_profile: profile: before_profile out_profile after_profile out_profile: before_profile $(OBJ_PROFILE) $(DEP_PROFILE) $(LD) $(LDFLAGS_PROFILE) $(LIBDIR_PROFILE) $(OBJ_PROFILE) $(LIB_PROFILE) -o $(OUT_PROFILE) $(OBJDIR_PROFILE)\\src\\cbp2make.o: src\\cbp2make.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src\\cbp2make.cpp -o $(OBJDIR_PROFILE)\\src\\cbp2make.o $(OBJDIR_PROFILE)\\src\\cbproject.o: src\\cbproject.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src\\cbproject.cpp -o $(OBJDIR_PROFILE)\\src\\cbproject.o $(OBJDIR_PROFILE)\\src\\cbptarget.o: src\\cbptarget.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src\\cbptarget.cpp -o $(OBJDIR_PROFILE)\\src\\cbptarget.o $(OBJDIR_PROFILE)\\src\\cbpunit.o: src\\cbpunit.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src\\cbpunit.cpp -o $(OBJDIR_PROFILE)\\src\\cbpunit.o $(OBJDIR_PROFILE)\\src\\cbworkspace.o: src\\cbworkspace.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src\\cbworkspace.cpp -o $(OBJDIR_PROFILE)\\src\\cbworkspace.o $(OBJDIR_PROFILE)\\src\\depsearch.o: src\\depsearch.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src\\depsearch.cpp -o $(OBJDIR_PROFILE)\\src\\depsearch.o $(OBJDIR_PROFILE)\\src\\cbhelper.o: src\\cbhelper.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src\\cbhelper.cpp -o $(OBJDIR_PROFILE)\\src\\cbhelper.o $(OBJDIR_PROFILE)\\src\\makefile.o: src\\makefile.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src\\makefile.cpp -o $(OBJDIR_PROFILE)\\src\\makefile.o $(OBJDIR_PROFILE)\\src\\platforms.o: src\\platforms.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src\\platforms.cpp -o $(OBJDIR_PROFILE)\\src\\platforms.o $(OBJDIR_PROFILE)\\src\\toolchains.o: src\\toolchains.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src\\toolchains.cpp -o $(OBJDIR_PROFILE)\\src\\toolchains.o $(OBJDIR_PROFILE)\\lib\\stlconfig.o: lib\\stlconfig.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib\\stlconfig.cpp -o $(OBJDIR_PROFILE)\\lib\\stlconfig.o $(OBJDIR_PROFILE)\\lib\\stlconvert.o: lib\\stlconvert.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib\\stlconvert.cpp -o $(OBJDIR_PROFILE)\\lib\\stlconvert.o $(OBJDIR_PROFILE)\\lib\\stlfutils.o: lib\\stlfutils.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib\\stlfutils.cpp -o $(OBJDIR_PROFILE)\\lib\\stlfutils.o $(OBJDIR_PROFILE)\\lib\\stlgpm.o: lib\\stlgpm.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib\\stlgpm.cpp -o $(OBJDIR_PROFILE)\\lib\\stlgpm.o $(OBJDIR_PROFILE)\\lib\\stlstrings.o: lib\\stlstrings.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib\\stlstrings.cpp -o $(OBJDIR_PROFILE)\\lib\\stlstrings.o $(OBJDIR_PROFILE)\\lib\\stlvariables.o: lib\\stlvariables.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib\\stlvariables.cpp -o $(OBJDIR_PROFILE)\\lib\\stlvariables.o $(OBJDIR_PROFILE)\\lib\\stringhash.o: lib\\stringhash.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib\\stringhash.cpp -o $(OBJDIR_PROFILE)\\lib\\stringhash.o $(OBJDIR_PROFILE)\\lib\\tinyxml\\tinystr.o: lib\\tinyxml\\tinystr.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib\\tinyxml\\tinystr.cpp -o $(OBJDIR_PROFILE)\\lib\\tinyxml\\tinystr.o $(OBJDIR_PROFILE)\\lib\\tinyxml\\tinyxml.o: lib\\tinyxml\\tinyxml.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib\\tinyxml\\tinyxml.cpp -o $(OBJDIR_PROFILE)\\lib\\tinyxml\\tinyxml.o $(OBJDIR_PROFILE)\\lib\\tinyxml\\tinyxmlerror.o: lib\\tinyxml\\tinyxmlerror.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib\\tinyxml\\tinyxmlerror.cpp -o $(OBJDIR_PROFILE)\\lib\\tinyxml\\tinyxmlerror.o $(OBJDIR_PROFILE)\\lib\\tinyxml\\tinyxmlparser.o: lib\\tinyxml\\tinyxmlparser.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c lib\\tinyxml\\tinyxmlparser.cpp -o $(OBJDIR_PROFILE)\\lib\\tinyxml\\tinyxmlparser.o $(OBJDIR_PROFILE)\\src\\buildtools.o: src\\buildtools.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src\\buildtools.cpp -o $(OBJDIR_PROFILE)\\src\\buildtools.o $(OBJDIR_PROFILE)\\src\\cbbuildcfg.o: src\\cbbuildcfg.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src\\cbbuildcfg.cpp -o $(OBJDIR_PROFILE)\\src\\cbbuildcfg.o $(OBJDIR_PROFILE)\\src\\cbbuildmgr.o: src\\cbbuildmgr.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src\\cbbuildmgr.cpp -o $(OBJDIR_PROFILE)\\src\\cbbuildmgr.o $(OBJDIR_PROFILE)\\src\\cbglobalvar.o: src\\cbglobalvar.cpp $(CXX) $(CFLAGS_PROFILE) $(INC_PROFILE) -c src\\cbglobalvar.cpp -o $(OBJDIR_PROFILE)\\src\\cbglobalvar.o clean_profile: cmd /c del /f $(OBJ_PROFILE) $(OUT_PROFILE) cmd /c rd bin\\Profile cmd /c rd $(OBJDIR_PROFILE)\\src cmd /c rd $(OBJDIR_PROFILE)\\lib cmd /c rd $(OBJDIR_PROFILE)\\lib\\tinyxml virtual_all: debug release src\cbp2make.cpp: lib\macros.h \ src\revision.h \ lib\stlfutils.h \ lib\stlgpm.h \ src\cbbuildmgr.h \ src\cbhelper.h lib\stlfutils.h: lib\macros.h \ lib\stlstrings.h lib\stlgpm.h: lib\stlconfig.h lib\stlconfig.h: lib\stlvariables.h lib\stlvariables.h: lib\stlconvert.h lib\stlconvert.h: lib\stlstrings.h src\cbbuildmgr.h: lib\stlstrings.h \ src\cbproject.h \ src\cbworkspace.h \ src\cbbuildcfg.h src\cbproject.h: lib\stlstrings.h \ lib\stlconfig.h \ src\depsearch.h \ src\makefile.h src\depsearch.h: lib\stlstrings.h \ lib\stringhash.h \ src\platforms.h \ src\makefile.h src\platforms.h: lib\stlstrings.h \ src\cbhelper.h src\cbhelper.h: lib\stlstrings.h src\makefile.h: lib\stlstrings.h \ lib\stlconfig.h src\cbworkspace.h: lib\stlstrings.h \ src\cbproject.h src\cbbuildcfg.h: lib\stlstrings.h \ src\platforms.h \ src\toolchains.h \ src\cbglobalvar.h \ src\cbhelper.h src\toolchains.h: lib\stlstrings.h \ src\platforms.h \ src\buildtools.h src\buildtools.h: lib\stlconfig.h \ lib\stlstrings.h \ src\platforms.h \ src\depsearch.h src\cbglobalvar.h: lib\stlstrings.h \ lib\stlconfig.h src\cbproject.cpp: src\revision.h \ lib\macros.h \ src\cbproject.h \ src\cbptarget.h \ src\cbpunit.h \ src\cbbuildcfg.h \ src\cbhelper.h \ lib\stlconvert.h \ lib\stlfutils.h \ src\depsearch.h \ lib\tinyxml\tinyxml.h src\cbptarget.h: lib\stlstrings.h \ src\platforms.h src\cbpunit.h: lib\stlstrings.h \ src\cbptarget.h lib\tinyxml\tinyxml.h: lib\tinyxml\tinystr.h src\cbptarget.cpp: src\cbptarget.h \ src\cbhelper.h \ lib\stlconvert.h \ lib\stlfutils.h \ lib\tinyxml\tinyxml.h src\cbpunit.cpp: lib\macros.h \ src\cbpunit.h \ src\cbhelper.h \ lib\stlconvert.h \ lib\stlfutils.h \ lib\tinyxml\tinyxml.h src\cbworkspace.cpp: src\revision.h \ lib\macros.h \ src\cbworkspace.h \ src\cbbuildcfg.h \ src\cbhelper.h \ lib\stlfutils.h \ lib\tinyxml\tinyxml.h src\depsearch.cpp: src\cbhelper.h \ lib\stlfutils.h \ src\depsearch.h src\cbhelper.cpp: src\cbhelper.h src\makefile.cpp: lib\tinyxml\tinyxml.h \ lib\stlconvert.h \ src\cbhelper.h \ src\makefile.h src\platforms.cpp: src\platforms.h \ lib\stlconvert.h \ lib\stlfutils.h \ lib\tinyxml\tinyxml.h src\toolchains.cpp: src\toolchains.h \ lib\stlconvert.h \ lib\tinyxml\tinyxml.h lib\stlconfig.cpp: lib\stlstrings.h \ lib\stlconfig.h lib\stlconvert.cpp: lib\stlconvert.h lib\stlfutils.cpp: lib\stlfutils.h lib\stlgpm.cpp: lib\stlgpm.h \ lib\stlfutils.h lib\stlstrings.cpp: lib\stlstrings.h \ lib\stlconvert.h lib\stlvariables.cpp: lib\stlvariables.h lib\stringhash.cpp: lib\stringhash.h lib\tinyxml\tinystr.cpp: lib\tinyxml\tinystr.h lib\tinyxml\tinyxml.cpp: lib\tinyxml\tinyxml.h lib\tinyxml\tinyxmlerror.cpp: lib\tinyxml\tinyxml.h lib\tinyxml\tinyxmlparser.cpp: lib\tinyxml\tinyxml.h src\buildtools.cpp: src\buildtools.h \ lib\stlconvert.h \ src\cbhelper.h \ lib\tinyxml\tinyxml.h src\cbbuildcfg.cpp: src\cbbuildcfg.h \ lib\stlconvert.h \ lib\tinyxml\tinyxml.h src\cbbuildmgr.cpp: lib\stlfutils.h \ src\cbbuildmgr.h \ lib\tinyxml\tinyxml.h src\cbglobalvar.cpp: lib\tinyxml\tinyxml.h \ lib\stlfutils.h \ src\cbglobalvar.h \ src\cbhelper.h .PHONY: before_debug after_debug clean_debug before_release after_release clean_release before_doxygen after_doxygen before_profile after_profile clean_profile cbp2make-147+dfsg/cbp2make.cbp0000644000175000017500000002366112143773451016043 0ustar moellermoeller cbp2make-147+dfsg/COPYING0000644000175000017500000010451312143137414014711 0ustar moellermoeller GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read .