]> rtime.felk.cvut.cz Git - omk.git/commitdiff
Config header files stamps in targets are defined with full path now.
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Wed, 19 Sep 2007 23:09:00 +0000 (23:09 +0000)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Wed, 19 Sep 2007 23:09:00 +0000 (23:09 +0000)
darcs-hash:20070919230955-ff715-4c87ba13669417ac0123650817eeea32f9d28abe.gz

snippets/config_h

index 39d7818e71be73c0f170745554967a7d27351e73..6f23528985776dd780bd4387ecd8b4457ecd758b 100644 (file)
@@ -8,28 +8,28 @@
 #                    command, so it is possible to document config
 #                    variables.
 
-# Syntax: $(call BUILD_CONFIG_H_template,<header_file_path>,<list_of_options_to_export>,<header_barrier>)
+# Syntax: $(call BUILD_CONFIG_H_template,<stamp_dir>,<header_file_path>,<list_of_options_to_export>,<header_barrier>)
 define BUILD_CONFIG_H_template
 
-$(notdir $(addsuffix .stamp,$(1))) : $(wildcard $(CONFIG_FILE)) $(wildcard $(CONFIG_FILE)-default)
+$(addprefix $(1)/,$(notdir $(addsuffix .stamp,$(2)))) : $(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"
-       @echo "/* config file: $$< */" >> "$(1).tmp"
-       $(if $(DOXYGEN),@echo "/** @file */" >> "$(1).tmp")
-       @echo "#ifndef $(3)" >> "$(1).tmp"
-       @echo "#define $(3)" >> "$(1).tmp"
-       @( $(foreach x, $(shell echo '$($(2))' | sed -e 's/[ \t]/\n/g' | sed -e 's/^\([^ =]*\)\(=[^ ]\+\|\)$$/\1/' ), \
+       @if [ ! -d `dirname $(2).tmp` ] ; then \
+               mkdir -p `dirname $(2).tmp` ; fi
+       @echo "/* Automatically generated from */" > "$(2).tmp"
+       @echo "/* config file: $$< */" >> "$(2).tmp"
+       $(if $(DOXYGEN),@echo "/** @file */" >> "$(2).tmp")
+       @echo "#ifndef $(4)" >> "$(2).tmp"
+       @echo "#define $(4)" >> "$(2).tmp"
+       @( $(foreach x, $(shell echo '$($(3))' | sed -e 's/[ \t]/\n/g' | sed -e 's/^\([^ =]*\)\(=[^ ]\+\|\)$$/\1/' ), \
                echo '$(x).$($(x))' ; ) echo ; ) | \
                sed -e '/^[^.]*\.n$$$$/d' -e '/^[^.]*\.$$$$/d' -e 's/^\([^.]*\)\.[ym]$$$$/\1.1/' | \
                sed -n -e 's/^\([^.]*\)\.\(.*\)$$$$/#define \1 \2/p' \
-                 >> "$(1).tmp"
-       @echo "#endif /*$(3)*/" >> "$(1).tmp"
+                 >> "$(2).tmp"
+       @echo "#endif /*$(4)*/" >> "$(2).tmp"
        @touch "$$@"
-       @if cmp --quiet "$(1).tmp" "$(1)" ; then rm "$(1).tmp"; \
-       else mv "$(1).tmp" "$(1)" ; \
-       echo "Updated configuration $(1)" ; fi
+       @if cmp --quiet "$(2).tmp" "$(2)" ; then rm "$(2).tmp"; \
+       else mv "$(2).tmp" "$(2)" ; \
+       echo "Updated configuration $(2)" ; fi
 
 endef
 
@@ -38,18 +38,18 @@ ifdef LOCAL_CONFIG_H
 # This must be declared after the default cflags are assigned!
 # Override is used to override command line assignemnt.
 override CFLAGS += -I.
-$(eval $(call BUILD_CONFIG_H_template,$(LOCAL_CONFIG_H),default_CONFIG,_LOCAL_CONFIG_H) )
+$(eval $(call BUILD_CONFIG_H_template,$(USER_OBJS_DIR),$(USER_OBJS_DIR)/$(LOCAL_CONFIG_H),default_CONFIG,_LOCAL_CONFIG_H) )
 
 endif
 
 # Special rules for configuration exported headers
 
 #FIXME: The directory for headers should not be specified here.
-$(foreach confh,$(config_include_HEADERS),$(eval $(call BUILD_CONFIG_H_template,$(addprefix $(USER_INCLUDE_DIR)/,$(confh)),$(basename $(notdir $(confh)))_DEFINES,\
+$(foreach confh,$(config_include_HEADERS),$(eval $(call BUILD_CONFIG_H_template,$(USER_OBJS_DIR),$(addprefix $(USER_INCLUDE_DIR)/,$(confh)),$(basename $(notdir $(confh)))_DEFINES,\
 _$(basename $(notdir $(confh)))_H \
 )))
 
-config_h_stamp_files = $(notdir $(addsuffix .stamp,$(config_include_HEADERS) $(LOCAL_CONFIG_H)))
+config_h_stamp_files = $(addprefix $(USER_OBJS_DIR)/,$(notdir $(addsuffix .stamp,$(config_include_HEADERS) $(LOCAL_CONFIG_H))))
 
 # Add some hooks to standard passes
 include-pass-local: $(config_h_stamp_files)