Compilation is invoked in these directories before it is invoked in
the current directory.
+
+ See also @ref{AUTOMATIC_SUBDIRS}.
@end defvar
@c TODO: Write tests for this.
+@anchor{ALL_OMK_SUBDIRS}
@defvar ALL_OMK_SUBDIRS
This variable is set by OMK and can be used as the value of
@code{SUBDIRS} variable. It contains a list of all direct
@end example
@end defvar
+@anchor{AUTOMATIC_SUBDIRS}
+@defvar AUTOMATIC_SUBDIRS
+ If this variable is set to @samp{y} and @code{SUBDIRS} is not assigned
+ in @file{Makefile.omk}, then @code{SUBDIRS} is assigned a default
+ value @code{$(ALL_OMK_SUBDIRS)}.
+@end defvar
+
@node Dependency Tracking, Configuration and Conditional Compilation, Multiple Directories, OMK User's Manual
@section Dependency Tracking
# real OCERA style Makefile.omk now
ifndef OMK_INCLUDED
include $(SOURCES_DIR)/$(MAKEFILE_OMK)
+ifeq ($(AUTOMATIC_SUBDIRS),y)
+SUBDIRS?=$(ALL_OMK_SUBDIRS)
+endif
OMK_INCLUDED := 1
endif
--- /dev/null
+# 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
+
--- /dev/null
+AUTOMATIC_SUBDIRS=y
--- /dev/null
+# 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
+
--- /dev/null
+$(warning make-in-dir1)
--- /dev/null
+# 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
+
--- /dev/null
+$(warning make-in-dir2)
\ No newline at end of file
--- /dev/null
+$(warning make-in-dir3)
--- /dev/null
+#!/bin/sh
+
+source ../functions.sh
+
+touch config.omk-default
+
+OUTPUT=$(make 2>&1) || canttest
+echo $OUTPUT | grep make-in-dir1 || error "Make was not called in dir1"
+echo $OUTPUT | grep make-in-dir2 || error "Make was not called in dir2"
+echo $OUTPUT | grep make-in-dir3 && error "Make shouldn't be called in dir3"
+
+exit 0