X-Git-Url: http://rtime.felk.cvut.cz/gitweb/omk.git/blobdiff_plain/c303cfe401910ca25583f012eb7bc885ea691ced..95fb6899d3ff6c15077a524d355fa13b0ccac504:/snippets/sources-list diff --git a/snippets/sources-list b/snippets/sources-list index 84d1109..95e4ffc 100644 --- a/snippets/sources-list +++ b/snippets/sources-list @@ -6,8 +6,9 @@ SOURCES_LIST_FN=sources.txt ifndef SOURCES_LIST SOURCES_LIST_DIR:=$(RELATIVE_DIR) -SOURCES_LIST:=$(MAKERULES_DIR)/$(SOURCES_LIST_DIR)/$(SOURCES_LIST_FN) -export SOURCES_LIST SOURCES_LIST_DIR +SOURCES_LIST:=$(OUTPUT_DIR)/$(SOURCES_LIST_DIR)/$(SOURCES_LIST_FN) +SOURCES_LIST_D := $(LOCAL_BUILD_DIR)/$(SOURCES_LIST_FN).d +export SOURCES_LIST SOURCES_LIST_DIR SOURCES_LIST_D endif ifeq ($(MAKECMDGOALS),sources-list) @@ -24,38 +25,50 @@ ifeq ($(NEED_SOURCES_LIST),y) # avoid execution of find command bellow if it is .PHONY: sources-list sources-list: $(SOURCES_LIST) -$(SOURCES_LIST): $(CONFIG_FILE) $(CONFIG_FILE)-default $(shell find -name Makefile.omk) +$(SOURCES_LIST): $(CONFIG_FILES) $(shell find -name $(MAKEFILE_OMK)) @echo -n "" > "$(SOURCES_LIST).tmp" + @echo -n "" > "$(SOURCES_LIST_D).tmp" @$(MAKE) --no-print-directory sources-list-pass @echo "# Automatically generated list of files in '$(RELATIVE_DIR)' that are used during OMK compilation" > "$(SOURCES_LIST).tmp2" @cat "$(SOURCES_LIST).tmp"|sort|uniq >> "$(SOURCES_LIST).tmp2" @rm "$(SOURCES_LIST).tmp" @mv "$(SOURCES_LIST).tmp2" "$(SOURCES_LIST)" + @echo "$(SOURCES_LIST): \\" > "$(SOURCES_LIST_D).tmp2" + @cat "$(SOURCES_LIST_D).tmp"|grep -v "$(SOURCES_LIST_D).tmp"|sort|uniq|\ + sed -e 's/$$/\\/' >> "$(SOURCES_LIST_D).tmp2" + @rm "$(SOURCES_LIST_D).tmp" + @mv "$(SOURCES_LIST_D).tmp2" "$(SOURCES_LIST_D)" endif -$(eval $(call omk_pass_template,sources-list-pass,$$(LOCAL_BUILD_DIR))) +$(eval $(call omk_pass_template,sources-list-pass,$$(LOCAL_BUILD_DIR),,always)) sources-list-pass-local: + @$(foreach m,$(MAKEFILE_LIST),echo ' $(m)' >> "$(SOURCES_LIST_D).tmp";) @$(foreach h,$(include_HEADERS) $(nobase_include_HEADERS) $(kernel_HEADERS),\ echo "$(RELATIVE_DIR:$(SOURCES_LIST_DIR)/%=%)/$(h)" >> "$(SOURCES_LIST).tmp";) - @$(foreach h,$(renamed_include_HEADERS),echo "$(RELATIVE_DIR:$(SOURCES_LIST_DIR)/%=%)/$(h)"|sed -e 's/\(.*\)->.*/\1/' >> "$(SOURCES_LIST).tmp";) - @$(foreach bin,$(lib_LIBRARIES) $(shared_LIBRARIES) $(bin_PROGRAMS) $(utils_PROGRAMS) \ + @$(foreach ch,$(config_include_HEADERS), \ + echo "$(USER_INCLUDE_DIR:$(OUTPUT_DIR)/$(addsuffix /,$(SOURCES_LIST_DIR))%=%)/$(ch)" >> "$(SOURCES_LIST).tmp";) + @$(foreach h,$(renamed_include_HEADERS),echo '$(h)'|sed -e 's/\(.*\)->.*/$(RELATIVE_DIR:$(SOURCES_LIST_DIR)/%=%)\1/' >> "$(SOURCES_LIST).tmp";) + @$(foreach bin,$(lib_LIBRARIES) $(shared_LIBRARIES) $(bin_PROGRAMS) $(test_PROGRAMS) $(utils_PROGRAMS) \ $(kernel_LIBRARIES) $(rtlinux_LIBRARIES) $(kernel_MODULES),\ - $(foreach src,$(filter-out %.o,$($(bin)_SOURCES)),echo "$(RELATIVE_DIR:$(SOURCES_LIST_DIR)/%=%)/$(src)" >> "$(SOURCES_LIST).tmp";)) + $(foreach src,$(filter-out %.o,$($(bin)_SOURCES)),echo "$(addsuffix /,$(RELATIVE_DIR:$(SOURCES_LIST_DIR)/%=%))$(src)" >> "$(SOURCES_LIST).tmp";)) ############ TAGS ########### ifeq ($(MAKECMDGOALS),TAGS) -TAGS_CMD = etags +ETAGS=etags +TAGS_CMD = $(ETAGS) +TAGS: $(SOURCES_LIST) + @$(MAKE) --no-print-directory do-tags endif ifeq ($(MAKECMDGOALS),tags) -TAGS_CMD = ctags +CTAGS=ctags -N +TAGS_CMD = $(CTAGS) +tags: $(SOURCES_LIST) + @$(MAKE) --no-print-directory do-tags endif export TAGS_CMD -tags TAGS: $(SOURCES_LIST) - @$(MAKE) --no-print-directory do-tags - ifeq ($(MAKECMDGOALS),do-tags) .PHONY: do-tags do-tags: $(shell sed -e '/^\#/d' $(SOURCES_LIST)) @@ -63,6 +76,13 @@ do-tags: $(shell sed -e '/^\#/d' $(SOURCES_LIST)) $(Q)$(TAGS_CMD) $^ endif +############ CSCOPE ########### + +cscope: $(SOURCES_LIST) + @$(QUIET_CMD_ECHO) " CSCOPE < $(SOURCES_LIST_FN)" + $(Q)sed -e '/^#/d' $(SOURCES_LIST)|cscope -b -i- +#FIXME: see doc to -i in cscope(1) + # Local Variables: # mode:makefile # End: