]> rtime.felk.cvut.cz Git - omk.git/blob - snippets/include.omk
include-pass: Move the comment to separate line
[omk.git] / snippets / include.omk
1 # LN_HEADERS       .. if "y", header files are symbolicaly linked instead of copied.
2 ifeq ($(OMK_VERBOSE),1)
3 CPHEADER_FLAGS += -v
4 LNHEADER_FLAGS += -v
5 endif
6
7 ifneq ($(LN_HEADERS),y)
8 define cp_cmd
9 echo "  CP      $(1:$(OUTPUT_DIR)/%=%) -> $(2:$(OUTPUT_DIR)/%=%)"; install -C -D $(CPHEADER_FLAGS) $(1) $(2) || exit 1
10 endef
11 else
12 define cp_cmd
13 echo "  LN      $(1:$(OUTPUT_DIR)/%=%) -> $(2:$(OUTPUT_DIR)/%=%)"; if [ -f $(1) ]; then ln -sf $(LNHEADER_FLAGS) $(1) $(2) || exit 1; else exit 1; fi
14 endef
15 endif
16
17 # TODO: Check modification date of changed header files. If it is
18 # newer that in source dir, show a warning.
19
20 # Syntax: $(call include-pass-template,<include dir>,<keyword>)
21 define include-pass-template
22 include-pass-local: include-pass-local-$(2)
23 include-pass-local-$(2): $$($(2)_GEN_HEADERS) $$(foreach f,$$(renamed_$(2)_GEN_HEADERS),$$(shell echo '$$(f)' | sed -e 's/^\(.*\)->.*$$$$/\1/'))
24         @$$(foreach f, $$($(2)_HEADERS),$$(call cp_cmd,$$(SOURCES_DIR)/$$(f),$(1)/$$(notdir $$(f))); )
25 # FIXME: Use correct build dir, then document it (in the line bellow)
26         @$$(foreach f, $$($(2)_GEN_HEADERS),$$(call cp_cmd,$$(LOCAL_BUILD_DIR)/$$(f),$(1)/$$(notdir $$(f))); )
27         @$$(foreach f, $$(nobase_$(2)_HEADERS),if mkdir -p $(1)/$$(dir $$(f)); then $$(call cp_cmd,$$(SOURCES_DIR)/$$(f),$(1)/$$(f)); fi; )
28         @$$(foreach f, $$(renamed_$(2)_HEADERS), \
29            srcfname=`echo '$$(f)' | sed -e 's/^\(.*\)->.*$$$$/\1/'` ; destfname=`echo '$$(f)' | sed -e 's/^.*->\(.*\)$$$$/\1/'` ; \
30            if mkdir -p `dirname $(1)/$$$${destfname}`; then $$(call cp_cmd,$$(SOURCES_DIR)/$$$${srcfname},$(1)/$$$${destfname}); fi; )
31         @$$(foreach f, $$(renamed_$(2)_GEN_HEADERS), \
32            srcfname=`echo '$$(f)' | sed -e 's/^\(.*\)->.*$$$$/\1/'` ; destfname=`echo '$$(f)' | sed -e 's/^.*->\(.*\)$$$$/\1/'` ; \
33            if mkdir -p `dirname $(1)/$$$${destfname}`; then  $$(call cp_cmd,$$(LOCAL_BUILD_DIR)/$$$${srcfname},$(1)/$$$${destfname}); fi; )
34 # Suppress "Nothing to be done for `include-pass-local'" message if no headers are defined in Makefile.omk
35         @$$(if $$($(2)_HEADERS)$$($(2)_GEN_HEADERS)$$(nobase_$(2)_HEADERS)$$(renamed_$(2)_HEADERS)$$(renamed_$(2)_GEN_HEADERS),,true)
36 endef