2 # Rules that creates the list of files which are used during
3 # compilation. The list reflects conditional compilation depending on
4 # config.omk and other variables.
6 SOURCES_LIST_FN=sources.txt
8 SOURCES_LIST_DIR:=$(RELATIVE_DIR)
9 SOURCES_LIST:=$(MAKERULES_DIR)/$(SOURCES_LIST_DIR)/$(SOURCES_LIST_FN)
10 export SOURCES_LIST SOURCES_LIST_DIR
13 ifeq ($(MAKECMDGOALS),sources-list)
16 ifeq ($(MAKECMDGOALS),TAGS)
19 ifeq ($(MAKECMDGOALS),tags)
23 ifeq ($(NEED_SOURCES_LIST),y) # avoid execution of find command bellow if it is not useful
25 sources-list: $(SOURCES_LIST)
27 $(SOURCES_LIST): $(CONFIG_FILE) $(CONFIG_FILE)-default $(shell find -name Makefile.omk)
28 @echo -n "" > "$(SOURCES_LIST).tmp"
29 @$(MAKE) --no-print-directory sources-list-pass
30 @echo "# Automatically generated list of files in '$(RELATIVE_DIR)' that are used during OMK compilation" > "$(SOURCES_LIST).tmp2"
31 @cat "$(SOURCES_LIST).tmp"|sort|uniq >> "$(SOURCES_LIST).tmp2"
32 @rm "$(SOURCES_LIST).tmp"
33 @mv "$(SOURCES_LIST).tmp2" "$(SOURCES_LIST)"
36 $(eval $(call omk_pass_template,sources-list-pass,$$(LOCAL_BUILD_DIR)))
38 sources-list-pass-local:
39 @$(foreach h,$(include_HEADERS) $(nobase_include_HEADERS) $(kernel_HEADERS),\
40 echo "$(RELATIVE_DIR:$(SOURCES_LIST_DIR)/%=%)/$(h)" >> "$(SOURCES_LIST).tmp";)
41 @$(foreach h,$(renamed_include_HEADERS),echo "$(RELATIVE_DIR:$(SOURCES_LIST_DIR)/%=%)/$(h)"|sed -e 's/\(.*\)->.*/\1/' >> "$(SOURCES_LIST).tmp";)
42 @$(foreach bin,$(lib_LIBRARIES) $(shared_LIBRARIES) $(bin_PROGRAMS) $(utils_PROGRAMS) \
43 $(kernel_LIBRARIES) $(rtlinux_LIBRARIES) $(kernel_MODULES),\
44 $(foreach src,$(filter-out %.o,$($(bin)_SOURCES)),echo "$(RELATIVE_DIR:$(SOURCES_LIST_DIR)/%=%)/$(src)" >> "$(SOURCES_LIST).tmp";))
46 ############ TAGS ###########
48 ifeq ($(MAKECMDGOALS),TAGS)
51 ifeq ($(MAKECMDGOALS),tags)
56 tags TAGS: $(SOURCES_LIST)
57 @$(MAKE) --no-print-directory do-tags
59 ifeq ($(MAKECMDGOALS),do-tags)
61 do-tags: $(shell sed -e '/^\#/d' $(SOURCES_LIST))
62 @$(QUIET_CMD_ECHO) " TAGS $(SOURCES_LIST_FN)"