]> rtime.felk.cvut.cz Git - omk.git/blobdiff - snippets/base.omk
Adaptation for AQuoSA
[omk.git] / snippets / base.omk
index 956576fae042dece2b68e792cf91a1b21e5a78b4..f7337e59936906fdbca6858792d1180ec241f854 100644 (file)
@@ -6,6 +6,10 @@
 #  Homepage: http://rtime.felk.cvut.cz/omk/
 #  Version:  @git-describe@
 #
+#  Adapted by Tommaso Cucinotta, Scuola Superiore Sant'Anna, Pisa, Italy, for the
+#  Project Adaptive Quality of Service Architecture (AQuoSA)
+#  More information at: http://aquosa.sourceforge.net
+#
 # The OMK build system is distributed under the GNU General Public
 # License.  See file COPYING for details.
 #
 # V                .. if set to 1, full command text is shown else short form is used
 # W                .. whole tree - if set to 1, make is always called from the top-level directory
 # SUBDIRS          .. list of subdirectories intended for make from actual directory
+# kernel_SUBDIRS   .. subdirectories within which to propagate kernel targets
+# library_SUBDIRS  .. list of subdirectories within which to propagate library targets
+# include_SUBDIRS  .. list of subdirectories within which to propagate include pass (defaults to kernel_SUBDIRS + library_SUBDIRS)
+# binary_SUBDIRS   .. list of subdirectories within which to propagate binary targets
+# docs_SUBDIRS     .. list of subdirectories within which to propagate docs target
+# clean_SUBDIRS    .. list of subdirectories within which to propagate clean targets
 # default_CONFIG   .. list of default config assignments CONFIG_XXX=y/n ...
 
 # We need to ensure definition of sources directory first
@@ -22,6 +32,8 @@ ifndef SOURCES_DIR
 SOURCES_DIR := $(shell ( pwd -L ) )
 endif
 
+include $(MAKERULES_DIR)/variables.mk
+
 # If we are not called by OMK leaf Makefile...
 ifndef MAKERULES_DIR
 MAKERULES_DIR := $(abspath $(dir $(filter %Makefile.rules,$(MAKEFILE_LIST))))
@@ -78,12 +90,13 @@ endif
 ifneq ($(wildcard $(CONFIG_FILE)-default),)
 -include $(CONFIG_FILE)-default
 else
-ifneq ($(MAKECMDGOALS),default-config)
-$(warning Please, run "make default-config" first)
-endif
+#ifneq ($(MAKECMDGOALS),default-config)
+#$(warning Please, run "make default-config" first)
+#endif
 endif
 
 -include $(OUTPUT_DIR)/config.target
+-include $(MAKERULES_DIR)/variables.mk
 
 ifneq ($(wildcard $(CONFIG_FILE)),)
 -include $(CONFIG_FILE)
@@ -92,7 +105,7 @@ endif
 endif #$(CONFIG_FILE_OK)
 
 
-CONFIG_FILES ?= $(wildcard $(CONFIG_FILE)-default) $(wildcard $(OUTPUT_DIR)/config.target) $(wildcard $(CONFIG_FILE))
+CONFIG_FILES ?= $(wildcard $(CONFIG_FILE)-default) $(wildcard $(OUTPUT_DIR)/config.target) $(wildcard $(CONFIG_FILE)) $(wildcard $(MAKERULES_DIR)/variables.mk)
 
 
 export SOURCES_DIR MAKERULES_DIR RELATIVE_DIR
@@ -162,6 +175,9 @@ endif
 OMK_INCLUDED := 1
 endif
 
+all_SUBDIRS=$(kernel_SUBDIRS) $(library_SUBDIRS) $(binary_SUBDIRS) $(docs_SUBDIRS) $(clean_SUBDIRS) $(include_SUBDIRS) $(QT_SUBDIRS)
+include_SUBDIRS+=$(kernel_SUBDIRS) $(library_SUBDIRS)
+
 check-make-ver:
        @GOOD_MAKE_VERSION=`echo $(MAKE_VERSION) | sed -n -e 's/^[4-9]\..*\|^3\.9[0-9].*\|^3\.8[1-9].*/y/p'` ; \
        if [ x$$GOOD_MAKE_VERSION != xy ] ; then \
@@ -171,7 +187,7 @@ check-make-ver:
 
 distclean dist-clean:
        @$(QUIET_CMD_ECHO) "  RM      $(COMPILED_DIR_NAME) $(BUILD_DIR_NAME)"
-       @rm -fr $(OUTPUT_DIR)/$(COMPILED_DIR_NAME)  $(OUTPUT_DIR)/$(BUILD_DIR_NAME)
+       @rm -fr $(OUTPUT_DIR)/$(COMPILED_DIR_NAME)  $(OUTPUT_DIR)/$(BUILD_DIR_NAME) autom4te.cache config.log config.log config.status
 
 # Common OMK templates
 # ====================
@@ -228,10 +244,13 @@ extra-rules-subdirs:
 
 $(foreach subdir,$(EXTRA_RULES_SUBDIRS),$(eval $(call extra_rules_subdir_template,$(subdir))))
 
-# Usage: $(call omk_pass_template,<pass name>,<build dir>,[<local make flags>],[<local enable condition>])
+# Usage: $(call omk_pass_template,<pass name>,<build dir>,[<local make flags>],[<local enable condition>],[<pass directories>])
 define omk_pass_template
 .PHONY: $(pass) $(pass)-local $(pass)-check $(pass)-submakes
-$(foreach subdir,$(SUBDIRS),$(eval $(call omk_pass_subdir_template,$(pass),$(2),$(subdir))))
+# Produce in SUBDIRS_NODUPS a set of directories without duplicates
+SUBDIRS_NODUPS:=
+$(foreach x,$(SUBDIRS) $(5),$(eval SUBDIRS_NODUPS:=$(SUBDIRS_NODUPS:$(x)=) $(x)))
+$(foreach subdir,$(SUBDIRS_NODUPS),$(eval $(call omk_pass_subdir_template,$(pass),$(2),$(subdir))))
 $(pass):
 # Submakes have to be called this way and not as dependecies for pass
 # serialization to work
@@ -243,7 +262,7 @@ $(pass)-submakes:
 
 ifneq ($(4)$($(pass)_HOOKS),)
 $(pass)-submakes: $(pass)-this-dir
-$(pass)-this-dir: $(foreach subdir,$(SUBDIRS),$(pass)-$(subdir)-subdir)
+$(pass)-this-dir: $(foreach subdir,$(SUBDIRS_NODUPS),$(pass)-$(subdir)-subdir)
        +@echo "make[omk]: $(pass) in $(RELATIVE_DIR)"
        @$(call mkdir_def,$(2))
        +@$(MAKE) $(NO_PRINT_DIRECTORY) SOURCES_DIR=$(SOURCES_DIR) RELATIVE_DIR=$(RELATIVE_DIR) -C $(2) \
@@ -264,7 +283,7 @@ default-config:
                RELATIVE_DIR="" SOURCES_DIR=$(OUTPUT_DIR) \
                -f $(OUTPUT_DIR)/Makefile default-config-pass
 
-$(eval $(call omk_pass_template,default-config-pass,$$(LOCAL_BUILD_DIR),,always))
+$(eval $(call omk_pass_template,default-config-pass,$$(LOCAL_BUILD_DIR),,always,))
 
 default-config-pass-local:
 #      @echo Default config for $(RELATIVE_DIR)