[dpdk-dev] [PATCH v7 01/11] mk: Add rule for installing headers

Mario Carrillo mario.alfredo.c.arevalo at intel.com
Tue Dec 1 01:53:15 CET 2015


Add hierarchy-file support to the DPDK headers,
when invoking "make install-headers" headers will
be installed in: $(DESTDIR)/$(includedir)
where includedir=$(prefix)/include/dpdk and prefix=/usr/local by
default, you can override "prefix" and "includedir" vars.
This hierarchy is based on:
http://www.freedesktop.org/software/systemd/man/file-hierarchy.html
and variables are based on:
https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
https://www.gnu.org/prep/standards/html_node/DESTDIR.html

Signed-off-by: Mario Carrillo <mario.alfredo.c.arevalo at intel.com>
---
 mk/rte.sdkinstall.mk | 22 +++++++++++++++++++++-
 mk/rte.sdkroot.mk    |  4 ++--
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/mk/rte.sdkinstall.mk b/mk/rte.sdkinstall.mk
index 86c98a5..a4a01cf 100644
--- a/mk/rte.sdkinstall.mk
+++ b/mk/rte.sdkinstall.mk
@@ -41,6 +41,11 @@ endif
 # x86_64-native-*-gcc
 ifndef T
 T=*
+ifneq (,$(wildcard $(RTE_OUTPUT)/.config))
+prefix ?= /usr/local
+includedir ?= $(prefix)/include/dpdk
+HSLINKS := $(shell find  $(RTE_OUTPUT)/include/ -name *.h)
+endif
 endif
 
 #
@@ -72,7 +77,22 @@ install: $(INSTALL_TARGETS)
 		echo "Using local configuration"; \
 	fi
 	$(Q)$(MAKE) all O=$(BUILD_DIR)/$*
-
+#
+# install headers in /usr/local/include/dpdk by default
+# "prefix" and "includedir" vars can be overridden.
+#
+.PHONY: install-headers
+install-headers:
+	@echo ================== Installing headers;
+	@if [ ! -z "${HSLINKS}" ]; then \
+	for HSLINK in ${HSLINKS}; do \
+	HEADER=$$(readlink -f $$HSLINK); \
+	HEADER_DIR=$$(dirname $$HSLINK | sed 's/.*include\/*//'); \
+	[ -d $(DESTDIR)/$(includedir)/$$HEADER_DIR ] || mkdir -p $(DESTDIR)/$(includedir)/$$HEADER_DIR; \
+	cp -rf $$HEADER ${DESTDIR}/${includedir}/$$HEADER_DIR; \
+	echo installing: $$HEADER; \
+	done \
+	fi
 #
 # uninstall: remove all built sdk
 #
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index e8423b0..8477a2b 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -97,8 +97,8 @@ test fast_test ring_test mempool_test perf_test coverage:
 testall:
 	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdktestall.mk $@
 
-.PHONY: install uninstall
-install uninstall:
+.PHONY: install install-headers uninstall
+install install-headers uninstall:
 	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkinstall.mk $@
 
 .PHONY: doc help
-- 
2.6.3



More information about the dev mailing list