2 # See debhelper(7) (uncomment to enable)
3 # output every command that modifies files on the build system.
7 VERSION := $(shell dpkg-parsechangelog | sed -nr '/^Version:/s/Version: (.*:)?(.*)-(.*)/\2/p')
9 # see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
10 include /usr/share/dpkg/default.mk
12 DEB_HOST_GNU_CPU := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
14 # see FEATURE AREAS in dpkg-buildflags(1)
15 export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie
17 # see ENVIRONMENT in dpkg-buildflags(1)
18 # package maintainers to append CFLAGS
19 export DEB_CFLAGS_MAINT_APPEND = -fPIC
20 # package maintainers to append LDFLAGS
21 #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
23 include /usr/share/dpkg/buildflags.mk
24 export EXTRA_CFLAGS=$(CFLAGS)
25 # need to be stripped as DPDK build system adds them and it would be -Wl,-Wl,opt
26 export EXTRA_LDFLAGS=$(shell echo $(LDFLAGS) | sed 's/-Wl,//g')
28 # People rebuilding this package can overwrite DPDK_CONFIG, RTE_MACHINE and
29 # RTE_TARGET via environment variables if they like
30 ifneq (,$(filter $(DEB_HOST_ARCH), arm64))
31 DPDK_CONFIG := "arm64-armv8a-linuxapp-gcc"
32 RTE_MACHINE := "armv8a"
33 RTE_TARGET := "arm64-armv8a-linuxapp-gcc"
35 DPDK_CONFIG := "$(DEB_HOST_GNU_CPU)-native-linuxapp-gcc"
36 RTE_MACHINE := "default"
37 RTE_TARGET := "$(DEB_HOST_GNU_CPU)-default-linuxapp-gcc"
39 DPDK_STATIC_DIR = "debian/build/static-root"
40 DPDK_SHARED_DIR = "debian/build/shared-root"
44 rm -rf debian/build debian/tmp
49 # report dpkg-buildflags status to build log
50 dpkg-buildflags --status
51 echo EXTRA_CFLAGS $$EXTRA_CFLAGS
52 echo EXTRA_LDFLAGS: $$EXTRA_LDFLAGS
53 $(MAKE) V=$(DH_VERBOSE) O=$(DPDK_STATIC_DIR) T=$(DPDK_CONFIG) config
54 sed -ri -e 's,(RTE_MACHINE=).*,\1$(RTE_MACHINE),' \
55 -e 's,(RTE_NEXT_ABI=).*,\1n,' \
56 -e 's,(CONFIG_RTE_EAL_IGB_UIO=).*,\1n,' \
57 -e 's,(CONFIG_RTE_KNI_KMOD=).*,\1n,' \
58 -e 's,(LIBRTE_PMD_PCAP=).*,\1y,' \
59 -e 's,(LIBRTE_PMD_XENVIRT=).*,\1y,' \
60 $(DPDK_STATIC_DIR)/.config
62 build-indep: build-config
64 $(MAKE) V=$(DH_VERBOSE) O=$(DPDK_STATIC_DIR) doc-api-html doc-guides-html
66 build-arch: build-config
68 $(MAKE) V=$(DH_VERBOSE) O=$(DPDK_STATIC_DIR) build
69 # Unfortunately the decision about having static or shared libraries is
70 # made for the whole build, which then produces only .a or .so files
72 # And the target layout for target selection has no field for the
74 # Right now I hack this by doing a second build which only differs in
75 # the selection of shared libs.
76 # Shared libs should be default, so the previous static build is only
77 # used to get static libraries.
78 cp -a $(DPDK_STATIC_DIR) $(DPDK_SHARED_DIR)
79 sed -ri 's,(RTE_BUILD_SHARED_LIB=).*,\1y,' \
80 $(DPDK_SHARED_DIR)/.config
81 $(MAKE) V=$(DH_VERBOSE) O=$(DPDK_SHARED_DIR) build
83 build: build-arch build-indep
85 binary-indep: PACKAGE_NAME=dpdk-doc
86 binary-indep: DOCDIR=usr/share/doc/dpdk
87 binary-indep: export DH_OPTIONS=--indep
98 # All files based on the install-doc rule (includes examples)
99 $(MAKE) V=$(DH_VERBOSE) O=$(DPDK_STATIC_DIR) prefix=/usr \
100 DESTDIR=debian/dpdk-doc install-doc
109 binary-arch: LIBDIR=usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
110 binary-arch: export DH_OPTIONS=--arch
121 dh_installinit --no-start --no-restart-on-upgrade
122 dh_systemd_start --no-start --no-restart-on-upgrade
123 # Package: dpdk (runtime)
124 $(MAKE) V=$(DH_VERBOSE) O=$(DPDK_STATIC_DIR) prefix=/usr \
125 DESTDIR=debian/dpdk install-runtime
126 $(MAKE) V=$(DH_VERBOSE) O=$(DPDK_SHARED_DIR) prefix=/usr \
127 DESTDIR=debian/dpdk install-runtime
128 cp debian/dpdk.interfaces debian/dpdk/etc/dpdk/interfaces
129 rm debian/dpdk/usr/sbin/dpdk-devbind
130 mkdir -p debian/dpdk/sbin
131 ln -s /usr/share/dpdk/tools/dpdk-devbind.py \
132 debian/dpdk/sbin/dpdk-devbind
133 # Package: dpdk-dev (build environment)
134 $(MAKE) V=$(DH_VERBOSE) O=$(DPDK_SHARED_DIR) prefix=/usr \
135 DESTDIR=debian/dpdk-dev install-sdk
136 cp $(DPDK_SHARED_DIR)/.config debian/dpdk-dev/usr/share/dpdk/config
137 sed -e 's/SDK_TARGET/$(RTE_TARGET)/' debian/dpdk-sdk-env.sh.in > \
138 debian/dpdk-dev/usr/share/dpdk/dpdk-sdk-env.sh
139 # Package: libdpdk-dev (bare headers, static devel libs and linker
141 mkdir -p debian/libdpdk-dev/$(LIBDIR)
143 mv debian/dpdk/usr/lib/libdpdk.so debian/libdpdk-dev/$(LIBDIR)/
145 mkdir -p debian/libdpdk-dev/usr/include
146 mv debian/dpdk-dev/usr/include/dpdk debian/libdpdk-dev/usr/include/
147 # all static libs are in the dev package
148 mv debian/dpdk/usr/lib/lib*.a debian/libdpdk-dev/$(LIBDIR)/
149 # symlinks to last .so's are in the non versioned libdpdk-dev as well
150 # this allows multiple libdpdk-<NAME><VER> at different VER concurrently
151 # libdpdk-dev depends on all sublibs so symlinks are never broken
152 mv debian/dpdk/usr/lib/*.so debian/libdpdk-dev/$(LIBDIR)/
153 # Package(s): libdpdk-<NAME><VER> (bare runtime libs)
154 for lib in $$(ls -1 debian/dpdk/usr/lib/*.so.*); do \
155 BN=$$(basename $${lib}); \
156 VER=$$(echo $${BN} | sed -e 's/^.*\.so\.//'); \
157 LN=$$(echo $${BN} | sed -e 's/\.so\.[0-9]*$$//' | tr '_' '-'); \
158 if echo $${LN} | grep -q ".*[0-9]$$"; then \
159 PKG=$${LN}-$${VER}; \
163 echo "moving $${lib} for library $${PKG}"; \
164 mkdir -p debian/$${PKG}/$(LIBDIR); \
165 mv $${lib} debian/$${PKG}/$(LIBDIR); \
168 mkdir -p debian/libdpdk-dev/$(LIBDIR)/pkgconfig
169 LIBS=$$(sed -e 's/GROUP ( \(.*\) )/\1/' -e 's/lib/-l/g' -e 's/\.so//g' \
170 $(CURDIR)/debian/libdpdk-dev/$(LIBDIR)/libdpdk.so); \
171 sed -e "s/@DPDK_LIBS@/$${LIBS}/" -e "s/@VERSION@/$(VERSION)/" \
172 debian/libdpdk.pc.in > debian/libdpdk-dev/$(LIBDIR)/pkgconfig/libdpdk.pc
173 # Package: dpdk-igb-uio-dkms
174 mkdir -p debian/dpdk-igb-uio-dkms/usr/src/dpdk-igb-uio-$(VERSION)
175 cp lib/librte_eal/linuxapp/igb_uio/* \
176 debian/dpdk-igb-uio-dkms/usr/src/dpdk-igb-uio-$(VERSION)
177 # Package: dpdk-rte-kni-dkms
178 mkdir -p debian/dpdk-rte-kni-dkms/usr/src/dpdk-rte-kni-$(VERSION)
179 cp -a lib/librte_eal/linuxapp/kni/* \
180 debian/dpdk-rte-kni-dkms/usr/src/dpdk-rte-kni-$(VERSION)
181 dh_dkms -V $(VERSION)
195 binary: binary-arch binary-indep