3 # Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
4 # Copyright 2015 6WIND S.A.
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
11 # * Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 # * Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in
15 # the documentation and/or other materials provided with the
17 # * Neither the name of Intel Corporation nor the names of its
18 # contributors may be used to endorse or promote products derived
19 # from this software without specific prior written permission.
21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 # Configuration, compilation and installation can be done at once
34 # with make install T=<config>
36 ifdef T
# config, build and install combined
37 # The build directory is T and may be prepended with O
40 else # standard install
41 # Build directory is given with O=
46 ifneq ($(MAKECMDGOALS
),pre_install
)
47 include $(RTE_SDK
)/mk
/rte.vars.mk
50 ifdef T
# defaults with T= will install an almost flat staging tree
52 kerneldir ?
= $(prefix)/kmod
54 ifeq ($(RTE_EXEC_ENV
),linuxapp
)
55 kerneldir ?
= /lib
/modules
/$(shell uname
-r
)/extra
/dpdk
57 kerneldir ?
= /boot
/modules
61 exec_prefix ?
= $(prefix)
62 bindir ?
= $(exec_prefix)/bin
63 sbindir ?
= $(exec_prefix)/sbin
64 libdir ?
= $(exec_prefix)/lib
65 includedir ?
= $(prefix)/include/dpdk
66 datarootdir ?
= $(prefix)/share
67 docdir ?
= $(datarootdir
)/doc
/dpdk
68 datadir ?
= $(datarootdir
)/dpdk
69 mandir ?
= $(datarootdir
)/man
71 targetdir ?
= $(datadir)/$(RTE_TARGET
)
73 # The install directories may be staged in DESTDIR
75 # Create the directory $1 if not exists
76 rte_mkdir
= test -d
$1 || mkdir
-p
$1
78 # Create the relative symbolic link $2 -> $1
79 # May be replaced with --relative option of ln from coreutils-8.16
80 rte_symlink
= ln
-snf
$$($(RTE_SDK
)/scripts
/relpath.sh
$1 $(dir $2)) $2
85 $(Q
)if
[ ! -f
$(RTE_OUTPUT
)/.config
]; then \
86 $(MAKE
) config O
=$(RTE_OUTPUT
); \
87 elif cmp
-s
$(RTE_OUTPUT
)/.config.orig
$(RTE_OUTPUT
)/.config
; then \
88 $(MAKE
) config O
=$(RTE_OUTPUT
); \
90 if
[ -f
$(RTE_OUTPUT
)/.config.orig
] ; then \
91 tmp_build
=$(RTE_OUTPUT
)/.config.tmp
; \
92 $(MAKE
) config O
=$$tmp_build; \
93 if
! cmp
-s
$(RTE_OUTPUT
)/.config.orig
$$tmp_build/.config
; then \
94 echo
"Conflict: local config and template config have both changed"; \
98 echo
"Using local configuration"; \
100 $(Q
)$(MAKE
) all O
=$(RTE_OUTPUT
)
105 ifeq ($(DESTDIR
)$(if
$T,,+),)
106 @echo Installation cannot run with T defined and DESTDIR undefined
108 @echo
================== Installing
$(DESTDIR
)$(prefix)/
109 $(Q
)$(MAKE
) O
=$(RTE_OUTPUT
) T
= install-runtime
110 $(Q
)$(MAKE
) O
=$(RTE_OUTPUT
) T
= install-kmod
111 $(Q
)$(MAKE
) O
=$(RTE_OUTPUT
) T
= install-sdk
112 $(Q
)$(MAKE
) O
=$(RTE_OUTPUT
) T
= install-doc
113 @echo Installation in
$(DESTDIR
)$(prefix)/ complete
117 $(Q
)$(call rte_mkdir
, $(DESTDIR
)$(libdir))
118 $(Q
)cp
-a
$O/lib
/* $(DESTDIR
)$(libdir)
119 $(Q
)$(call rte_mkdir
, $(DESTDIR
)$(bindir))
120 $(Q
)tar -cf
- -C
$O --exclude
'app/*.map' \
121 --exclude app
/dpdk-pmdinfogen \
122 --exclude
'app/cmdline*' --exclude app
/test \
123 --exclude app
/testacl
--exclude app
/testpipeline app | \
124 tar -xf
- -C
$(DESTDIR
)$(bindir) --strip-components
=1 \
126 $(Q
)$(call rte_mkdir
, $(DESTDIR
)$(datadir))
127 $(Q
)cp
-a
$(RTE_SDK
)/tools
$(DESTDIR
)$(datadir)
128 $(Q
)$(call rte_symlink
, $(DESTDIR
)$(datadir)/tools
/dpdk-setup.sh
, \
129 $(DESTDIR
)$(datadir)/tools
/setup.sh
)
130 $(Q
)$(call rte_symlink
, $(DESTDIR
)$(datadir)/tools
/dpdk-devbind.py
, \
131 $(DESTDIR
)$(datadir)/tools
/dpdk_nic_bind.py
)
132 $(Q
)$(call rte_mkdir
, $(DESTDIR
)$(sbindir
))
133 $(Q
)$(call rte_symlink
, $(DESTDIR
)$(datadir)/tools
/dpdk-devbind.py
, \
134 $(DESTDIR
)$(sbindir
)/dpdk-devbind
)
135 $(Q
)$(call rte_symlink
, $(DESTDIR
)$(datadir)/tools
/dpdk-pmdinfo.py
, \
136 $(DESTDIR
)$(bindir)/dpdk-pmdinfo
)
137 ifneq ($(wildcard $O/doc
/man
/*/*.1),)
138 $(Q
)$(call rte_mkdir
, $(DESTDIR
)$(mandir)/man1
)
139 $(Q
)cp
-a
$O/doc
/man
/*/*.1 $(DESTDIR
)$(mandir)/man1
141 ifneq ($(wildcard $O/doc
/man
/*/*.8),)
142 $(Q
)$(call rte_mkdir
, $(DESTDIR
)$(mandir)/man8
)
143 $(Q
)cp
-a
$O/doc
/man
/*/*.8 $(DESTDIR
)$(mandir)/man8
147 ifneq ($(wildcard $O/kmod
/*),)
148 $(Q
)$(call rte_mkdir
, $(DESTDIR
)$(kerneldir
))
149 $(Q
)cp
-a
$O/kmod
/* $(DESTDIR
)$(kerneldir
)
153 $(Q
)$(call rte_mkdir
, $(DESTDIR
)$(includedir))
154 $(Q
)tar -chf
- -C
$O include | \
155 tar -xf
- -C
$(DESTDIR
)$(includedir) --strip-components
=1 \
157 $(Q
)$(call rte_mkdir
, $(DESTDIR
)$(sdkdir
))
158 $(Q
)cp
-a
$(RTE_SDK
)/mk
$(DESTDIR
)$(sdkdir
)
159 $(Q
)cp
-a
$(RTE_SDK
)/scripts
$(DESTDIR
)$(sdkdir
)
160 $(Q
)$(call rte_mkdir
, $(DESTDIR
)$(targetdir
)/app
)
161 $(Q
)cp
-a
$O/.config
$(DESTDIR
)$(targetdir
)
162 $(Q
)cp
-a
$O/app
/dpdk-pmdinfogen
$(DESTDIR
)$(targetdir
)/app
163 $(Q
)$(call rte_symlink
, $(DESTDIR
)$(includedir), $(DESTDIR
)$(targetdir
)/include)
164 $(Q
)$(call rte_symlink
, $(DESTDIR
)$(libdir), $(DESTDIR
)$(targetdir
)/lib
)
167 ifneq ($(wildcard $O/doc
/html
),)
168 $(Q
)$(call rte_mkdir
, $(DESTDIR
)$(docdir
))
169 $(Q
)tar -cf
- -C
$O/doc html
--exclude
'html/guides/.*' | \
170 tar -xf
- -C
$(DESTDIR
)$(docdir
) --strip-components
=1 \
173 ifneq ($(wildcard $O/doc
/*/*/*pdf
),)
174 $(Q
)$(call rte_mkdir
, $(DESTDIR
)$(docdir
)/guides
)
175 $(Q
)cp
-a
$O/doc
/*/*/*pdf
$(DESTDIR
)$(docdir
)/guides
177 $(Q
)$(call rte_mkdir
, $(DESTDIR
)$(datadir))
178 $(Q
)cp
-a
$(RTE_SDK
)/examples
$(DESTDIR
)$(datadir)