New upstream version 18.02
[deb_dpdk.git] / mk / internal / rte.install-post.mk
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2010-2014 Intel Corporation
3
4 # install helper .mk
5
6 #
7 # generate rules to install files in RTE_OUTPUT.
8 #
9 # arg1: relative install dir in RTE_OUTPUT
10 # arg2: relative file name in a source dir (VPATH)
11 #
12 define install_rule
13 $(addprefix $(RTE_OUTPUT)/$(1)/,$(notdir $(2))): $(2)
14         @echo "  INSTALL-FILE $(addprefix $(1)/,$(notdir $(2)))"
15         @[ -d $(RTE_OUTPUT)/$(1) ] || mkdir -p $(RTE_OUTPUT)/$(1)
16         $(Q)cp -rf $$(<) $(RTE_OUTPUT)/$(1)
17 endef
18
19 $(foreach dir,$(INSTALL-DIRS-y),\
20         $(foreach file,$(INSTALL-y-$(dir)),\
21                 $(eval $(call install_rule,$(dir),$(file)))))
22
23
24 #
25 # generate rules to install symbolic links of files in RTE_OUTPUT.
26 #
27 # arg1: relative install dir in RTE_OUTPUT
28 # arg2: relative file name in a source dir (VPATH)
29 #
30 define symlink_rule
31 $(addprefix $(RTE_OUTPUT)/$(1)/,$(notdir $(2))): $(2)
32         @echo "  SYMLINK-FILE $(addprefix $(1)/,$(notdir $(2)))"
33         @[ -d $(RTE_OUTPUT)/$(1) ] || mkdir -p $(RTE_OUTPUT)/$(1)
34         $(Q)ln -nsf `$(RTE_SDK)/buildtools/relpath.sh $$(<) $(RTE_OUTPUT)/$(1)` \
35                 $(RTE_OUTPUT)/$(1)
36 endef
37
38 $(foreach dir,$(SYMLINK-DIRS-y),\
39         $(foreach file,$(SYMLINK-y-$(dir)),\
40                 $(eval $(call symlink_rule,$(dir),$(file)))))
41
42
43 # fast way, no need to do preinstall and postinstall
44 ifeq ($(PREINSTALL)$(POSTINSTALL),)
45
46 _postinstall: $(_INSTALL)
47         @touch _postinstall
48
49 else # slower way
50
51 _preinstall: $(PREINSTALL)
52         @touch _preinstall
53
54 ifneq ($(_INSTALL),)
55 $(_INSTALL): _preinstall
56 else
57 _INSTALL = _preinstall
58 endif
59
60 _install: $(_INSTALL)
61         @touch _install
62
63 ifneq ($(POSTINSTALL),)
64 $(POSTINSTALL): _install
65 else
66 POSTINSTALL = _install
67 endif
68
69 _postinstall: $(POSTINSTALL)
70         @touch _postinstall
71 endif