Building a mk-project project

Starting

At first some basic informations will be required:

  • The programming language from the project.

    • C

    Or

    • C++
  • The project name which will become the program name

    the binary name.

  • The program version (Optional).

  • The folder where to generate the project.

    warning:The folder must be empty (Advice: create it with the folder-chooser at the same time as the project).
  • The license of your project.

    • GPL
    • AGPL
    • LGPL
    • FDL
    • Apache 2.0 License
    • Clear BSD
    • Free BSD
    • Other
note:The license files will be copied into the project folder according to your choice of format(s).
  • docbook
  • epub
  • pdf
  • latex
  • html
  • texinfo
  • text

C/C++ Compiler settings

For every entry except the “Compiler entry” you get an aside button which

will permit you to add the most common settings easily.

  • Compiler:

    You can choose a compiler to use, which default to cc for a C project and c++ for C++.

    But you can set clang per example or the compiler you want.

    warning:The exactness of your entry will be checked by compiling a minimal program.
  • Warnings:

    You can set the warnings to use.

    Note

    The aside button will permit you to insert as warnings the following most common warnings settings:

    • -Wall (All warning: sea the documentation of your compiler to see which are enabled).
    • -Wextra (Extra warning: sea the documentation of your compiler to see which are enabled).
    • -Wpedantic (ISO conform: most extension are permitted. sea the documentation of your compiler to see which are enabled).
    • -w (No output warnings).
    • -Werror (A warning is consider as an error).
    warning:The field is empty per default.
  • CFLAGS:

    You can set the argument to give to the compiler (like -g, -O2,...).

    Note

    The aside button provide few flags adding:

    • -g
    • -O[0123sf]
    • -std=
    • -pedantic
  • CPPFLAGS:

    Preprocessor instruction to pass onto the compile command line.

    Note

    The aside button permit you to define a definition with a value or without.

  • LDFLAGS:

    Dynamic Linker Flags.

    Note

    The aside button will permit you to choose the pkg-config

    you want to add to your project.

    By listing all the pkg-config available on your system.

    warning:By hand editing, if you use pkg-config, use the back-ticks syntax:

    Else this will not work because of the make syntax.

  • LDLIBS:

    Dynamic Linker library libraries: per example -lm.

    Note

    The aside button will permit you to add the linker of your choice.

    By listing all linker flags available on your system.

Files

Here you must set the extension you will use for the source and header files.

Especially for the C++ language:

  • Source files:

    • .cpp
    • .CPP
    • .c++
    • .C
    warning:This is very important because of the compilation automation which will not work with the wrong extension.
  • Header files:

    • .h
    • .hh
    • .H
    • .hp
    • .hxx
    • .hpp
    • .HPP
    • .h++
    • .tcc
note:For the C language this default to .c and .h.

Disassembling

Here you can give the default options to pass to the debugging tools:

  • nm options.
  • gdb options.
  • strace options.
  • ltrace options.
  • objdump options.
  • ldd options.
  • gprof options.
note:For further informations sea the mk-project code investigating, debugging and disassembling page.

Profiling

mk-project use Oprofile version >= 1.0 for profiling you code.

  • operf options.
  • ocount options.
  • opreport options.
  • opannotate options.
  • opgprof options.
note:Optionally mk-project provides valgrind targets:
make valgrind-memcheck   # Launch the valgrind memcheck tool on your binary.

make valgrind-cachegrind # Launch the valgrind cachegrind tool on your binary.

make valgrind-callgrind  # Launch the valgrind callgrind tool on your binary.

make valgrind-helgrind   # Launch the valgrind helgrind tool on your binary.

C/C++ code formatters

Here you can choose the code formatter(s) you want to use.

  • You can set the options to give to indent and to astyle for the indent-user and astyle-user target if you know this tools.
    note:But mk-project provides a lot of pre-configurated astyle, :program`indent`, bcpp targets.
  • You can set the indentation width to use and wether to use tabulation or not during the formatting process.
note:For further information sea the page: mk-project code formatters

Documentation

  1. Simply choose to use sphinx or not.
  2. Set the options according to your sphinx version.
  3. Enable/Disable the wanted sphinx extensions.
sphinx:This will generate a Makefile and mk-project targets.

About informations

Here you can set some informations about your program.

  • Author(s).
  • Mail address.
  • Program URL.
  • Copyright string.
note:All this informations will generate some constant definition into the ./headers/defines.${EXT_HDR} file.

Others Informations

  • Make options: the options to pass to make at every call.
  • The bash location (auto-detect).
  • Compression level for the pkg-\* targets, with which you can build an archive from your project.

Licensing

You can edit a source code files header according to the choosen license.

And add it to every source file with the target:

make prepend-license.

*.desktop file

You can build a desktop file with this boilerplate.

Summary

Last step to complete the generation of your project.

Enjoy the easiness of working with mk-project the T.D.E Terminal Development Environment.