dmake tool uses
The following sections describe the general structure of
- Generation of Object Files and Libraries
- Generation of Resource Files
- Generation of Applications
- Generation of Shared Libraries or Dynamic Link Libraries
- Internal Structure of the Makefiles
- Setting Additional Options
- Creation of Additional Targets
The general outline of makefiles is as follows:
PRJ=.. PRJNAME=SW TARGET=core .include:settings.mk # use the predefined macros .include:target.mk
The following table describes the macros you use in the general outline of a makefile.
||This macro gives the relative position of the root of the current module.|
||This macro gives the name of the module. This name must be unique within the tree.|
||This macro specifies an identifier for the current directory. This
name must be unique within the module, or a filename conflict may occur in
the output or the
The following table describes the macros you use to generate object files and libraries. The x in these macros signifies a number between one and nine. This specifies support for up to nine different libraries.
||You must set this macro to generate the appropriate object files
from the following source files:
This macro ensures that the build process creates the object files
for the compiler in the
You can use these targets can be used to compile C and C++ sources
found in different locations. See the
The build process usually creates a library from the object files
||Set this macro when you do not want to build a library.|
||You can use several library macros of this form to build libraries that do not consist of all object files in a directory or to merge different libraries.|
||Sets up support for static linking of libraries. Linux, Solaris, and Mac OS X support this macro.|
||Specifies object files to bind into linked libraries.|
||Specifies further files to link into the linked library.|
The following table describes the macros you use to generate resource
files. The German language resource files are built by default. To support
other locales, the environment variable
UPDATER must be set
to YES and the corresponding locale environment variable
must also be set.
The x in these macro names signifies a number between one and nine. This specifies support for up to nine different resource files.
||You must set up this macro to generate resource files. To create
one resource file from these files the
||You can use these macros to support the building of several
||You can use these macros to build resource DLLs.|
You can also set the
give_me_all_languages environment variable
to build resource files for languages. However, this builds resource files
for all languages.
The following table describes the macros you use to generate applications. The x in these macro names signifies a number between one and nine. This specifies support for up to nine different applications.
||Indicates the filename of the application. The application is always
built in the
||Indicates object files that link to the application. Do not use this macro to build objects, as it does not recognize dependencies.|
||Indicates import libraries that link to the application. These
are standard binary libraries, such as
||Indicates libraries from the same module that link to the application. For UNIX these are simple text lists of object files, rather than normal binary libraries.|
||Specifies a definition file, if you use one in linking. For Win32 only.|
||Specifies system resources. For Win32 only.|
||Specifies an application icon. For Win32 only.|
The following table describes the macros you use to generate shared libraries or dynamic link libraries (DLLs). The x in these macro names signifies a number between one and nine. This specifies support for up to nine different shared libraries.
||Indicates the filename of the shared library.
In Win32, shared libraries are always built as
In UNIX, shared libraries are built as
||Provide platform and release independent names, for example:
||Specify the object files that are used to create the library.|
||Links import libraries.|
||Specifies libraries from the same module to put into the shared library.|
||Specifies the exported symbols file. For Win32 only.|
||System dependent resources use this macro.|
||Specifies an import library to create. For Win32 only.|
||Specifies the name of the definition file. This is usually a similar name to the shared library.|
||Indicates definition file dependencies.|
||Specifies the library name to parse for symbols. For Win32 only.|
||A comment on the definition file.|
||A symbol name. The y in this macro name signifies a number from 1-99.|
||A file of symbols to export.|
The following example shows how you can use these macros:
$(MISC)$/$(SHLxTARGET).flt: @echo string >> $@
Note: The new line and indentation are necessary for these lines to work.
This command generates a filter file for automatically creating a definition
ldump tool parses the library specified in
for symbols, removes all symbols that match the string in the
file, and writes the resulting list into the definition file.
You can only do this for Win32. A similar process for Linux, Solaris, and Mac OS X is planned.
Each makefile contains an include directive to a
file, followed by an include directive to a
The following sections describe these files.
settings.mk sets all the global settings for the
makefiles. It sets macros, based on the following:
- The underlying operating system.
- The compiler used.
- The version of the office suite you are building.
For example, it sets the name of the compiler used, linker, or library manager. It can also define the names of libraries, compiler switches, and link switches.
target.mk file, the standard target is predefined
depending on the macros you set. For example, it can contain statements for
linking applications, libraries, or resources. Typically, the
directive gets these files from
solenv/inc. Typically, the
include directive gets these files from solenv/inc.
There are other makefiles that specify particular settings that control
parts of the build. The following table describes these special settings
makefiles. These makefiles are included by either
||This file defines macros for tools which are available on different
platforms, for example:
||Macros such as
||The platform-dependent environment setup for
||These makefiles specify platform-dependent characteristics, for
Other platform-specific makefiles may also exist. For example:
These files typically contain variables which are used to change the build:
In addition there are flags enabled for profiling or debug builds:
There are corresponding linker flags for profiled and debug builds:
There is also support for whether the target is a command-line user interface (CUI) or graphical user interface (GUI), whether it is an object or shared library and whether it is single-threaded (ST) or multi- threaded (MT) by using the following flags:
||This files specifies the rules for compiling the following types
There may be many rules to build each type of file. From these rules, existing source files can build targets.
After the include of
settings.mk, the next major include
target.mk file which describes how to build the targets
of each platform. The
target.mk file is divided into the following
- Expansion of the overall targets.
- Dependency order.
- Description of the following individual targets:
_tg_def.mk- the definition files for shared libraries (DLLs).
_tg_sdi.mk- the target definition for the IDL (
tg_obj.mk- the building of the library from object files.
tg_slo.mk- the building of the library from
_tg_lib.mk- the building of the library from any files.
_tg_srs.mk- the translation of the
_tg_res.mk- the translation of the
_tg_rslb.mk- generation of the resource DLLs.
_tg_shl.mk- generation of the shared libraries.
tg_jar.mk- generation of the jar files.
tg_dep.mk- generation of the dependencies.
The file also includes the descriptions of many further targets such as
killbin, and so on.
You use the macros described in the following table to set additional options.
||This macro supports additional compiler options for C.|
||This macro supports additional compiler options for C++.|
||This macro supports additional linker options.|
The following sections describe ways to create additional targets in a makefile.
To build targets other than the default targets that are created by the
target.mk file, follow these steps:
- Add the targets to the target
- End the list of targets with
- Make sure
target allprecedes the include of
target.mkin the makefile.
If you write your target in a platform independent form without using
any hard-coded pathnames, ensure that your target appears before the
directive. If this works, this is an acceptable way to create an additional
The typical way to add a target is to add it to an existing
that already includes targets. This causes the following problems:
- If you place your target before the
.include:target.mkdirective in the makefile, it disables the global targets.
- If you place your target after the
dmakedoes not build the target.
- If you try to build your target by using the technique in the following
sample, you may encounter several other problems.
all: \ new-target \
The first target is always built. When doing an initial build,
dmakeenters states where no
ALLTARis defined and displays an error message and stops.
There is also no guaranteed order of execution of those two targets. It may work most of the time and produce unusual errors on multiprocessor machines.
Define explicit dependencies as follows:
#this object depends on generated source $(OBJ)$/myobject.obj : $(MISC)$/myobject.cxx
Then define the target to generate the source file after this statement.
If this object is needed now, there is a dependency on the source file and
the target is executed. You must define all the targets and dependencies
There is still a potential problem of conflicts with targets added to the global makefiles in the future. If something in the build environment changes and affects your target, it may be difficult to identify the change.