debian/rules: clean doc files
[deb_dpdk.git] / debian / rules
index 31e04b7..98555a8 100755 (executable)
@@ -12,6 +12,15 @@ ifeq (,$(findstring terse,$(DEB_BUILD_OPTIONS)))
        export DH_OPTIONS=-v
 endif
 
+# People rebuilding this package can overwrite RTE_MACHINE
+# via DEB_BUILD_OPTIONS if they like
+ifneq (,$(filter rte_machine=%,$(DEB_BUILD_OPTIONS)))
+    RTE_MACHINE ?= $(patsubst rte_machine=%,%,$(filter rte_machine=%,$(DEB_BUILD_OPTIONS)))
+endif
+# default to minimal base, without setting this it would build
+# -march=native which is a non portable invariant
+RTE_MACHINE ?= "default"
+
 # now stable with parallel comilation, so support -j
 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
     PAR := $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
@@ -30,6 +39,15 @@ BUILD_DOCS=y
 endif
 endif
 
+# Allow to pass specific configure flags to meson as a comma separated list
+ifneq (,$(filter dpdk_config_options=%,$(DEB_BUILD_OPTIONS)))
+# GNU Makefile hack: can't directly escape comma and spaces, so use variables
+    comma := ,
+    space :=
+    space +=
+    DPDK_CONFIG_OPTIONS ?= $(subst $(comma),$(space),$(patsubst dpdk_config_options=%,%,$(filter dpdk_config_options=%,$(DEB_BUILD_OPTIONS))))
+endif
+
 # kernel_modules can be passed via DEB_BUILD_OPTIONS to enable building the
 # optional binary kernel modules package. By default it will be built against
 # the current kernel, or ksrc can be passed with a path to the target kernel
@@ -41,7 +59,7 @@ else
 ifneq (,$(filter ksrc=%,$(DEB_BUILD_OPTIONS)))
     KSRC := $(patsubst ksrc=%,%,$(filter ksrc=%,$(DEB_BUILD_OPTIONS)))
 else
-    KSRC := /lib/modules/$(shell uname -r)/build
+    KSRC := /lib/modules/$(shell LIST=$$(ls /lib/modules/); for dir in $$LIST; do test -d /lib/modules/$$dir/build && echo $$dir; done | sort -V | tail -n1)/build
 endif
 
 KVERS := $(shell perl debian/kernel-version $(KSRC))
@@ -77,7 +95,7 @@ override_dh_gencontrol:
        # list for libdpdk-dev to avoid having to maintain it manually.
        # Same for the recommends list for dpdk, were we want the PMDs and the mempools.
        dh_gencontrol -p libdpdk-dev -- -V"librte:Depends=`grep -E 'librte-*' ./debian/files | grep -v dbgsym | tr '_' ' ' | awk '{ print $$1,"(=",$$2 ")" }' | paste -sd ',' - | sed -e 's/,/, /g'`"
-       dh_gencontrol -p dpdk -- -V"librte:Recommends=`grep -E 'librte-(pmd|mempool).*' ./debian/files | grep -v dbgsym | tr '_' ' ' | awk '{ print $$1,"(=",$$2 ")" }' | paste -sd ',' - | sed -e 's/,/, /g'`"
+       dh_gencontrol -p dpdk -- -V"librte:Suggests=`grep -E 'librte-(pmd|mempool).*' ./debian/files | grep -v dbgsym | tr '_' ' ' | awk '{ print $$1,"(=",$$2 ")" }' | paste -sd ',' - | sed -e 's/,/, /g'`"
 ifneq (,$(findstring kernel_modules,$(DEB_BUILD_OPTIONS)))
        dh_gencontrol -p dpdk-modules-$(KVERS) -- \
                -v`cat debian/VERSION` \
@@ -89,14 +107,22 @@ override_dh_auto_clean:
                debian/control.modules debian/VERSION
        sed -i '/Package: dpdk-modules-/,/`tail -n1 debian/control.modules.in`/d' debian/control
        rm -f debian/dpdk-igb-uio-dkms.dkms debian/dpdk-rte-kni-dkms.dkms
+       rm -f doc/guides/compressdevs/overview_feature_table.txt \
+               doc/guides/cryptodevs/overview_aead_table.txt \
+               doc/guides/cryptodevs/overview_asym_table.txt \
+               doc/guides/cryptodevs/overview_auth_table.txt \
+               doc/guides/cryptodevs/overview_cipher_table.txt \
+               doc/guides/cryptodevs/overview_feature_table.txt \
+               doc/guides/nics/overview_table.txt
        dh_auto_clean
 
 override_dh_auto_configure:
-       dh_auto_configure -- \
+       dh_auto_configure -- $(DPDK_CONFIG_OPTIONS) \
                --includedir=include/dpdk \
+               --default-library=shared \
                -Dper_library_versions=false \
                -Dinclude_subdir_arch=../$(DEB_HOST_MULTIARCH)/dpdk \
-               -Dmachine=corei7 \
+               -Dmachine=$(RTE_MACHINE) \
                -Dkernel_dir=$(KSRC) \
                -Denable_kmods=$(DPDK_CONFIG_BUILD_KMOD)