2018-05-03 07:30:11 +00:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
# Copyright(c) 2010-2014 Intel Corporation.
|
|
|
|
# Copyright 2015 6WIND S.A.
|
2012-09-04 12:54:00 +00:00
|
|
|
|
2015-12-01 07:36:00 +00:00
|
|
|
# Configuration, compilation and installation can be done at once
|
|
|
|
# with make install T=<config>
|
2012-09-04 12:54:00 +00:00
|
|
|
|
2015-12-01 14:04:01 +00:00
|
|
|
ifdef T # config, build and install combined
|
2015-12-01 07:36:00 +00:00
|
|
|
# The build directory is T and may be prepended with O
|
|
|
|
O ?= .
|
|
|
|
RTE_OUTPUT := $O/$T
|
2015-12-01 14:04:01 +00:00
|
|
|
else # standard install
|
|
|
|
# Build directory is given with O=
|
|
|
|
O ?= build
|
|
|
|
RTE_OUTPUT := $O
|
|
|
|
endif
|
2012-09-04 12:54:00 +00:00
|
|
|
|
2015-12-01 22:37:52 +00:00
|
|
|
ifneq ($(MAKECMDGOALS),pre_install)
|
|
|
|
include $(RTE_SDK)/mk/rte.vars.mk
|
|
|
|
endif
|
|
|
|
|
2015-12-01 14:04:01 +00:00
|
|
|
ifdef T # defaults with T= will install an almost flat staging tree
|
|
|
|
export prefix ?=
|
2015-12-01 22:37:52 +00:00
|
|
|
kerneldir ?= $(prefix)/kmod
|
|
|
|
else
|
|
|
|
ifeq ($(RTE_EXEC_ENV),linuxapp)
|
|
|
|
kerneldir ?= /lib/modules/$(shell uname -r)/extra/dpdk
|
2015-12-01 14:04:01 +00:00
|
|
|
else
|
2015-12-01 22:37:52 +00:00
|
|
|
kerneldir ?= /boot/modules
|
|
|
|
endif
|
2015-12-01 11:47:48 +00:00
|
|
|
prefix ?= /usr/local
|
2015-12-01 14:04:01 +00:00
|
|
|
endif
|
2015-12-01 11:47:48 +00:00
|
|
|
exec_prefix ?= $(prefix)
|
|
|
|
bindir ?= $(exec_prefix)/bin
|
2015-12-01 22:59:18 +00:00
|
|
|
sbindir ?= $(exec_prefix)/sbin
|
2015-12-01 11:47:48 +00:00
|
|
|
libdir ?= $(exec_prefix)/lib
|
|
|
|
includedir ?= $(prefix)/include/dpdk
|
|
|
|
datarootdir ?= $(prefix)/share
|
2015-12-01 22:59:26 +00:00
|
|
|
docdir ?= $(datarootdir)/doc/dpdk
|
2015-12-01 11:47:48 +00:00
|
|
|
datadir ?= $(datarootdir)/dpdk
|
2016-08-31 07:50:10 +00:00
|
|
|
mandir ?= $(datarootdir)/man
|
2015-12-01 11:47:48 +00:00
|
|
|
sdkdir ?= $(datadir)
|
|
|
|
targetdir ?= $(datadir)/$(RTE_TARGET)
|
|
|
|
|
|
|
|
# The install directories may be staged in DESTDIR
|
|
|
|
|
|
|
|
# Create the directory $1 if not exists
|
|
|
|
rte_mkdir = test -d $1 || mkdir -p $1
|
|
|
|
|
|
|
|
# Create the relative symbolic link $2 -> $1
|
|
|
|
# May be replaced with --relative option of ln from coreutils-8.16
|
2016-12-15 21:46:47 +00:00
|
|
|
rte_symlink = ln -snf $$($(RTE_SDK)/buildtools/relpath.sh $1 $(dir $2)) $2
|
2015-12-01 11:47:48 +00:00
|
|
|
|
2015-12-01 08:27:37 +00:00
|
|
|
.PHONY: pre_install
|
|
|
|
pre_install:
|
2015-12-01 14:04:01 +00:00
|
|
|
ifdef T
|
2015-12-01 07:36:00 +00:00
|
|
|
$(Q)if [ ! -f $(RTE_OUTPUT)/.config ]; then \
|
|
|
|
$(MAKE) config O=$(RTE_OUTPUT); \
|
|
|
|
elif cmp -s $(RTE_OUTPUT)/.config.orig $(RTE_OUTPUT)/.config; then \
|
|
|
|
$(MAKE) config O=$(RTE_OUTPUT); \
|
mk: allow updates to build config on make install
When running "make config", an additional config.orig file is also
generated, which is intended to hold the original, clean configuration
from the template.
When running make install, we first check if there is no existing
.config file, and run make config if not. If there is a file, we then
check if it's unmodified, in which case we regenerate a new .config to
take account of any possible updates to the template. Finally, in the
case where there is an existing .config file, and it HAS been modified,
we then do a check to see if the template has had further updates, and
throw an error if so. If no updates, we continue with the build using
the existing, user-modified config.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Bruce Richardson <bruce.richardson@intel.com>
2014-05-14 15:55:10 +00:00
|
|
|
else \
|
2015-12-01 07:36:00 +00:00
|
|
|
if [ -f $(RTE_OUTPUT)/.config.orig ] ; then \
|
|
|
|
tmp_build=$(RTE_OUTPUT)/.config.tmp; \
|
|
|
|
$(MAKE) config O=$$tmp_build; \
|
|
|
|
if ! cmp -s $(RTE_OUTPUT)/.config.orig $$tmp_build/.config ; then \
|
mk: allow updates to build config on make install
When running "make config", an additional config.orig file is also
generated, which is intended to hold the original, clean configuration
from the template.
When running make install, we first check if there is no existing
.config file, and run make config if not. If there is a file, we then
check if it's unmodified, in which case we regenerate a new .config to
take account of any possible updates to the template. Finally, in the
case where there is an existing .config file, and it HAS been modified,
we then do a check to see if the template has had further updates, and
throw an error if so. If no updates, we continue with the build using
the existing, user-modified config.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Bruce Richardson <bruce.richardson@intel.com>
2014-05-14 15:55:10 +00:00
|
|
|
echo "Conflict: local config and template config have both changed"; \
|
|
|
|
exit 1; \
|
|
|
|
fi; \
|
|
|
|
fi; \
|
|
|
|
echo "Using local configuration"; \
|
2013-01-30 15:30:19 +00:00
|
|
|
fi
|
2015-12-01 07:36:00 +00:00
|
|
|
$(Q)$(MAKE) all O=$(RTE_OUTPUT)
|
2015-12-01 14:04:01 +00:00
|
|
|
endif
|
2015-12-01 08:27:37 +00:00
|
|
|
|
|
|
|
.PHONY: install
|
|
|
|
install:
|
2015-12-01 11:47:48 +00:00
|
|
|
ifeq ($(DESTDIR)$(if $T,,+),)
|
|
|
|
@echo Installation cannot run with T defined and DESTDIR undefined
|
|
|
|
else
|
|
|
|
@echo ================== Installing $(DESTDIR)$(prefix)/
|
2015-12-01 22:29:48 +00:00
|
|
|
$(Q)$(MAKE) O=$(RTE_OUTPUT) T= install-runtime
|
2015-12-01 22:37:52 +00:00
|
|
|
$(Q)$(MAKE) O=$(RTE_OUTPUT) T= install-kmod
|
2015-12-01 22:29:48 +00:00
|
|
|
$(Q)$(MAKE) O=$(RTE_OUTPUT) T= install-sdk
|
2015-12-01 22:59:26 +00:00
|
|
|
$(Q)$(MAKE) O=$(RTE_OUTPUT) T= install-doc
|
2015-12-01 22:29:48 +00:00
|
|
|
@echo Installation in $(DESTDIR)$(prefix)/ complete
|
|
|
|
endif
|
|
|
|
|
|
|
|
install-runtime:
|
2015-12-01 11:47:48 +00:00
|
|
|
$(Q)$(call rte_mkdir, $(DESTDIR)$(libdir))
|
2015-12-01 22:29:48 +00:00
|
|
|
$(Q)cp -a $O/lib/* $(DESTDIR)$(libdir)
|
2015-12-01 11:47:48 +00:00
|
|
|
$(Q)$(call rte_mkdir, $(DESTDIR)$(bindir))
|
2016-05-23 05:53:33 +00:00
|
|
|
$(Q)tar -cf - -C $O --exclude 'app/*.map' \
|
2016-07-20 13:38:54 +00:00
|
|
|
--exclude app/dpdk-pmdinfogen \
|
2015-12-01 11:47:48 +00:00
|
|
|
--exclude 'app/cmdline*' --exclude app/test \
|
2016-05-23 05:53:33 +00:00
|
|
|
--exclude app/testacl --exclude app/testpipeline app | \
|
2015-12-01 11:47:48 +00:00
|
|
|
tar -xf - -C $(DESTDIR)$(bindir) --strip-components=1 \
|
2016-08-29 09:11:32 +00:00
|
|
|
--keep-newer-files
|
2015-12-01 11:47:48 +00:00
|
|
|
$(Q)$(call rte_mkdir, $(DESTDIR)$(datadir))
|
2016-12-15 21:25:36 +00:00
|
|
|
$(Q)cp -a $(RTE_SDK)/usertools $(DESTDIR)$(datadir)
|
2015-12-01 22:59:18 +00:00
|
|
|
$(Q)$(call rte_mkdir, $(DESTDIR)$(sbindir))
|
2016-12-15 21:25:36 +00:00
|
|
|
$(Q)$(call rte_symlink, $(DESTDIR)$(datadir)/usertools/dpdk-devbind.py, \
|
2016-07-20 13:38:54 +00:00
|
|
|
$(DESTDIR)$(sbindir)/dpdk-devbind)
|
2016-12-15 21:25:36 +00:00
|
|
|
$(Q)$(call rte_symlink, $(DESTDIR)$(datadir)/usertools/dpdk-pmdinfo.py, \
|
2016-07-20 13:38:54 +00:00
|
|
|
$(DESTDIR)$(bindir)/dpdk-pmdinfo)
|
2016-08-31 07:50:10 +00:00
|
|
|
ifneq ($(wildcard $O/doc/man/*/*.1),)
|
|
|
|
$(Q)$(call rte_mkdir, $(DESTDIR)$(mandir)/man1)
|
|
|
|
$(Q)cp -a $O/doc/man/*/*.1 $(DESTDIR)$(mandir)/man1
|
|
|
|
endif
|
2016-08-31 07:50:12 +00:00
|
|
|
ifneq ($(wildcard $O/doc/man/*/*.8),)
|
|
|
|
$(Q)$(call rte_mkdir, $(DESTDIR)$(mandir)/man8)
|
|
|
|
$(Q)cp -a $O/doc/man/*/*.8 $(DESTDIR)$(mandir)/man8
|
|
|
|
endif
|
2015-12-01 22:29:48 +00:00
|
|
|
|
2015-12-01 22:37:52 +00:00
|
|
|
install-kmod:
|
|
|
|
ifneq ($(wildcard $O/kmod/*),)
|
|
|
|
$(Q)$(call rte_mkdir, $(DESTDIR)$(kerneldir))
|
|
|
|
$(Q)cp -a $O/kmod/* $(DESTDIR)$(kerneldir)
|
|
|
|
endif
|
|
|
|
|
2015-12-01 22:29:48 +00:00
|
|
|
install-sdk:
|
2015-12-01 11:47:48 +00:00
|
|
|
$(Q)$(call rte_mkdir, $(DESTDIR)$(includedir))
|
2015-12-01 22:29:48 +00:00
|
|
|
$(Q)tar -chf - -C $O include | \
|
2015-12-01 11:47:48 +00:00
|
|
|
tar -xf - -C $(DESTDIR)$(includedir) --strip-components=1 \
|
2016-08-29 09:11:32 +00:00
|
|
|
--keep-newer-files
|
2015-12-01 11:47:48 +00:00
|
|
|
$(Q)$(call rte_mkdir, $(DESTDIR)$(sdkdir))
|
2015-12-09 07:58:11 +00:00
|
|
|
$(Q)cp -a $(RTE_SDK)/mk $(DESTDIR)$(sdkdir)
|
2016-12-15 21:46:47 +00:00
|
|
|
$(Q)cp -a $(RTE_SDK)/buildtools $(DESTDIR)$(sdkdir)
|
2016-07-07 12:19:54 +00:00
|
|
|
$(Q)$(call rte_mkdir, $(DESTDIR)$(targetdir)/app)
|
2015-12-01 22:29:48 +00:00
|
|
|
$(Q)cp -a $O/.config $(DESTDIR)$(targetdir)
|
2016-07-20 13:38:54 +00:00
|
|
|
$(Q)cp -a $O/app/dpdk-pmdinfogen $(DESTDIR)$(targetdir)/app
|
2015-12-01 11:47:48 +00:00
|
|
|
$(Q)$(call rte_symlink, $(DESTDIR)$(includedir), $(DESTDIR)$(targetdir)/include)
|
|
|
|
$(Q)$(call rte_symlink, $(DESTDIR)$(libdir), $(DESTDIR)$(targetdir)/lib)
|
2015-12-01 22:59:26 +00:00
|
|
|
|
|
|
|
install-doc:
|
2016-11-06 16:42:12 +00:00
|
|
|
ifneq ($(wildcard $O/doc/html),)
|
2015-12-01 22:59:26 +00:00
|
|
|
$(Q)$(call rte_mkdir, $(DESTDIR)$(docdir))
|
2017-06-23 18:41:47 +00:00
|
|
|
$(Q)tar -cf - -C $O/doc --exclude 'html/guides/.*' html | \
|
2015-12-01 22:59:26 +00:00
|
|
|
tar -xf - -C $(DESTDIR)$(docdir) --strip-components=1 \
|
2016-08-29 09:11:32 +00:00
|
|
|
--keep-newer-files
|
2015-12-01 22:59:26 +00:00
|
|
|
endif
|
|
|
|
ifneq ($(wildcard $O/doc/*/*/*pdf),)
|
|
|
|
$(Q)$(call rte_mkdir, $(DESTDIR)$(docdir)/guides)
|
|
|
|
$(Q)cp -a $O/doc/*/*/*pdf $(DESTDIR)$(docdir)/guides
|
|
|
|
endif
|
2016-01-08 11:03:01 +00:00
|
|
|
$(Q)$(call rte_mkdir, $(DESTDIR)$(datadir))
|
2015-12-01 23:11:28 +00:00
|
|
|
$(Q)cp -a $(RTE_SDK)/examples $(DESTDIR)$(datadir)
|