#!/usr/bin/make -f include /usr/share/dpkg/pkg-info.mk include /usr/share/dpkg/buildopts.mk CHANGELOG_DATE ?= $(shell LC_ALL=C date -u -d @$(SOURCE_DATE_EPOCH) +"%d %B %Y") export DH_VERBOSE=1 export DEB_BUILD_MAINT_OPTIONS = hardening=+all export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed BUILDDIR=$(CURDIR)/debian/build ARCH=generic;ice40;ecp5;himbaechel HIMBAECHEL_UARCH=gowin;gatemate;xilinx HIMBAECHEL_GOWIN_DEVICES=all %: dh $@ NO_GUI_PACKAGES = \ -Nnextpnr-ice40-qt \ -Nnextpnr-ecp5-qt \ -Nnextpnr-himbaechel-gowin-qt \ -Nnextpnr-himbaechel-gatemate-qt \ -Nnextpnr-himbaechel-xilinx-qt CMAKE_FLAGS := \ -DCURRENT_GIT_VERSION="$(DEB_VERSION)" \ -DBUILD_PYTHON=ON \ -DBUILD_TESTS=ON \ -DEXTERNAL_CHIPDB=ON \ -DARCH='$(ARCH)' \ -DICEBOX_DATADIR=/usr/share/fpga-icestorm/chipdb \ -DICESTORM_INSTALL_PREFIX=/usr/share/fpga-icestorm/chipdb \ -DTRELLIS_LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH)/trellis/ \ -DTRELLIS_DATADIR=/usr/share/trellis/ \ -DHIMBAECHEL_UARCH='$(HIMBAECHEL_UARCH)' \ -DHIMBAECHEL_SPLIT=ON \ -DHIMBAECHEL_GOWIN_DEVICES=$(HIMBAECHEL_GOWIN_DEVICES) \ -DHIMBAECHEL_PEPPERCORN_PATH=/usr/share/peppercorn \ -DHIMBAECHEL_PRJXRAY_DB=/usr/share/prjxray/database HELP2MAN_FLAGS = \ --name="Next Generation Place and Route" \ --version-string="$(DEB_VERSION)" \ --section=1 \ --manual="General Commands" \ --no-info \ --no-discard-stderr override_dh_auto_clean: rm -rf $(BUILDDIR) rm -f debian/nextpnr-*.1 dh_auto_clean override_dh_auto_configure: dh_auto_configure \ --arch \ $(NO_GUI_PACKAGES) \ -B$(BUILDDIR)/cli \ -- \ $(CMAKE_FLAGS) \ -DBUILD_GUI=OFF \ -DEXPORT_BBA_FILES=$(BUILDDIR)/bba dh_auto_configure \ --arch \ --remaining-packages \ -B$(BUILDDIR)/gui \ -- \ $(CMAKE_FLAGS) \ -DBUILD_GUI=ON \ -DIMPORT_BBA_FILES=$(BUILDDIR)/bba # Building the BBA files requires about 5GB in the worst case, so determine # how many of those we can fit into the current machine. There are about 8 # of these processes, so above that number, the memory limit is less # relevant, and we benefit more from mixing BBA generation and normal # compilation. CONCURRENCY_BBA=$(shell guess_concurrency --max 8 --require-mem 5G) CONCURRENCY_DEF=$(shell guess_concurrency --max 8) override_dh_auto_build: ifneq ($(CONCURRENCY_BBA),$(CONCURRENCY_DEF)) dh_auto_build \ --arch \ $(NO_GUI_PACKAGES) \ -B$(BUILDDIR)/cli \ -- \ -j$(CONCURRENCY_BBA) \ nextpnr-all-bba endif dh_auto_build \ --arch \ $(NO_GUI_PACKAGES) \ -B$(BUILDDIR)/cli dh_auto_build \ --arch \ --remaining-packages \ -B$(BUILDDIR)/gui override_dh_auto_test: dh_auto_test \ --arch \ -B$(BUILDDIR)/cli #dh_auto_test -B$(BUILDDIR)/gui override_dh_auto_install: dh_auto_install \ --arch \ $(NO_GUI_PACKAGES) \ -B$(BUILDDIR)/cli \ --destdir=debian/tmp/cli dh_auto_install \ --arch \ --remaining-packages \ -B$(BUILDDIR)/gui \ --destdir=debian/tmp/gui override_dh_install: dh_install \ --arch \ $(NO_GUI_PACKAGES) \ --sourcedir=debian/tmp/cli dh_install \ --arch \ --remaining-packages \ --sourcedir=debian/tmp/gui define help2man help2man \ $(HELP2MAN_FLAGS) \ debian/tmp/$(1)/usr/bin/$(2) \ > debian/tmp/$(1)/$(2).1 endef override_dh_installman: $(foreach prog,$(notdir $(wildcard debian/tmp/cli/usr/bin/nextpnr-*)),$(call help2man,cli,$(prog))) $(foreach prog,$(notdir $(wildcard debian/tmp/gui/usr/bin/nextpnr-*)),$(call help2man,gui,$(prog))) dh_installman \ --arch \ $(NO_GUI_PACKAGES) \ --sourcedir=debian/tmp/cli dh_installman \ --arch \ --remaining-packages \ --sourcedir=debian/tmp/gui override_dh_installexamples: dh_installexamples --exclude=.gitignore