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)
29 ifeq ($(RTE_EXEC_ENV),linux)
30 kerneldir ?= $(RTE_KERNELDIR:/build=/extra/dpdk)
32 kerneldir ?= /boot/modules
36 exec_prefix ?= $(prefix)
37 bindir ?= $(exec_prefix)/bin
38 sbindir ?= $(exec_prefix)/sbin
39 libdir ?= $(exec_prefix)/lib
40 includedir ?= $(prefix)/include/dpdk
41 datarootdir ?= $(prefix)/share
42 docdir ?= $(datarootdir)/doc/dpdk
43 datadir ?= $(datarootdir)/dpdk
44 mandir ?= $(datarootdir)/man
46 targetdir ?= $(datadir)/$(RTE_TARGET)
48 # The install directories may be staged in DESTDIR
50 # Create the directory $1 if not exists
51 rte_mkdir = test -d $1 || mkdir -p $1
53 # Create the relative symbolic link $2 -> $1
54 # May be replaced with --relative option of ln from coreutils-8.16
55 rte_symlink = ln -snf $$($(RTE_SDK)/buildtools/relpath.sh $1 $(dir $2)) $2
60 $(Q)if [ ! -f $(RTE_OUTPUT)/.config ]; then \
61 $(MAKE) config O=$(RTE_OUTPUT); \
62 elif cmp -s $(RTE_OUTPUT)/.config.orig $(RTE_OUTPUT)/.config; then \
63 $(MAKE) config O=$(RTE_OUTPUT); \
65 if [ -f $(RTE_OUTPUT)/.config.orig ] ; then \
66 tmp_build=$(RTE_OUTPUT)/.config.tmp; \
67 $(MAKE) config O=$$tmp_build; \
68 if ! cmp -s $(RTE_OUTPUT)/.config.orig $$tmp_build/.config ; then \
69 echo "Conflict: local config and template config have both changed"; \
73 echo "Using local configuration"; \
75 $(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)$(MAKE) O=$(RTE_OUTPUT) T= install-runtime
85 $(Q)$(MAKE) O=$(RTE_OUTPUT) T= install-kmod
86 $(Q)$(MAKE) O=$(RTE_OUTPUT) T= install-sdk
87 $(Q)$(MAKE) O=$(RTE_OUTPUT) T= install-doc
88 @echo Installation in $(DESTDIR)$(prefix)/ complete
91 # when installing we want recursive copies preserving timestamps only, no
92 # preservation of user/group ids or permissions
93 CP_FLAGS=-dR --preserve=timestamps
94 TAR_X_FLAGS=--strip-components=1 --keep-newer-files --no-same-owner --no-same-permissions
97 $(Q)$(call rte_mkdir, $(DESTDIR)$(libdir))
98 $(Q)cp $(CP_FLAGS) $O/lib/* $(DESTDIR)$(libdir)
99 $(Q)$(call rte_mkdir, $(DESTDIR)$(bindir))
100 $(Q)tar -cf - -C $O --exclude 'app/*.map' \
101 --exclude app/dpdk-pmdinfogen \
102 --exclude 'app/cmdline*' --exclude app/test \
103 --exclude app/testacl --exclude app/testpipeline app | \
104 tar -xf - -C $(DESTDIR)$(bindir) $(TAR_X_FLAGS)
105 $(Q)$(call rte_mkdir, $(DESTDIR)$(datadir)/usertools)
106 $(Q)tar -cf - -C $(RTE_SDK) --exclude meson.build usertools | \
107 tar -xf - -C $(DESTDIR)$(datadir)/usertools $(TAR_X_FLAGS)
108 $(Q)$(call rte_mkdir, $(DESTDIR)$(sbindir))
109 $(Q)$(call rte_symlink, $(DESTDIR)$(datadir)/usertools/dpdk-devbind.py, \
110 $(DESTDIR)$(sbindir)/dpdk-devbind)
111 $(Q)$(call rte_symlink, $(DESTDIR)$(datadir)/usertools/dpdk-pmdinfo.py, \
112 $(DESTDIR)$(bindir)/dpdk-pmdinfo)
113 ifneq ($(wildcard $O/doc/man/*/*.1),)
114 $(Q)$(call rte_mkdir, $(DESTDIR)$(mandir)/man1)
115 $(Q)cp $(CP_FLAGS) $O/doc/man/*/*.1 $(DESTDIR)$(mandir)/man1
117 ifneq ($(wildcard $O/doc/man/*/*.8),)
118 $(Q)$(call rte_mkdir, $(DESTDIR)$(mandir)/man8)
119 $(Q)cp $(CP_FLAGS) $O/doc/man/*/*.8 $(DESTDIR)$(mandir)/man8
123 ifneq ($(wildcard $O/kmod/*),)
124 $(Q)$(call rte_mkdir, $(DESTDIR)$(kerneldir))
125 $(Q)cp $(CP_FLAGS) $O/kmod/* $(DESTDIR)$(kerneldir)
129 $(Q)$(call rte_mkdir, $(DESTDIR)$(includedir))
130 $(Q)tar -chf - -C $O include | \
131 tar -xf - -C $(DESTDIR)$(includedir) $(TAR_X_FLAGS)
132 $(Q)$(call rte_mkdir, $(DESTDIR)$(sdkdir))
133 $(Q)cp $(CP_FLAGS) $(RTE_SDK)/mk $(DESTDIR)$(sdkdir)
134 $(Q)cp $(CP_FLAGS) $(RTE_SDK)/buildtools $(DESTDIR)$(sdkdir)
135 $(Q)$(call rte_mkdir, $(DESTDIR)$(targetdir)/app)
136 $(Q)cp $(CP_FLAGS) $O/.config $(DESTDIR)$(targetdir)
137 $(Q)cp $(CP_FLAGS) $O/app/dpdk-pmdinfogen $(DESTDIR)$(targetdir)/app
138 $(Q)$(call rte_symlink, $(DESTDIR)$(includedir), $(DESTDIR)$(targetdir)/include)
139 $(Q)$(call rte_symlink, $(DESTDIR)$(libdir), $(DESTDIR)$(targetdir)/lib)
142 ifneq ($(wildcard $O/doc/html),)
143 $(Q)$(call rte_mkdir, $(DESTDIR)$(docdir))
144 $(Q)tar -cf - -C $O/doc --exclude 'html/guides/.*' html | \
145 tar -xf - -C $(DESTDIR)$(docdir) $(TAR_X_FLAGS)
147 ifneq ($(wildcard $O/doc/*/*/*pdf),)
148 $(Q)$(call rte_mkdir, $(DESTDIR)$(docdir)/guides)
149 $(Q)cp $(CP_FLAGS) $O/doc/*/*/*pdf $(DESTDIR)$(docdir)/guides
151 $(Q)$(call rte_mkdir, $(DESTDIR)$(datadir))
152 $(Q)cp $(CP_FLAGS) $(RTE_SDK)/examples $(DESTDIR)$(datadir)