1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2010-2014 Intel Corporation.
3 # Copyright 2015 6WIND S.A.
5 # Configuration, compilation and installation can be done at once
6 # with make install T=<config>
8 ifdef T # config, build and install combined
9 # The build directory is T and may be prepended with O
12 else # standard install
13 # Build directory is given with O=
18 ifneq ($(MAKECMDGOALS),pre_install)
19 include $(RTE_SDK)/mk/rte.vars.mk
22 ifdef T # defaults with T= will install an almost flat staging tree
24 kerneldir ?= $(prefix)/kmod
26 ifeq ($(RTE_EXEC_ENV),linuxapp)
27 kerneldir ?= /lib/modules/$(shell uname -r)/extra/dpdk
29 kerneldir ?= /boot/modules
33 exec_prefix ?= $(prefix)
34 bindir ?= $(exec_prefix)/bin
35 sbindir ?= $(exec_prefix)/sbin
36 libdir ?= $(exec_prefix)/lib
37 includedir ?= $(prefix)/include/dpdk
38 datarootdir ?= $(prefix)/share
39 docdir ?= $(datarootdir)/doc/dpdk
40 datadir ?= $(datarootdir)/dpdk
41 mandir ?= $(datarootdir)/man
43 targetdir ?= $(datadir)/$(RTE_TARGET)
45 # The install directories may be staged in DESTDIR
47 # Create the directory $1 if not exists
48 rte_mkdir = test -d $1 || mkdir -p $1
50 # Create the relative symbolic link $2 -> $1
51 # May be replaced with --relative option of ln from coreutils-8.16
52 rte_symlink = ln -snf $$($(RTE_SDK)/buildtools/relpath.sh $1 $(dir $2)) $2
57 $(Q)if [ ! -f $(RTE_OUTPUT)/.config ]; then \
58 $(MAKE) config O=$(RTE_OUTPUT); \
59 elif cmp -s $(RTE_OUTPUT)/.config.orig $(RTE_OUTPUT)/.config; then \
60 $(MAKE) config O=$(RTE_OUTPUT); \
62 if [ -f $(RTE_OUTPUT)/.config.orig ] ; then \
63 tmp_build=$(RTE_OUTPUT)/.config.tmp; \
64 $(MAKE) config O=$$tmp_build; \
65 if ! cmp -s $(RTE_OUTPUT)/.config.orig $$tmp_build/.config ; then \
66 echo "Conflict: local config and template config have both changed"; \
70 echo "Using local configuration"; \
72 $(Q)$(MAKE) all O=$(RTE_OUTPUT)
77 ifeq ($(DESTDIR)$(if $T,,+),)
78 @echo Installation cannot run with T defined and DESTDIR undefined
80 @echo ================== Installing $(DESTDIR)$(prefix)/
81 $(Q)$(MAKE) O=$(RTE_OUTPUT) T= install-runtime
82 $(Q)$(MAKE) O=$(RTE_OUTPUT) T= install-kmod
83 $(Q)$(MAKE) O=$(RTE_OUTPUT) T= install-sdk
84 $(Q)$(MAKE) O=$(RTE_OUTPUT) T= install-doc
85 @echo Installation in $(DESTDIR)$(prefix)/ complete
89 $(Q)$(call rte_mkdir, $(DESTDIR)$(libdir))
90 $(Q)cp -a $O/lib/* $(DESTDIR)$(libdir)
91 $(Q)$(call rte_mkdir, $(DESTDIR)$(bindir))
92 $(Q)tar -cf - -C $O --exclude 'app/*.map' \
93 --exclude app/dpdk-pmdinfogen \
94 --exclude 'app/cmdline*' --exclude app/test \
95 --exclude app/testacl --exclude app/testpipeline app | \
96 tar -xf - -C $(DESTDIR)$(bindir) --strip-components=1 \
98 $(Q)$(call rte_mkdir, $(DESTDIR)$(datadir))
99 $(Q)cp -a $(RTE_SDK)/usertools $(DESTDIR)$(datadir)
100 $(Q)$(call rte_mkdir, $(DESTDIR)$(sbindir))
101 $(Q)$(call rte_symlink, $(DESTDIR)$(datadir)/usertools/dpdk-devbind.py, \
102 $(DESTDIR)$(sbindir)/dpdk-devbind)
103 $(Q)$(call rte_symlink, $(DESTDIR)$(datadir)/usertools/dpdk-pmdinfo.py, \
104 $(DESTDIR)$(bindir)/dpdk-pmdinfo)
105 ifneq ($(wildcard $O/doc/man/*/*.1),)
106 $(Q)$(call rte_mkdir, $(DESTDIR)$(mandir)/man1)
107 $(Q)cp -a $O/doc/man/*/*.1 $(DESTDIR)$(mandir)/man1
109 ifneq ($(wildcard $O/doc/man/*/*.8),)
110 $(Q)$(call rte_mkdir, $(DESTDIR)$(mandir)/man8)
111 $(Q)cp -a $O/doc/man/*/*.8 $(DESTDIR)$(mandir)/man8
115 ifneq ($(wildcard $O/kmod/*),)
116 $(Q)$(call rte_mkdir, $(DESTDIR)$(kerneldir))
117 $(Q)cp -a $O/kmod/* $(DESTDIR)$(kerneldir)
121 $(Q)$(call rte_mkdir, $(DESTDIR)$(includedir))
122 $(Q)tar -chf - -C $O include | \
123 tar -xf - -C $(DESTDIR)$(includedir) --strip-components=1 \
125 $(Q)$(call rte_mkdir, $(DESTDIR)$(sdkdir))
126 $(Q)cp -a $(RTE_SDK)/mk $(DESTDIR)$(sdkdir)
127 $(Q)cp -a $(RTE_SDK)/buildtools $(DESTDIR)$(sdkdir)
128 $(Q)$(call rte_mkdir, $(DESTDIR)$(targetdir)/app)
129 $(Q)cp -a $O/.config $(DESTDIR)$(targetdir)
130 $(Q)cp -a $O/app/dpdk-pmdinfogen $(DESTDIR)$(targetdir)/app
131 $(Q)$(call rte_symlink, $(DESTDIR)$(includedir), $(DESTDIR)$(targetdir)/include)
132 $(Q)$(call rte_symlink, $(DESTDIR)$(libdir), $(DESTDIR)$(targetdir)/lib)
135 ifneq ($(wildcard $O/doc/html),)
136 $(Q)$(call rte_mkdir, $(DESTDIR)$(docdir))
137 $(Q)tar -cf - -C $O/doc --exclude 'html/guides/.*' html | \
138 tar -xf - -C $(DESTDIR)$(docdir) --strip-components=1 \
141 ifneq ($(wildcard $O/doc/*/*/*pdf),)
142 $(Q)$(call rte_mkdir, $(DESTDIR)$(docdir)/guides)
143 $(Q)cp -a $O/doc/*/*/*pdf $(DESTDIR)$(docdir)/guides
145 $(Q)$(call rte_mkdir, $(DESTDIR)$(datadir))
146 $(Q)cp -a $(RTE_SDK)/examples $(DESTDIR)$(datadir)