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 which, if empty will be arbitrary set to the value 0.0.

  • 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[0123gsf]
    • -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

Oprofile

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

You can set the following default options:

  • operf options.
  • ocount options.
  • opreport options.
  • opannotate options.
  • opgprof options.

Valgrind

mk-project provides 4 valgrind targets per default:

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.

For this valgrind targets you can set the options.

note:You can define more valgrind targets by editing the template.

You can give options to apply to valgrind by setting the environment variable VALGRIND_OPTS.

Or by passing it like this:

$ make valgrind-memcheck VALGRIND_MEMCHECK_OPTS=--option=value

$ make valgrind-cachegrind VALGRIND_CACHEGRIND_OPTS=--option=value

$ make valgrind-callgrind VALGRIND_CALLGRIND_OPTS=--option=value

$ make valgrind-helgrind VALGRIND_HELGRIND_OPTS=--option=value

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, 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 sphinx specific targets.

man-page

The man page generating is separated from the documentation because they normally

does not contains the same,

so mk-project provides through the rst2man tool an option

to build (using the ReST syntax) and view a man page.

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 chosen 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.

Archiving your project

mk-project provides many compressed archiving targets:

  • zip archive.
  • tar archive compressed with lzma, xz, gz, bz.
  • rar archive.

If the wanted archive program is installed at your site. What is not oblige.

note:mk-project provides through his G.U.I a: Project –> extract and load menu item.

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.

Exporting your settings

You can exporting your settings as a mk-project profile.

To load it by the next project because typing all this options can be painful.

You will get the most wanted settings setted like nm_options per example,

but not all like the program name.

warning:The file extension will arbitrary set to *.mkpp.