This page consists of a collection of gbuild howto's for people who need to get something done with the build system, but who are not necessarily interested in the details of the build system internals.
- 1 Internal source files
- 2 External libraries
- 3 Targets
Internal source files
$(eval $(call gb_CppunitTest_use_library_objects,sc_ucalc, \ sc \ scqahelper \ ))
This code will statically link two libraries - sc and scqahelper - into sc_ucalc cppunit target.
Add a new library to existing module
To add a new library to an existing module, first, add a new .mk file immediately below the module directory and name it Library_<library name>.mk. For example, let's add a new library target named 'scfoo' under the sc module. First you would create
and add at the top of the file
$(eval $(call gb_Library_Library,scfoo))
to register the library. Then add the Library_scfoo entry to the sc/Module_sc.mk file near the top
$(eval $(call gb_Module_add_targets,sc,\ .... Library_scfoo \ .... ))
to make this library a part of the sc module. You would also need to add this library in the Repository.mk file in the top directory, or else you'll get something like
*** Library scfoo must be registered in Repository.mk. Stop.
when you try to build the sc module.
Specify libraries to statically link to for cppunit target.
Set library target name.
Specify include paths for headers at build time.
Sets the library to link against some possibly external/system libraries. Note that some system libraries in the LibreOffice build use an own copy build in the LibreOffice build itself. This can be triggered by
./configure switches or depend on the platform. gb_Library_use_externals will add the proper include and link switches and dependencies for either scenario.
UNO services and interfaces are defined in .idl files, and headers with C++ class declarations are generated from these in the build. If a library uses one of these UNO headers, it needs to declare gb_Library_use_sdk_api for that library -- otherwise gbuild might try to build the c++ objects before the headers are there, if you are unlucky.
Specify dependencies on other internal libraries. These libraries will be dynamically linked at build time.
Specify source files to compile for the library, with C++ exception support.
Specify libraries that a given module builds. Libraries specified here will be built when running make <module name>.