]> rtime.felk.cvut.cz Git - omk.git/commitdiff
More documentation and some test to what is written in documentation.
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 21 Oct 2007 10:49:00 +0000 (10:49 +0000)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 21 Oct 2007 10:49:00 +0000 (10:49 +0000)
darcs-hash:20071021104959-f2ef6-49de76246d45a4a42f51f439276affdebe520f38.gz

doc/manual.texinfo
tests/programs/includes/Makefile [new file with mode: 0644]
tests/programs/includes/Makefile.omk [new file with mode: 0644]
tests/programs/includes/inc/mynumber.h [new file with mode: 0644]
tests/programs/includes/runtest [new file with mode: 0755]
tests/programs/includes/test.c [new file with mode: 0644]
tests/programs/runtest-defs [new file with mode: 0755]

index eaa287ed1a84f20fd1b8b1876a60233741516112..a8d4ccf06141fa6bf759004391238b2e8ca52fa4 100644 (file)
@@ -61,6 +61,8 @@ Cygwin and MinGW. MS DOS was not tested.
 @c Cygwin, MS DOS and maybe others.
 @c @end itemize
 
+@section Why to Use OMK?
+
 @section Quick Start
 
 If you get some sources, which are distributed with OMK, usually the
@@ -466,21 +468,84 @@ intermediate compilation products (object files, dependency files etc.).
 @section Dependency Tracking
 
 OMK automatically handles tracking of dependencies of compiled
-projects. It uses gcc's @option{-Mx} options to do this for object
-files. This way, whenever you change some header file, OMK recompiles
-only those files, where the changed header was really included.
+projects. It uses gcc's @option{-M@var{x}} options to do this for
+object files. This way, whenever you change some header file, OMK
+recompiles only those files, where the changed header was really
+included.
 
 Dependencies are also kept for libraries and binaries. OMK parses linker
-map files, so a change to some library causes all programs using this
-library to be recompiled.
+map files, so a change to some library causes recompilation of all
+programs using this library.
 
 @section Compiling Simple Programs
 
+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 a program @command{test} will be compiled from
+source @file{test.c}.
+
+@example
+@verbatiminclude ../tests/programs/Makefile.omk
+@end example
+
+@noindent The variables are:
+
+@defvar bin_PROGRAMS
+Contains a list of names (whitespace separated) of programs to be
+compiled in this directory.
+@end defvar
+
+@defvar @var{program name}_SOURCES
+For every program name in @code{bin_PROGRAMS}, this variable contains a
+list of sources that are needed to compile the executable. OMK uses an
+extension of the filename to determine the compiler to compile this
+source.
+@end defvar
+
+@defvar @var{program name}_LIBS
+This variable contains a list of libraries the program @var{program
+name} needs to be linked to.
+@end defvar
+
+@defvar LOADLIBES
+This variable contains a list of libraries all programs in this
+directory needs to be linked to.
+@end defvar
+
+@defvar INCLUDES
+Directives passed to the C or C++ compiler with additional directories
+to be searched for header files. This variable applies to all
+compilations invoked in the current directory.
+@example
+INCLUDES = -Imy_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.
+
 
 @section Libraries
 
 LN_INCLUDES
 
+@section Multiple Directories
+
+ALL_OMK_SUBDIRS
+SUBDIRS
+
 @node Configuration and Conditional Compilation
 @section Configuration and Conditional Compilation
 
@@ -490,6 +555,8 @@ LN_INCLUDES
 
 Renaming of some file => dependency problems.
 
+Manual compilation ... V=1
+
 
 
 @chapter OMK Reference
diff --git a/tests/programs/includes/Makefile b/tests/programs/includes/Makefile
new file mode 100644 (file)
index 0000000..aa6b442
--- /dev/null
@@ -0,0 +1,16 @@
+# Generic directory or leaf node makefile for OCERA make framework
+
+ifndef MAKERULES_DIR
+MAKERULES_DIR := $(shell ( old_pwd="" ;  while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" == `pwd`  ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) )
+endif
+
+ifeq ($(MAKERULES_DIR),)
+all : default
+.DEFAULT::
+       @echo -e "\nThe Makefile.rules has not been found in this or partent directory\n"
+else   
+include $(MAKERULES_DIR)/Makefile.rules
+endif
+
+print_vars:
+       echo $(COMPILED_DIR)
\ No newline at end of file
diff --git a/tests/programs/includes/Makefile.omk b/tests/programs/includes/Makefile.omk
new file mode 100644 (file)
index 0000000..2d87a10
--- /dev/null
@@ -0,0 +1,5 @@
+bin_PROGRAMS = test
+
+test_SOURCES = test.c
+
+INCLUDES = -I$(SOURCES_DIR)/inc
diff --git a/tests/programs/includes/inc/mynumber.h b/tests/programs/includes/inc/mynumber.h
new file mode 100644 (file)
index 0000000..5ff1730
--- /dev/null
@@ -0,0 +1 @@
+#define NUMBER 456
diff --git a/tests/programs/includes/runtest b/tests/programs/includes/runtest
new file mode 100755 (executable)
index 0000000..81dd9fc
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+touch config.omk-default
+make
diff --git a/tests/programs/includes/test.c b/tests/programs/includes/test.c
new file mode 100644 (file)
index 0000000..03b1a93
--- /dev/null
@@ -0,0 +1,7 @@
+#include <stdio.h>
+#include <mynumber.h>
+int main()
+{
+        printf("NUMBER is %d\n", NUMBER);
+        return 0;
+}
diff --git a/tests/programs/runtest-defs b/tests/programs/runtest-defs
new file mode 100755 (executable)
index 0000000..88a6c68
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+source ../functions.sh
+
+touch config.omk-default
+echo "DEFS=-DNUMBER=123" > config.omk
+make||canttest "Can't compile"
+[ $OMK_RULES != linux ] && canttest "Should work only with Linux rules"
+_compiled/bin/test|grep 123 || error "Variable DEFS didn't influence the output"