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
88 # when installing we want recursive copies preserving timestamps only, no
89 # preservation of user/group ids or permissions
90 CP_FLAGS=-dR --preserve=timestamps
91 TAR_X_FLAGS=--strip-components=1 --keep-newer-files --no-same-owner --no-same-permissions
94 $(Q)$(call rte_mkdir, $(DESTDIR)$(libdir))
95 $(Q)cp $(CP_FLAGS) $O/lib/* $(DESTDIR)$(libdir)
96 $(Q)$(call rte_mkdir, $(DESTDIR)$(bindir))
97 $(Q)tar -cf - -C $O --exclude 'app/*.map' \
98 --exclude app/dpdk-pmdinfogen \
99 --exclude 'app/cmdline*' --exclude app/test \
100 --exclude app/testacl --exclude app/testpipeline app | \
101 tar -xf - -C $(DESTDIR)$(bindir) $(TAR_X_FLAGS)
102 $(Q)$(call rte_mkdir, $(DESTDIR)$(datadir)/usertools)
103 $(Q)tar -cf - -C $(RTE_SDK) --exclude meson.build usertools | \
104 tar -xf - -C $(DESTDIR)$(datadir)/usertools $(TAR_X_FLAGS)
105 $(Q)$(call rte_mkdir, $(DESTDIR)$(sbindir))
106 $(Q)$(call rte_symlink, $(DESTDIR)$(datadir)/usertools/dpdk-devbind.py, \
107 $(DESTDIR)$(sbindir)/dpdk-devbind)
108 $(Q)$(call rte_symlink, $(DESTDIR)$(datadir)/usertools/dpdk-pmdinfo.py, \
109 $(DESTDIR)$(bindir)/dpdk-pmdinfo)
110 ifneq ($(wildcard $O/doc/man/*/*.1),)
111 $(Q)$(call rte_mkdir, $(DESTDIR)$(mandir)/man1)
112 $(Q)cp $(CP_FLAGS) $O/doc/man/*/*.1 $(DESTDIR)$(mandir)/man1
114 ifneq ($(wildcard $O/doc/man/*/*.8),)
115 $(Q)$(call rte_mkdir, $(DESTDIR)$(mandir)/man8)
116 $(Q)cp $(CP_FLAGS) $O/doc/man/*/*.8 $(DESTDIR)$(mandir)/man8
120 ifneq ($(wildcard $O/kmod/*),)
121 $(Q)$(call rte_mkdir, $(DESTDIR)$(kerneldir))
122 $(Q)cp $(CP_FLAGS) $O/kmod/* $(DESTDIR)$(kerneldir)
126 $(Q)$(call rte_mkdir, $(DESTDIR)$(includedir))
127 $(Q)tar -chf - -C $O include | \
128 tar -xf - -C $(DESTDIR)$(includedir) $(TAR_X_FLAGS)
129 $(Q)$(call rte_mkdir, $(DESTDIR)$(sdkdir))
130 $(Q)cp $(CP_FLAGS) $(RTE_SDK)/mk $(DESTDIR)$(sdkdir)
131 $(Q)cp $(CP_FLAGS) $(RTE_SDK)/buildtools $(DESTDIR)$(sdkdir)
132 $(Q)$(call rte_mkdir, $(DESTDIR)$(targetdir)/app)
133 $(Q)cp $(CP_FLAGS) $O/.config $(DESTDIR)$(targetdir)
134 $(Q)cp $(CP_FLAGS) $O/app/dpdk-pmdinfogen $(DESTDIR)$(targetdir)/app
135 $(Q)$(call rte_symlink, $(DESTDIR)$(includedir), $(DESTDIR)$(targetdir)/include)
136 $(Q)$(call rte_symlink, $(DESTDIR)$(libdir), $(DESTDIR)$(targetdir)/lib)
139 ifneq ($(wildcard $O/doc/html),)
140 $(Q)$(call rte_mkdir, $(DESTDIR)$(docdir))
141 $(Q)tar -cf - -C $O/doc --exclude 'html/guides/.*' html | \
142 tar -xf - -C $(DESTDIR)$(docdir) $(TAR_X_FLAGS)
144 ifneq ($(wildcard $O/doc/*/*/*pdf),)
145 $(Q)$(call rte_mkdir, $(DESTDIR)$(docdir)/guides)
146 $(Q)cp $(CP_FLAGS) $O/doc/*/*/*pdf $(DESTDIR)$(docdir)/guides
148 $(Q)$(call rte_mkdir, $(DESTDIR)$(datadir))
149 $(Q)cp $(CP_FLAGS) $(RTE_SDK)/examples $(DESTDIR)$(datadir)