]> rtime.felk.cvut.cz Git - omk.git/commitdiff
Added variable USE_LEAF_MAKEFILES with a testcase and documentation.
authorMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 16 Jan 2008 08:04:00 +0000 (08:04 +0000)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 16 Jan 2008 08:04:00 +0000 (08:04 +0000)
darcs-hash:20080116080424-f2ef6-eeb2b88a857cd92ad46a31d4f03a87897e295a7a.gz

doc/omk-manual.texinfo
snippets/base

index 82f8440a3f7f62b8467f52dad83accbf8eadd9b0..42a3b16dd67ef1dc44b3b82bcdd3ea674ef608b9 100644 (file)
@@ -775,6 +775,23 @@ If this variable equals to @samp{1}, the @b{whole} project is
 (re)compiled, even if @command{make} is called from a subdirectory.
 @end defvar
 
+@anchor{USE_LEAF_MAKEFILES}
+@defvar USE_LEAF_MAKEFILES
+If this variable equals to @samp{n} (default is unset), then OMK uses
+the leaf @file{Makefile} only when it is invoked by simple
+@command{make} command. Later, during recursive directory descent leaf
+@file{Makefile} is not used and @file{Makefile.rules} is included
+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
+project and don't need to modify project's original Makefiles.
+
+This variable can be set either globally in a @file{config.*} file or
+locally in some @file{Makefile.omk}. In the latter case, it influences
+only subdirectories of the directory containing @file{Makefile.omk}.
+@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
index 7d78c5ff37c53b944b3d4a273fed9b77e79e2427..2f0e5cc816474e0ef1565f1da86b2c7349dce309 100644 (file)
@@ -148,6 +148,15 @@ ifneq ($(V),2)
 NO_PRINT_DIRECTORY := --no-print-directory
 endif
 
+ifeq ($(USE_LEAF_MAKEFILES),n)
+export USE_LEAF_MAKEFILES
+SUBDIR_MAKEFILE=$(MAKERULES_DIR)/Makefile.rules
+SOURCESDIR_MAKEFILE=$(MAKERULES_DIR)/Makefile.rules
+else
+SUBDIR_MAKEFILE=$(SOURCES_DIR)/$(dir)/Makefile
+SOURCESDIR_MAKEFILE=$(SOURCES_DIR)/Makefile
+endif
+
 # Syntax: $(call omk_pass_template,<pass name>,<build dir>,[<local make flags>],[<local condition>])
 define omk_pass_template
 .PHNOY: $(1) $(1)-local
@@ -155,12 +164,12 @@ $(1):
        +@$(foreach dir,$(SUBDIRS),$(call mkdir_def,$(2)/$(dir)); \
                $(MAKE) SOURCES_DIR=$(SOURCES_DIR)/$(dir) $(NO_PRINT_DIRECTORY) \
                RELATIVE_DIR=$(RELATIVE_PREFIX)$(dir) -C $(2)/$(dir) \
-               -f $(SOURCES_DIR)/$(dir)/Makefile $$@ || exit 1 ;) true
+               -f $(SUBDIR_MAKEFILE) $$@ || exit 1 ;) true
 ifneq ($(4),)
        @echo "make[omk]: $$@ in $(RELATIVE_DIR)"; \
        $(call mkdir_def,$(2)); \
        $(MAKE) $(NO_PRINT_DIRECTORY) SOURCES_DIR=$(SOURCES_DIR) RELATIVE_DIR=$(RELATIVE_DIR) -C $(2) \
-               -f $(SOURCES_DIR)/Makefile $(3) $$(@:%=%-local)
+               -f $(SOURCESDIR_MAKEFILE) $(3) $$(@:%=%-local)
 endif
 endef