[dpdk-dev] [PATCH 1/7] mk: Add hierarchy-file support

Mario Carrillo mario.alfredo.c.arevalo at intel.com
Fri Sep 18 22:33:04 CEST 2015


Add hierarchy-file support to the DPDK scripts, tools, examples,
makefiles and config files when invoking "make install H=1"
(hierarchy-file)

This hierarchy is based on:
http://www.freedesktop.org/software/systemd/man/file-hierarchy.html
and dpdk spec file.

scripts, tools, examples, makefiles and config files will be installed
in: $(DESTDIR)/usr/share/dpdk

Signed-off-by: Mario Carrillo <mario.alfredo.c.arevalo at intel.com>
---
 mk/rte.sdkinstall.mk | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/mk/rte.sdkinstall.mk b/mk/rte.sdkinstall.mk
index 86c98a5..3b8169b 100644
--- a/mk/rte.sdkinstall.mk
+++ b/mk/rte.sdkinstall.mk
@@ -43,6 +43,23 @@ ifndef T
 T=*
 endif
 
+# When H (hierarchy-file) varible is equal "1" it will install files
+# according to the next proposal:
+# http://www.freedesktop.org/software/systemd/man/file-hierarchy.html
+# some variables get values from .config in order not to set a target again.
+ifeq ($(H),1)
+include $(BUILD_DIR)/build/.config
+RTE_ARCH := $(CONFIG_RTE_ARCH:"%"=%)
+RTE_MACHINE := $(CONFIG_RTE_MACHINE:"%"=%)
+RTE_EXEC_ENV := $(CONFIG_RTE_EXEC_ENV:"%"=%)
+RTE_TOOLCHAIN := $(CONFIG_RTE_TOOLCHAIN:"%"=%)
+RTE_TARGET := $(RTE_ARCH)-$(RTE_MACHINE)-$(RTE_EXEC_ENV)-$(RTE_TOOLCHAIN)
+T := $(RTE_ARCH)-$(RTE_MACHINE)-$(RTE_EXEC_ENV)-$(RTE_TOOLCHAIN)
+DATA_DIR := $(DESTDIR)/usr/share
+INCLUDE_DIR := $(DESTDIR)/usr/include
+export INCLUDE_DIR
+endif
+
 #
 # install: build sdk for all supported targets
 #
@@ -56,6 +73,22 @@ install: $(INSTALL_TARGETS)
 
 %_install:
 	@echo ================== Installing $*
+#
+# Install config and environment files
+# according to freedesktop hierarchy-file when H=1
+#
+ifeq ($(H),1)
+	$(Q)$(MAKE) all O=$(BUILD_DIR)/build
+	@[ -d $(DATA_DIR)/dpdk ] || mkdir -p $(DATA_DIR)/dpdk
+	$(Q)cp -a $(BUILD_DIR)/mk $(DATA_DIR)/dpdk
+	$(Q)cp -a $(BUILD_DIR)/scripts $(DATA_DIR)/dpdk
+	$(Q)cp -a $(BUILD_DIR)/examples $(DATA_DIR)/dpdk
+	$(Q)cp -a $(BUILD_DIR)/tools $(DATA_DIR)/dpdk
+	@[ -d $(INCLUDE_DIR) ] || mkdir -p $(INCLUDE_DIR)
+	$(Q)cp -f  $(BUILD_DIR)/build/include/rte_config.h $(INCLUDE_DIR)
+	@[ -d $(DATA_DIR)/dpdk/config ] || mkdir -p $(DATA_DIR)/dpdk/config
+	$(Q)cp -f $(BUILD_DIR)/build/.config $(DATA_DIR)/dpdk/config
+else
 	$(Q)if [ ! -f $(BUILD_DIR)/$*/.config ]; then \
 		$(MAKE) config T=$* O=$(BUILD_DIR)/$*; \
 	elif cmp -s $(BUILD_DIR)/$*/.config.orig $(BUILD_DIR)/$*/.config; then \
@@ -79,6 +112,7 @@ install: $(INSTALL_TARGETS)
 UNINSTALL_TARGETS := $(addsuffix _uninstall,\
 	$(filter-out %~,$(INSTALL_CONFIGS)))
 
+endif
 .PHONY: uninstall
 uninstall: $(UNINSTALL_TARGETS)
 
-- 
2.1.0



More information about the dev mailing list