\input texinfo @c -*-texinfo-*-
@c %**start of header
@setfilename omk-manual
+@documentencoding UTF-8
@settitle OMK: Ocera Make System
@c %**end of header
@copying
-Manual for Ocera Make System (OMK)
+Manual for Ocera Make System (OMK) version $Id$
-Copyright @copyright{} 2007 Michal Sojka, Pavel Pisa
+Copyright @copyright{} 2007, 2008 Michal Sojka, Pavel Píša
@end copying
@titlepage
@cindex overview
OMK is an advanced make system written entirely in GNU make. Compiling
-software using OMK requires only GNU make binary and standard UNIX
-utilities (@command{sh}, @command{sed}, @command{cmp} and
-@command{tr}@footnote{@command{tr} is needed only for OMK to be
-compatible with MinGW.}) installed. OMK aims to be developer friendly;
-to use OMK, you do not need to understand (sometimes) cryptic syntax of
-Makefiles.
+software using OMK requires only GNU Make and standard UNIX
+utilities (@command{sh}, @command{sed}, @command{cmp}, ...)
+installed. OMK aims to be developer friendly; to use OMK, you do not
+need to understand (sometimes) cryptic syntax of Makefiles.
You can use OMK on all platforms where you can run GNU Make including
Cygwin and MinGW. MS DOS was not tested.
@end itemize
+
+
@node Quick Start, History, Why to Use OMK?, Overview of OMK
@section Quick Start
@enumerate
@item
- Take appropriate @file{Makefile.rules}, put it together with leaf
- @file{Makefile} to the root directory of your project.
+ The newest version of OMK can be found at @uref{http://rtime.felk.cvut.cz/omk/}.
+@item
+ Take appropriate @file{Makefile.rules} (see @ref{Properties of
+ Specific Makefile.rules}), put it together with leaf @file{Makefile}
+ to the root directory of your project.
@item
Create @file{Makefile.omk} files in all directories you want to
compile something. Please refer to @ref{OMK User's Manual} to learn
@node History, , Quick Start, Overview of OMK
@section History
-OMK was originally written by Pavel Pisa as a solution to have one
+OMK was originally written by Pavel Píša as a solution to have one
common make system for OCERA project, where we needed to compile
user-space programs, Linux kernel modules and RT Linux modules in one
package. Although this system was not accepted for the whole OCERA
files). Its syntax is very simple -- see the following sections.
Since make searches by default for a @file{Makefile} and not for
-@file{Makefile.rules} or @file{Makefile.omk}, there must be a small
+@file{Makefile.rules} or @file{Makefile.omk}, there must@footnote{When
+USE_LEAF_MAKEFILES is set to @samp{n}, this @file{Makefile} can be
+omitted in subdirectories. @xref{USE_LEAF_MAKEFILES}.} be a small
generic @file{Makefile} in every directory, whose task is only to find
@file{Makefile.rules} in the actual or any parent directory and include
it. This search is performed only once at the beginning of compilation.
@c TODO: Pavel's note about qmake.
-The compilation process itself is comprised of several passes. Every
+@anchor{passes}
+The compilation process itself is comprised of several @emph{passes}. Every
pass traverses the whole directory structure@footnote{In future, we are
planning some optimization that allows OMK to traverse the directories
only once and thus decrease compilation time.} and does a particular
the libraries should be compiled. In the example below the library
@samp{mylib} (full filename will be @file{libmylib.a}) is created from
two sources @file{funca.c} and @file{funcb.c}. Interface of this library
-is defined in @file{myfunc.h}. Therfore, we export this header for use
+is defined in @file{myfunc.h}. Therefore, we export this header for use
by other programs.
@example
@defvar lib_LIBRARIES
Specifies a list of statically linked libraries to be compiled. OMK
- automaticvally prepends @code{lib} prefix library names.
+ automatically prepends @code{lib} prefix library names.
@end defvar
@defvar shared_LIBRARIES
globally for all people working with the project in
@file{config.target}.
+@menu
+* Specifying Configuration Parameters::
+* Using Configuration Parameters::
+* Common Variables::
+@end menu
+
+@node Specifying Configuration Parameters, Using Configuration Parameters, Configuration and Conditional Compilation, Configuration and Conditional Compilation
@subsection Specifying Configuration Parameters
To specify names and default values of configuration parameters use the
@verbatiminclude ../tests/config/default/config.omk-correct
@end example
+@node Using Configuration Parameters, Common Variables, Specifying Configuration Parameters, Configuration and Conditional Compilation
@subsection Using Configuration Parameters
Configuration parameters can be used in two ways:
possible to include configuration parameters defined in a different
directory.
+@node Common Variables, , Using Configuration Parameters, Configuration and Conditional Compilation
@subsection Common Variables
It is common practice to use @file{config.omk} to store project-wide
In this section we list several OMK features, which are more complicated
or rarely used so they were omitted in previous sections.
+@menu
+* Organization of the Source Tree::
+* Additional Variables::
+* Adding Hooks to Passes::
+@end menu
+
+@node Organization of the Source Tree, Additional Variables, Advanced OMK Features, Advanced OMK Features
+@subsection Organization of the Source Tree
+
@itemize
@item
The @file{_compiled} directory can be shared between multiple projects
top-level @file{Makefile.omk}, adjust @file{Makefile.omk} to contain
only required components and then call @command{make} in the top
directory or even in read-only directories after changing working
- directory from your tree to readonly media.
+ directory from your tree to the readonly media.
@end itemize
(re)compiled, even if @command{make} is called from a subdirectory.
@end defvar
+@node Additional Variables, Adding Hooks to Passes, Organization of the Source Tree, Advanced OMK Features
+@subsection Additional Variables
+
@anchor{USE_LEAF_MAKEFILES}
@defvar USE_LEAF_MAKEFILES
If this variable equals to @samp{n} (default is unset), then OMK uses
directly.
This feature is useful if you are integrating some non-OMK project into
-your project. You only add @file{Makefile.omk} files to the other
+your project. You only add @file{Makefile.omk} files to the non-OMK
project and don't need to modify project's original Makefiles.
This variable can be set either globally in a @file{config.*} file or
@file{Makefile.omk} to tweak compilation for specific targets.
@end defvar
+@node Adding Hooks to Passes, , Additional Variables, Advanced OMK Features
+@subsection Adding Hooks to Passes
+
+Sometimes it is necessary to run some special commands as a part of
+compilation. Typical example might be a tool which generates source
+files on the fly. OMK supports calling additional commands during
+compilation by so called @emph{pass hooks}. A pass hook is an ordinary
+make target which is invoked as part of compilation during a particular
+pass (see @ref{passes}). Pass hooks can be defined by assigning their
+names to @code{xxx_HOOKS} variable.
+
+@defvar{xxx_HOOKS}
+Specifies one or more hooks (make targets) which are invoked during pass
+@var{xxx}. The working directory of commands or this target is under the
+@file{_build} tree.
+
+In the example bellow header file @file{generated_header.h} is created
+during @samp{include-pass} by @file{convert_data} program. The program
+takes @file{data_file.txt} in the source directory as the input and
+creates the header file in the in the correct directory under the
+@file{_build} tree.
+
+@example
+include-pass_HOOKS = generated_header.h
+
+generated_header.h: $(SOURCES_DIR)/data_file.txt
+ convert_data < $^ > $@@
+@end example
+@end defvar
+
@node Properties of Specific Makefile.rules, Running OMK under Windows OS, Advanced OMK Features, OMK User's Manual
@section Properties of Specific Makefile.rules
@subsection Linux
This @file{Makefile.rules} is used not only for Linux as the name
-sugest, but also for other Unices and even for Windows.
+suggests, but also for other Unices and even for Windows.
@defvar BUILD_OS
The name of the operating system (OS) where make was invoked.
used. If not specified manually, it equals to BUILD_OS.
@end defvar
+@defvar QT_SUBDIRS
+ Lists subdirectories with QT project (.pro) file. OMK will generate
+ there @file{Makefile} by calling @command{qmake} with correct
+ parameters to interface QT application to the rest of the compilation
+ tree. Then @command{make} is called there to compile QT
+ application. Variable @samp{QTDIR} must be set to the directory with
+ QT installation (e.g. /usr/share/qt4 on Debian).
+@end defvar
@node System-Less, RTEMS, Linux, Properties of Specific Makefile.rules
@subsection System-Less
+This @file{Makefile.rules} is designed for compilation of code for
+(small) micro-controllers without operating systems. See
+@uref{http://rtime.felk.cvut.cz/hw/index.php/System-Less_Framework} for
+more information about our framework, which uses this rules.
+
@node RTEMS, , System-Less, Properties of Specific Makefile.rules
@subsection RTEMS
+
+TODO
@node Running OMK under Windows OS, Interfacing OMK to popular IDEs, Properties of Specific Makefile.rules, OMK User's Manual
@section Running OMK under Windows OS
+It is possible to use OMK under Windows OS with MinGW (see
+@uref{http://www.mingw.org/}). Unfortunately, the compilation speed is
+much lower than on UNIX systems.
+
+TODO: Is it necessary to install anything special?
+
@node Interfacing OMK to popular IDEs, Troubleshooting, Running OMK under Windows OS, OMK User's Manual
@section Interfacing OMK to popular IDEs
+@menu
+* KDevelop::
+* Eclipse/CDT::
+* Emacs/Vim/etc.::
+@end menu
+
+@node KDevelop, Eclipse/CDT, Interfacing OMK to popular IDEs, Interfacing OMK to popular IDEs
@subsection KDevelop
KDevelop has support for custom build systems. To use KDevelop to
@end example
@end enumerate
-
-@subsection Eclipse
-
+@node Eclipse/CDT, Emacs/Vim/etc., KDevelop, Interfacing OMK to popular IDEs
+@subsection Eclipse/CDT
+TODO
+@node Emacs/Vim/etc., , Eclipse/CDT, Interfacing OMK to popular IDEs
@subsection Emacs, VIM, etc.
Since OMK compilation is started by executing @command{make} command,
Sometimes, you may want to compile one file the same way as OMK does
it, but run the compilation manually from command line. For example,
you want to debug some preprocessor macros and you only want to
- produce preprocessed source instead of object file.
+ produce preprocessed source instead of an object file.
- To compile something manually, you can run OMK with @command{make
+ To compile something manually, you can run OMK by @command{make
V=2}. This will print all commands executed together with directory
navigation messages. Find the command you want to execute manually in
the output. To run it, you need to change the working directory to the
correct one in the @file{_build} tree. The correct directory can be
found in make output on the line @samp{Entering directory} preceding
the desired command.
+
+@item
+ Currently, C++ sources are supposed to have @file{.cc} or @file{.cxx}
+ extensions. The @file{.cpp} extension is not supported (yet).
@end itemize
@node Original README, OMK Development, OMK User's Manual, Top
@item
Make system should allow to freely move cross-dependant components in
directory structure without need to update users of moved component (I
-hate somethink like @option{-I../../sched/rtlshwq/include} in CAN makefiles for
+hate something like @option{-I../../sched/rtlshwq/include} in CAN makefiles for
example. If a component is renamed or version is added to then name,
all Makefiles in CAN will require update).
@item
to link tree pointing into readonly media or can be anywhere
else if @code{MAKERULES_DIR} and @code{SOURCES_DIR} are specified.
-@c !!! tohle tam nejak zmizelo, mozna by to chtelo skontrolovat, ze to
+@c !!! tohle tam nejak zmizelo, mozna by to chtelo zkontrolovat, ze to
@c sedi s aktualnim stavem
I have put together package similar to release. Only ./configure --prefix=...
and make is required. CVS sources contains version 3.81beta1.
You can download prepared sources archive from
- @indicateurl{http://paulandlesley.org/make/make-3.81beta1.tar.bz2}
+ @uref{http://paulandlesley.org/make/make-3.81beta1.tar.bz2}
Or you can get our local copy from
- @indicateurl{http://cmp.felk.cvut.cz/~pisa/can/make-3.81beta1.tar.gz}
+ @uref{http://cmp.felk.cvut.cz/~pisa/can/make-3.81beta1.tar.gz}
The archive contains even "make" binary build by me, which should work
on other Linux distributions as well. Older version of MAKE (3.79.x
The local CTU archive with our CAN components prepared for inclusion
into OCERA SF CVS could be found in my "can" directory
- @indicateurl{http://cmp.felk.cvut.cz/~pisa/can/ocera-can-031212.tar.gz}
+ @uref{http://cmp.felk.cvut.cz/~pisa/can/ocera-can-031212.tar.gz}
The code should build for user-space with new make on most of Linux distros
when make is updated.