]> rtime.felk.cvut.cz Git - omk.git/blobdiff - snippets/rtems
Generated headers are changed only if neccessary.
[omk.git] / snippets / rtems
index 6df70770d9b801eabedb14afe41cef2aa361fd81..c1005c3d1b35f2d893970bfa2657ba1a5f2b3100 100644 (file)
@@ -50,13 +50,15 @@ srcdir = $(SOURCES_DIR)
 
 USER_OBJS_DIR = $(USER_BUILD_DIR)/$(RELATIVE_DIR)
 
+.PHONY: check-dir
+
 # Some support to serialize some targets for parallel make
 ifneq ($(OMK_SERIALIZE_INCLUDED),y)
-include-pass: $(check-dir)
+include-pass: check-dir
 library-pass: include-pass
-binary-pass utils-pass: library-pass
+binary-pass: library-pass
 
-OMK_SERIALIZE_INCLUDED = y
+override OMK_SERIALIZE_INCLUDED = y
 endif
 
 #=====================================================================
@@ -184,6 +186,7 @@ $(2)/$(1): $$($(1)_OBJS)
 #@sed -n -e 's/^LOAD \(.*\)$$$$/  \1  \\/p' $(USER_OBJS_DIR)/$(1).exe.map  >>$(USER_OBJS_DIR)/$(1).exe.d
 #@echo >>$(USER_OBJS_DIR)/$(1).exe.d
 #-Wl,-Map,$(USER_OBJS_DIR)/$(1).exe.map
+# FIXME: Why the map file was commented out?
 endef
 
 
@@ -232,9 +235,7 @@ endef
 library-pass-local: $(addprefix $(USER_INCLUDE_DIR)/,$(cmetric_include_HEADERS)) \
                    $(lib_LIBRARIES:%=$(USER_LIB_DIR)/lib%.a) $(shared_LIBRARIES:%=$(USER_LIB_DIR)/lib%.so)
 
-binary-pass-local: $(bin_PROGRAMS:%=$(USER_BIN_DIR)/%)
-
-utils-pass-local: $(utils_PROGRAMS:%=$(USER_UTILS_DIR)/%)
+binary-pass-local: $(bin_PROGRAMS:%=$(USER_BIN_DIR)/%) $(utils_PROGRAMS:%=$(USER_UTILS_DIR)/%)
 
 # Special rules for CMETRIC generated headers
 
@@ -264,12 +265,11 @@ endif
 #=====================================================================
 
 
-$(eval $(call omk_pass_template, include-pass,$(USER_OBJS_DIR),,-n "$(include_HEADERS)$(nobase_include_HEADERS)$(renamed_include_HEADERS)"))
-$(eval $(call omk_pass_template, library-pass,$(USER_OBJS_DIR),USER_RULE_TEMPLATES=y,-n "$(lib_LIBRARIES)$(shared_LIBRARIES)"))
-$(eval $(call omk_pass_template, utils-pass,  $(USER_OBJS_DIR),USER_RULE_TEMPLATES=y,-n "$(utils_PROGRAMS)"))
-$(eval $(call omk_pass_template, binary-pass, $(USER_OBJS_DIR),USER_RULE_TEMPLATES=y,-n "$(bin_PROGRAMS)"))
+$(eval $(call omk_pass_template, include-pass,$(USER_OBJS_DIR),,$(include_HEADERS)$(nobase_include_HEADERS)$(renamed_include_HEADERS)$(config_include_HEADERS)))
+$(eval $(call omk_pass_template, library-pass,$(USER_OBJS_DIR),USER_RULE_TEMPLATES=y,$(lib_LIBRARIES)$(shared_LIBRARIES)))
+$(eval $(call omk_pass_template, binary-pass, $(USER_OBJS_DIR),USER_RULE_TEMPLATES=y,$(bin_PROGRAMS)$(utils_PROGRAMS)))
 
-$(eval $(call omk_pass_template,clean,$(USER_OBJS_DIR)))
+$(eval $(call omk_pass_template,clean,$(USER_OBJS_DIR),,always))
 
 check-dir:
        @$(call mkdir_def,$(USER_INCLUDE_DIR))
@@ -277,24 +277,8 @@ check-dir:
        @$(call mkdir_def,$(USER_BIN_DIR))
        @$(call mkdir_def,$(USER_UTILS_DIR))
 
-# Create directories only for the first time
-ifndef CHECK_DIR_DONE
-check-dir = check-dir
-CHECK_DIR_DONE = y
-endif
-export CHECK_DIR_DONE
-
-
 include-pass-local:
-       @$(call mkdir_def,$(USER_INCLUDE_DIR))
-       @$(foreach f, $(include_HEADERS), cmp --quiet $(SOURCES_DIR)/$(f) $(USER_INCLUDE_DIR)/$(notdir $(f)) \
-          || cp $(CPHEADER_FLAGS) $(SOURCES_DIR)/$(f) $(USER_INCLUDE_DIR)/$(notdir $(f)) || exit 1 ; )
-       @$(foreach f, $(nobase_include_HEADERS), cmp --quiet $(SOURCES_DIR)/$(f) $(USER_INCLUDE_DIR)/$(f) \
-          || ( mkdir -p $(USER_INCLUDE_DIR)/$(dir $(f)) && cp $(CPHEADER_FLAGS) $(SOURCES_DIR)/$(f) $(USER_INCLUDE_DIR)/$(f) ) || exit 1 ; )
-       @$(foreach f, $(renamed_include_HEADERS), \
-          srcfname=`echo '$(f)' | sed -e 's/^\(.*\)->.*$$/\1/'` ; destfname=`echo '$(f)' | sed -e 's/^.*->\(.*\)$$/\1/'` ; \
-          cmp --quiet $(SOURCES_DIR)/$${srcfname} $(USER_INCLUDE_DIR)/$${destfname} \
-          || ( mkdir -p `dirname $(USER_INCLUDE_DIR)/$${destfname}` && cp $(CPHEADER_FLAGS) $(SOURCES_DIR)/$${srcfname} $(USER_INCLUDE_DIR)/$${destfname} ) || exit 1 ; )
+       $(call include-pass-template,$(USER_INCLUDE_DIR),include)
 
 ifdef USER_RULE_TEMPLATES
 
@@ -340,7 +324,7 @@ clean-local:
               $(tar_EMBEDFILES:%=$(USER_OBJS_DIR)/%_tarfile)
 
 
-default: $(check-dir) include-pass library-pass binary-pass utils-pass
+default: include-pass library-pass binary-pass
 
 # Local Variables:
 # mode:makefile