[Contents] [TitleIndex] [WordIndex

Code Conventions for Makefiles

Indentation

libscimodulename_la_CPPFLAGS = -I/usr/myincludes/

libscimodulename_la_CPPFLAGS = \
        -I/usr/myincludes/ \
        -I/usr/myotherincludes/

Naming conventions

Include related flags must be prefixed by CPP (Pre-Processor flags), this gather all include that can be given to CFLAGS/FFLAGS/CXXFLAGS.

If pre-processor flags are modified by the module (to append some specific includes for exemple), the shared Automake Pre-Processor flags : AM_CPPFLAGS should be appended after the modification. This AM_CPPFLAGS is used as default if the module does not provide specific flags.

MODULENAME_CPPFLAGS = \
        ... \
        $(AM_CPPFLAGS)

C++ source lists must be prefixed by CXX.

MODULENAME_CXX_SOURCES =
MODULENAME_GATEWAY_CXX_SOURCES =

Other variables for exemple:

MODULENAME_C_SOURCES =
MODULENAME_JNI_SOURCES =
MODULENAME_GATEWAY_C_SOURCES =

File order

Header files are divided into three block, each one in lexicographical order

libscimodulename_la_CPPFLAGS = \
        header files from the module itself (Block #1) \
        header files from other Scilab modules (Block #2) \
        all other headers coming from external libraries (Block #3)

Example:

libscixml_la_CPPFLAGS = \
        -I$(srcdir)/includes/ \
        -I$(srcdir)/src/c/ \
        -I$(srcdir)/src/cpp/ \
        -I$(top_srcdir)/libs/MALLOC/includes/ \
        -I$(top_srcdir)/modules/api_scilab/includes/ \
        -I$(top_srcdir)/modules/core/includes/ \
        -I$(top_srcdir)/modules/fileio/includes/ \
        -I$(top_srcdir)/modules/localization/includes/ \
        -I$(top_srcdir)/modules/output_stream/includes/ \
        -I$(top_srcdir)/modules/string/includes/ \
        $(AM_CPPFLAGS) \
        $(XML_FLAGS)

This sorting rule must also be used for sources, gateways, ... file list.

Tools documentation


2022-09-08 09:26