EXAMPLE (DESCRIPTION)

This section shows how to make a build for a project that consists of two subprojects: Client and Server.

 

CREATION OF PROJECT DIRECTORY TREE

Proposed project directory tree is shown in the figure below.

Source files in the Client subdirectory are built into the Client executable, and source files in the Server subdirectory into the Server executable.

 

STEP 1. CREATION OF A MAKE-EFFECT PROJECT

Before creation of the project it is necessary to create the Make-Effect configuration file. This can be accomplished by invoking the following command from the project root directory:

$ me-create -conf

This will create the me-config.xml configuration file in the same directory. It contains configuration settings for the makefiles, which can be created or altered later. In this example the configuration file will not be altered.

Creation of the project is performed by invoking this command from the project root directory:

$ me-create -project

The following items will be created: project makefile (Makefile), release session (Release), debug session (Debug), and script examples for packaging of the project.

Release session and packaging scripts will not be dealt with here further.

A list of subprojects intended for building needs to be specified as preliminary information. The list should be specified in the base_subprojs_dirs parameter of the project makefile:

base_subprojs_dirs := src/Server src/Client

 

STEP 2. CREATION OF SUBPROJECT CONFIGURATION FILES

The steps required for subproject configurations files —Āreation is optional for this simple example. These files will be automatically created on a first build of a project. Default settings supplied on creation of the project are appropriate for building the project.

For sophisticated subprojects it is more suitable to create configuration files first, edit them, and then build the project. Command me-create -subproj <path to the subproject> creates a subproject configuration file:

$ me-create -subproj src/Server
$ me-create -subproj src/Client

This command interactively asks which makefile template should be used. In both of the cases given, a console application template should be used, i.e. case # 1 should be chosen.

Makefiles with default settings will be created in the root of subprojects directories.

 

STEP 3. BUILD PROJECT

As mentioned in the section SESSION MANAGEMENT, building of the project is performed within one of the build sessions previously created. On project creation the Debug session is also created, and it can be used for building the project.

If the session does not exist for some reason, it can be created by using the following command:

$ me-create -debug <session name>

Before building the project, make sure that the session currently selected is correct, i.e. it is specified in the session parameter of .me-session file:

session=Debug

Building of the project itself is performed by issuing the command make build from the project root directory:

$ make build

or more briefly as:

$ make

since the build action will use the default action.

In the root of the build process, the executable files will be located in the bin subdirectory of the session. A cache of object files will also be created. This cache can reduce compilation time on future builds.

The presence of object files allows rebuilding of only those objects files that have had their source files changed since the last build. As an example, changing ClientTCPEngine.c with:

$ touch src/Client/ClientTCPEngine.c

causes the re-compilation of the ClientTCPEngine.o file only and re-linking of the Client executable, on a subsequent build with the make command.

 

UNIT TEST USAGE

If the tests_ldflags parameter of the me-config.xml file correctly specifies a unit test library, then the only thing needed to start using tests is placement of the sources files for testing into the Tests subdirectories of the subprojects sources directories. Moreover, the parameter value <subproject name>_tests_ldflags should be changed in all of the subprojects makefiles in order to refer to the right unit test library.

Build and run of unit tests is performed by excuting the command make tests.

Building of tests can be included into the session-specific list of default actions to perform:

Debug/Makefile.in:
default: build tests

In this case, running of make will build and run unit tests.