]> rtime.felk.cvut.cz Git - omk.git/blobdiff - doc/omk-manual.texinfo
snippets/linux-kernel.omk: Linux 6.x kernel series modpost requirements workaround.
[omk.git] / doc / omk-manual.texinfo
index c7f649436e6838e37014f9a0179832bd0c510981..dcd81028de19c1a33f24be7cea6e07c53c08ea8f 100644 (file)
@@ -169,6 +169,7 @@ about the process of modularization.
 * Invoking OMK::
 * Compiling Programs::
 * Compiling Libraries::
+* Compiler Flags::
 * Recursing into Subdirectories::
 * Dependency Tracking::
 * Configuration and Conditional Compilation::
@@ -320,11 +321,11 @@ To tell OMK to compile a program, you need to set some variables in
 @file{Makefile.omk} (usually) in the directory where program sources are
 located.
 
-In the example bellow program @command{test} will be compiled from
+In the example bellow program @command{test} will be compiled from
 source @file{test.c}.
 
 @example
-@verbatiminclude tests/programs/Makefile.omk
+@verbatiminclude tests/programs/compile-a-single-source-c-program/Makefile.omk
 @end example
 
 @noindent The variables are:
@@ -367,6 +368,28 @@ source @file{test.c}.
   @end example
 @end defvar
 
+@defvar xxx_CFLAGS
+  CFLAGS specific for the compiler program. If this variable is set, its
+  value efectively overrides the value of OMK_CFLAGS variable.
+@end defvar
+
+@defvar xxx_CXXFLAGS
+  CXXFLAGS specific for the compiler program. If this variable is set, its
+  value efectively overrides the value of OMK_CXXFLAGS variable.
+@end defvar
+
+@defvar xxx_CPPFLAGS
+  CPPFLAGS specific for the compiler program. If this variable is set, its
+  value efectively overrides the value of OMK_CPPFLAGS variable.
+@end defvar
+
+@defvar xxx_GEN_SOURCES
+  Program sources generated (by other rules) in the build directory. See
+  the following example.
+  @verbatiminclude tests/programs/generated-sources/Makefile.omk
+
+@end defvar
+
 @defvar lib_LOADLIBES
   This variable contains a list of libraries which needs to be linked to
   to all programs or shared libraries in this directory.
@@ -382,33 +405,7 @@ source @file{test.c}.
   instead of lib_LOADLIBES.
 @end defvar
 
-@defvar INCLUDES
-  Directives passed to the C or C++ compiler with additional directories
-  to be searched for header files. In most cases you need to specify an
-  absolute path. To specify a directory relative to the source
-  directory, you can use the @code{$(SOURCES_DIR)} variable, which
-  refers to the directory, where @file{Makefile.omk} is located. This
-  variable applies to all compilations invoked in the current directory.
-
-  @example
-  INCLUDES = -I$(SOURCES_DIR)/my_include_dir
-  @end example
-@end defvar
-
-@defvar DEFS
-  Directives passed to the C or C++ compiler with preprocessor macro
-  definitions. This variable applies to all compilations invoked in the
-  current directory.
-
-  @example
-  DEFS = -DDEBUG=1
-  @end example
-@end defvar
-
-
-@c FIXME: INCLUDES variable should not be set by rtlinux rules.
-
-@node Compiling Libraries, Recursing into Subdirectories, Compiling Programs, User's Manual
+@node Compiling Libraries, Compiler Flags, Compiling Programs, User's Manual
 @section Compiling Libraries
 
 
@@ -424,7 +421,7 @@ is defined in @file{myfunc.h}. Therefore, we export this header for use
 by other programs.
 
 @example
-@verbatiminclude tests/libraries/Makefile.omk
+@verbatiminclude tests/libraries/static-library/Makefile.omk
 @end example
 
 @noindent Variables for use with libraries are:
@@ -453,7 +450,7 @@ by other programs.
 @subsection Header Files
 
 C and C++ libraries are not very useful without header files. OMK
-provides several variables that controls operations with header files.
+provides several variables that control operations with header files.
 
 During compilation, header files are copied (or linked by symbolic
 links) from source directories to the @file{_compiled} tree (see
@@ -515,7 +512,49 @@ and what is their destination file name.
   top level configuration file @file{config.omk} or on command line.
 @end defvar
 
-@node Recursing into Subdirectories, Dependency Tracking, Compiling Libraries, User's Manual
+@node  Compiler Flags, Recursing into Subdirectories, Compiling Libraries, User's Manual
+@section Compiler Flags
+
+OMK follows the same philosophy for flag variables as does Automake. The
+variables with OMK_ prefix (e.g. OMK_CPPFLAGS) are supposed to be used by
+the package developer and variable without that prefix (e.g. CPPFLAGS)
+are reserved for the user. The following
+
+@defvar OMK_CPPFLAGS
+Preprocessor switches.
+@end defvar
+
+@defvar OMK_CFLAGS
+C compiler switches.
+@end defvar
+
+
+@defvar INCLUDES
+  Directives passed to the C or C++ compiler with additional directories
+  to be searched for header files. In most cases you need to specify an
+  absolute path. To specify a directory relative to the source
+  directory, you can use the @code{$(SOURCES_DIR)} variable, which
+  refers to the directory, where @file{Makefile.omk} is located. This
+  variable applies to all compilations invoked in the current directory.
+
+  @example
+  INCLUDES = -I$(SOURCES_DIR)/my_include_dir
+  @end example
+@end defvar
+
+@defvar DEFS
+  Directives passed to the C or C++ compiler with preprocessor macro
+  definitions. This variable applies to all compilations invoked in the
+  current directory.
+
+  @example
+  DEFS = -DDEBUG=1
+  @end example
+@end defvar
+
+@c FIXME: INCLUDES variable should not be set by rtlinux rules.
+
+@node Recursing into Subdirectories, Dependency Tracking, Compiler Flags, User's Manual
 @section Recursing into Subdirectories
 
 OMK is probably most useful in projects consisting of multiple