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 # The build directory is T and may be prepended with O
41 exec_prefix ?= $(prefix)
42 bindir ?= $(exec_prefix)/bin
43 libdir ?= $(exec_prefix)/lib
44 includedir ?= $(prefix)/include/dpdk
45 datarootdir ?= $(prefix)/share
46 datadir ?= $(datarootdir)/dpdk
48 targetdir ?= $(datadir)/$(RTE_TARGET)
50 # The install directories may be staged in DESTDIR
52 # Create the directory $1 if not exists
53 rte_mkdir = test -d $1 || mkdir -p $1
55 # Create the relative symbolic link $2 -> $1
56 # May be replaced with --relative option of ln from coreutils-8.16
57 rte_symlink = ln -snf $$($(RTE_SDK)/scripts/relpath.sh $1 $(dir $2)) $2
61 $(Q)if [ ! -f $(RTE_OUTPUT)/.config ]; then \
62 $(MAKE) config O=$(RTE_OUTPUT); \
63 elif cmp -s $(RTE_OUTPUT)/.config.orig $(RTE_OUTPUT)/.config; then \
64 $(MAKE) config O=$(RTE_OUTPUT); \
66 if [ -f $(RTE_OUTPUT)/.config.orig ] ; then \
67 tmp_build=$(RTE_OUTPUT)/.config.tmp; \
68 $(MAKE) config O=$$tmp_build; \
69 if ! cmp -s $(RTE_OUTPUT)/.config.orig $$tmp_build/.config ; then \
70 echo "Conflict: local config and template config have both changed"; \
74 echo "Using local configuration"; \
76 $(Q)$(MAKE) all O=$(RTE_OUTPUT)
80 ifeq ($(DESTDIR)$(if $T,,+),)
81 @echo Installation cannot run with T defined and DESTDIR undefined
83 @echo ================== Installing $(DESTDIR)$(prefix)/
84 $(Q)$(call rte_mkdir, $(DESTDIR)$(libdir))
85 $(Q)cp -a $(RTE_OUTPUT)/lib/* $(DESTDIR)$(libdir)
86 $(Q)$(call rte_mkdir, $(DESTDIR)$(bindir))
87 $(Q)tar -cf - -C $(RTE_OUTPUT) app --exclude 'app/*.map' \
88 --exclude 'app/cmdline*' --exclude app/test \
89 --exclude app/testacl --exclude app/testpipeline | \
90 tar -xf - -C $(DESTDIR)$(bindir) --strip-components=1 \
91 --keep-newer-files --warning=no-ignore-newer
92 $(Q)$(call rte_mkdir, $(DESTDIR)$(datadir))
93 $(Q)cp -a $(RTE_SDK)/tools $(DESTDIR)$(datadir)
94 $(Q)$(call rte_mkdir, $(DESTDIR)$(includedir))
95 $(Q)tar -chf - -C $(RTE_OUTPUT) include | \
96 tar -xf - -C $(DESTDIR)$(includedir) --strip-components=1 \
97 --keep-newer-files --warning=no-ignore-newer
98 $(Q)$(call rte_mkdir, $(DESTDIR)$(sdkdir))
99 $(Q)cp -a $(RTE_SDK)/{mk,scripts} $(DESTDIR)$(sdkdir)
100 $(Q)$(call rte_mkdir, $(DESTDIR)$(targetdir))
101 $(Q)cp -a $(RTE_OUTPUT)/.config $(DESTDIR)$(targetdir)
102 $(Q)$(call rte_symlink, $(DESTDIR)$(includedir), $(DESTDIR)$(targetdir)/include)
103 $(Q)$(call rte_symlink, $(DESTDIR)$(libdir), $(DESTDIR)$(targetdir)/lib)
104 @echo Installation in $(DESTDIR)$(prefix)/ complete