Git Product home page Git Product logo

cbp2make's Introduction

cbp2make

About

=

'''cbp2make''' is a stand-alone build tool that allows you to generate makefile(s) for GNU Make out of Code::Blocks IDE project or workspace file. (See also [http://forums.codeblocks.org/index.php/topic,13675.0.html])

Usage

Create makefile for a single project or workspace

Let's assume you have a project "my_project.cbp" and you need a makefile for this project. In this simplest case all you have to do is:

cbp2make -in my_project.cbp

Same thing applies to workspaces.

cbp2make -in my_projects.workspace

Create makefile with another filename

By default, '''cbp2make''' will append ".mak" extension to the project name to compose a filename for makefile. If you want to change that, use following command:

cbp2make -in my_project.cbp -out Makefile

Create makefile for another platform

If you are working in GNU/Linux and you want to generate a makefile for Windows or the other way around, you can specify one or more platforms for which you need makefiles.

cbp2make -in my_project.cbp -windows
cbp2make -in my_project.cbp -unix
cbp2make -in my_project.cbp -unix -windows -mac
cbp2make -in my_project.cbp --all-os

'''cbp2make''' will append ".unix" or ".windows" or ".mac" suffix to makefile name for each platform respectively.

Create makefile for multiple projects or workspaces

If you have more than one independent project or workspace, you can process them at once, but you will need a text file containing the list of projects, e.g., ''projects.lst'', with one project filename per line.

my_project.cbp
my_other_project.cbp

And then you can process them using command:

cbp2make -list -in projects.lst

Configuration

Some installation-specific or project-specific options, primarily toolchain settings, can be saved to a configuration file. By default (since rev.110), cbp2make does not save any settings to a configuration file unless the user explicitly specifies the "--config" option. A configuration file can be either global (stored in user profile / home directory) or local (stored in current directory).

Please, keep in mind that since cbp2make is in early stage of development, an old configuration file may become incompatible with new tool version and it may be necessary to update it manually or initialize a new one.

Initialization

cbp2make --config options --global
cbp2make --config options --local

Later use

When cbp2make is invoked, first it tries to load a local configuration file. If a local configuration is missing, next attempt will be to load a global one. If this attempt is not successful either, the default built-in configuration is used. Configuration lookup order can be overridden with "--local" or "--global" command line options. If one of options is supplied to cbp2make, non-specified configuration is not picked up even if the specified one is missing and non-specified do exists.

Default lookup order

cbp2make -in project.cbp -out Makefile

Explicitly specified configuration

cbp2make --local -in project.cbp -out Makefile
cbp2make --global -in project.cbp -out Makefile

Command line 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\] 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\]
    Manage toolchains:
            cbp2make --config toolchain --add \[-unix|-windows|-mac\] -chain <toolchain>
            cbp2make --config toolchain --remove \[-unix|-windows|-mac\] -chain <toolchain>

    Manage build tools:
            cbp2make --config tool --add \[-unix|-windows|-mac\] -chain <toolchain>
                     -tool <tool> -type <type> <tool options>
            cbp2make --config tool --remove \[-unix|-windows|-mac\] -chain <toolchain>
                     -tool <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 <description> -program <executable> -command <command_template>
                     -mkv <make_variable> -srcext <source_extensions> -outext <output_extension>
                     -quotepath <yes|no> -fullpath <yes|no> -unixpath <yes|no>
    Tool options (compiler):
                     -incsw <include_switch> -defsw <define_switch> -deps <yes|no>
    Tool options (linker):
                     -ldsw <library_dir_switch> -llsw <link_library_switch> -lpfx <library_prefix>
                     -lext <library_extension> -objext <object_extension> -lflat <yes|no>

    Manage platforms:
            cbp2make --config platform \[-unix|-windows|-mac\] \[-pwd <print_dir_command>\]
                     \[-cd <change_dir_command>\] \[-rm <remove_file_command>\]
                     \[-rmf <remove_file_forced>\] \[-rmd <remove_dir_command>\]
                     \[-cp <copy_file_command>\] \[-mv <move_file_command>\]
                     \[-md <make_dir_command>\] \[-mdf <make_dir_forced>\]
                     \[-make <default_make_tool>\]

    Manage global compiler variables:
            cbp2make --config variable --add \[-set <set_name>\] -name <var_name>
                     \[-desc <description>\] \[-field <field_name>\] -value <var_value>
            cbp2make --config variable --remove \[-set <set_name>\] \[-name <var_name>\]
                     \[-field <field_name>\]

    Manage options:
            cbp2make --config options --default-options "<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

Options

''Makefile generation''

-in <project_file> // specifies an input file or a list of files;
-cfg // specifies a configuration file, see also "--local" and "--global" options;
-out // specifies the name of a makefile or a list of makefiles;
-unix // enables Unix / Linux compatible makefile generation;
-windows // enables Windows compatible makefile generation;
-mac // enables Macintosh compatible makefile generation;
--all-os // enables all target platforms at once;
-targets "[,[, ...]]" // specifies the only build targets that a makefile will be made for;
--flat-objects // forces "flat" names for object files with limited character set;
--flat-objpath // forces "flat" paths for object files with no subdirectories;
--wrap-objects // allows to use multiline lists of objects which makes a makefile easier to read;
--wrap-options // allows to use multiline macros;
--with-deps // allows a built-in dependency scanner for C/C++ projects;
--keep-objdir // disables command that erase directories for object files in 'clean' target;
--keep-outdir // disables command that erase directory for an output binary file in 'clean' target;
--target-case [keep|lower|upper] // specifies style for makefile targets;

Examples

cbp2make's People

Contributors

mirai-computing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cbp2make's Issues

When include files ues environment constants slash escaping fails

I have such example of include dirs:

INC = -I$(WXWIN)\include -I$(PYTHONHOME)\include -I$(WXCURL)\include

where environmental constants are used.
As we see here, backslash is not escaped.
Must be:

INC = -I$(WXWIN)\\include -I$(PYTHONHOME)\\include -I$(WXCURL)\\include

Installation process unclear

It is specified how to use the tool, but regarding the installation there is nothing.
The most intuitive approach for me was to clone the repo and run the install script, but that's not working.
Not really surprising, since it tries to copy files from a not existing folder.

Maybe I am missing something obvious, but would be convenient to just address the installation in the README.

$(LIB) spacing

When generating the Makefile, the spacing on LinkerLibraries is incorrect for the line LIB_DEBUG, i.e.
image

When running make, output is missing a space between paths. Looks like this:
image

Proposed solution:
Add a space to the end of the last path in the loop in cbproject.cpp at line 834.

for (int i = 0; i < m_LinkerLibraries.GetCount(); i++)
   {
    CString lib_pathname = m_LinkerLibraries[i];
    CString lib_path, lib_name, lib_ext;
    SplitFilePathName(lib_pathname, lib_path, lib_name, lib_ext);
    //CString lib_name = m_LinkerLibraries[i];
    //CString lib_ext = ExtractFileExt(lib_name);
    //if (lib_ext.IsEmpty())
    if (lib_path.IsEmpty())
    {
     if (pl->IsLibraryExtension(lib_ext))
     {
      CString lib_base_name = pl->BaseLibraryName(lib_name,lib_ext);
      line = JoinStr(line,tc->LinkLibrarySwitch()+pl->ProtectPath(pl->Pd(lib_base_name),Config.QuotePathMode()),' ');
      //line.Append(" ");
     }
     else
     {
      line = JoinStr(line,tc->LinkLibrarySwitch()+pl->ProtectPath(pl->Pd(lib_name),Config.QuotePathMode()),' ');
      //line.Append(" ");
     }
    }
    else
    {
     line = JoinStr(line,pl->ProtectPath(pl->Pd(lib_pathname),Config.QuotePathMode()),' ');
     // line.Append(" ");
    }

Doesn't compile - no members BaseLibraryName and IsLibraryExtension in CPlatform

cbptarget.cpp||In member function ‘CString CBuildTarget::Libs(const CPlatform&, const CString&)’:|
cbptarget.cpp|302|error: ‘const class CPlatform’ has no member named ‘BaseLibraryName’|
cbproject.cpp||In member function ‘bool CCodeBlocksProject::GenerateMakefile(const CString&, CCodeBlocksBuildConfig&)’:|
cbproject.cpp|818|error: ‘class CPlatform’ has no member named ‘IsLibraryExtension’; did you mean ‘IsStaticLibraryExtension’?|
cbproject.cpp|820|error: ‘class CPlatform’ has no member named ‘BaseLibraryName’|

Custom Compiler profile Import

Hello,

If I've defined custom compiler profile in the Code::Clocks the cbp2make does not importing this custom profile in to cbp2make.cfg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.