]> rtime.felk.cvut.cz Git - omk.git/commitdiff
Generated headers are changed only if neccessary.
authorMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 19 Sep 2007 14:39:00 +0000 (14:39 +0000)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 19 Sep 2007 14:39:00 +0000 (14:39 +0000)
If config.omk is changed, it might cause a need to regenerate
generated config.h files. If the generated file will the same as
before the change (i.e. something elese changed in config.omk), the
real file is not updated and thus other files dependent on it are not
recompiled and recompilation time is shorter.

darcs-hash:20070919143941-f2ef6-7bc594f901ee88adfceba43a0e6b4f18dba61970.gz

snippets/config_h
snippets/gcc
snippets/linux

index 653364f5da4e3c9610b97f4fbddcf0a123864322..39d7818e71be73c0f170745554967a7d27351e73 100644 (file)
@@ -11,8 +11,8 @@
 # Syntax: $(call BUILD_CONFIG_H_template,<header_file_path>,<list_of_options_to_export>,<header_barrier>)
 define BUILD_CONFIG_H_template
 
-$(1) : $(wildcard $(CONFIG_FILE)) $(wildcard $(CONFIG_FILE)-default)
-       @$(QUIET_CMD_ECHO) "  CONFGEN $$(@:$(MAKERULES_DIR)/%=%)"
+$(notdir $(addsuffix .stamp,$(1))) : $(wildcard $(CONFIG_FILE)) $(wildcard $(CONFIG_FILE)-default)
+       @$(QUIET_CMD_ECHO) "  CONFGEN $$(@:%.stamp=%)"
        @if [ ! -d `dirname $(1).tmp` ] ; then \
                mkdir `dirname $(1).tmp` ; fi
        @echo "/* Automatically generated from */" > "$(1).tmp"
@@ -26,9 +26,10 @@ $(1) : $(wildcard $(CONFIG_FILE)) $(wildcard $(CONFIG_FILE)-default)
                sed -n -e 's/^\([^.]*\)\.\(.*\)$$$$/#define \1 \2/p' \
                  >> "$(1).tmp"
        @echo "#endif /*$(3)*/" >> "$(1).tmp"
-       @if cmp --quiet "$(1).tmp" "$(1)" ; then rm "$(1).tmp"; touch "$(1)" ; \
+       @touch "$$@"
+       @if cmp --quiet "$(1).tmp" "$(1)" ; then rm "$(1).tmp"; \
        else mv "$(1).tmp" "$(1)" ; \
-       echo Updated configuration "$(1)" ; fi
+       echo "Updated configuration $(1)" ; fi
 
 endef
 
@@ -48,14 +49,16 @@ $(foreach confh,$(config_include_HEADERS),$(eval $(call BUILD_CONFIG_H_template,
 _$(basename $(notdir $(confh)))_H \
 )))
 
+config_h_stamp_files = $(notdir $(addsuffix .stamp,$(config_include_HEADERS) $(LOCAL_CONFIG_H)))
+
 # Add some hooks to standard passes
-include-pass-local: $(addprefix $(USER_INCLUDE_DIR)/,$(config_include_HEADERS))
+include-pass-local: $(config_h_stamp_files)
 
 clean-local: clean-local-config-h
 
 clean-local-config-h:
-       @$(foreach confh,$(addprefix $(USER_INCLUDE_DIR)/,$(config_include_HEADERS)),\
-           if [ -e $(confh) ] ; then touch -t 200001010101 $(confh) ; fi ; \
+       @$(foreach confh,$(config_h_stamp_files),\
+           if [ -e $(confh) ] ; then rm $(confh) ; fi ; \
        )
 
 
index a296e632eb23d7f1f89f714010072f82c451c5f9..e0f7a39db60b948e411974e5b7e508b9a575f0ff 100644 (file)
@@ -88,7 +88,7 @@ endef # COMPILER_DEFS_template
 
 # Syntax: $(call COMPILE_c_o_template,<source>,<target>,<additional c-flags>)
 define COMPILE_c_o_template
-$(2): $(1) $(LOCAL_CONFIG_H) $$(GEN_HEADERS)
+$(2): $(1) $$(GEN_HEADERS)
        @$(QUIET_CMD_ECHO) "  CC      $$@"
        $(Q) if $$(c_o_COMPILE) $$(CC_DEPFLAGS) $(3) -o $$@ -c $$< ; \
        then mv -f "$$@.d.tmp" "$$@.d" ; \
index 8f6ec0e20f5880f39be230a4535ca6eead7fdf8a..0d3c2848cdd6ff6ebc7650546eb28e48be47662e 100644 (file)
@@ -113,7 +113,7 @@ endif
 
 # Syntax: $(call COMPILE_c_o_template,<source>,<target>,<additional c-flags>)
 define COMPILE_c_o_template
-$(2): $(1) $(LOCAL_CONFIG_H) $$(GEN_HEADERS)
+$(2): $(1) $$(GEN_HEADERS)
        @$(QUIET_CMD_ECHO) "  CC      $$@"
        $(Q) if $$(c_o_COMPILE) $$(CC_DEPFLAGS) $(3) -o $$@ -c $$< ; \
        then mv -f "$$@.d.tmp" "$$@.d" ; \
@@ -124,7 +124,7 @@ endef
 
 # Syntax: $(call COMPILE_cc_o_template,<source>,<target>,<additional c-flags>)
 define COMPILE_cc_o_template
-$(2): $(1) $(LOCAL_CONFIG_H) $$(GEN_HEADERS)
+$(2): $(1) $$(GEN_HEADERS)
        @$(QUIET_CMD_ECHO) "  CXX     $$@"
        $(Q) if $$(cc_o_COMPILE) $$(CC_DEPFLAGS) $(3) -o $$@ -c $$< ; \
        then mv -f "$$@.d.tmp" "$$@.d" ; \
@@ -135,7 +135,7 @@ endef
 
 # Syntax: $(call COMPILE_S_o_template,<source>,<target>,<additional c-flags>)
 define COMPILE_S_o_template
-$(2): $(1) $(LOCAL_CONFIG_H) $$(GEN_HEADERS)
+$(2): $(1) $$(GEN_HEADERS)
         @$(QUIET_CMD_ECHO) "  AS      $$@"
         $(Q) if $$(S_o_COMPILE) -D__ASSEMBLY__ $$(CC_DEPFLAGS) $(3) -o $$@ -c $$< ; \
         then if [ -e "$$@.d.tmp" ] ; then mv -f "$$@.d.tmp" "$$@.d" ; fi ; \
@@ -383,7 +383,7 @@ endif
 
 define COMPILE_c_o_kern_template
 
-$(2): $(1) $(LOCAL_CONFIG_H)
+$(2): $(1)
        @$(QUIET_CMD_ECHO) "  CC [K]  $$@"
        $(Q) if $$(c_o_kern_COMPILE) $$(kern_CC_DEPFLAGS) $(3) $(KERN_KBUILD_MODNAME) \
        -D"KBUILD_BASENAME=$(KERN_MQ)$(notdir $(basename $(1)))$(KERN_MQ)" \