#!/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 MAKEFILE := $(firstword $(MAKEFILE_LIST)) COMPONENTS := \ generic \ ice40-qt ice40 \ gowin-qt gowin \ ecp5-qt ecp5 \ # ifneq ($(filter pkg.nextpnr.himbaechel,$(DEB_BUILD_PROFILES)),) COMPONENTS += himbaechel-qt himbaechel endif %: dh $@ CMAKE_FLAGS_common := \ -DCURRENT_GIT_VERSION="$(DEB_VERSION)" \ -DBUILD_PYTHON=ON \ -DBUILD_TESTS=ON \ -DEXTERNAL_CHIPDB=ON CMAKE_FLAGS_generic := \ $(CMAKE_FLAGS_common) \ -DARCH=generic CMAKE_FLAGS_ice40 := \ $(CMAKE_FLAGS_common) \ -DARCH=ice40 \ -DICEBOX_DATADIR=/usr/share/fpga-icestorm/chipdb \ -DICESTORM_INSTALL_PREFIX=/usr/share/fpga-icestorm/chipdb CMAKE_FLAGS_ecp5 := \ $(CMAKE_FLAGS_common) \ -DTRELLIS_LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH)/trellis/ \ -DTRELLIS_DATADIR=/usr/share/trellis/ \ -DARCH=ecp5 CMAKE_FLAGS_gowin := \ $(CMAKE_FLAGS_common) \ -DARCH=gowin CMAKE_FLAGS_himbaechel := \ $(CMAKE_FLAGS_common) \ -DARCH=himbaechel CMAKE_FLAGS_ice40-qt := $(CMAKE_FLAGS_ice40) -DBUILD_GUI=ON CMAKE_FLAGS_ice40 := $(CMAKE_FLAGS_ice40) -DBUILD_GUI=OFF CMAKE_FLAGS_ecp5-qt := $(CMAKE_FLAGS_ecp5) -DBUILD_GUI=ON CMAKE_FLAGS_ecp5 := $(CMAKE_FLAGS_ecp5) -DBUILD_GUI=OFF CMAKE_FLAGS_gowin-qt := $(CMAKE_FLAGS_gowin) -DBUILD_GUI=ON CMAKE_FLAGS_gowin := $(CMAKE_FLAGS_gowin) -DBUILD_GUI=OFF CMAKE_FLAGS_himbaechel-qt := $(CMAKE_FLAGS_himbaechel) -DBUILD_GUI=ON CMAKE_FLAGS_himbaechel := $(CMAKE_FLAGS_himbaechel) -DBUILD_GUI=OFF 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 override_dh_auto_build override_dh_auto_test override_dh_auto_install: +$(MAKE) -f$(MAKEFILE) $(DEB_BUILD_OPTION_PARALLEL:%=-j%) \ $(patsubst %,$(subst override_dh_auto_,,$@)/%,$(COMPONENTS)) override_dh_installman: help2man $(HELP2MAN_FLAGS) debian/nextpnr-generic/usr/bin/nextpnr-generic > debian/nextpnr-generic.1 help2man $(HELP2MAN_FLAGS) debian/nextpnr-ice40-qt/usr/bin/nextpnr-ice40 > debian/nextpnr-ice40.1 help2man $(HELP2MAN_FLAGS) debian/nextpnr-gowin-qt/usr/bin/nextpnr-gowin > debian/nextpnr-gowin.1 help2man $(HELP2MAN_FLAGS) debian/nextpnr-ecp5-qt/usr/bin/nextpnr-ecp5 > debian/nextpnr-ecp5.1 ifneq ($(filter pkg.nextpnr.himbaechel,$(DEB_BUILD_PROFILES)),) help2man $(HELP2MAN_FLAGS) debian/nextpnr-himbaechel-qt/usr/bin/nextpnr-himbaechel > debian/nextpnr-himbaechel.1 endif dh_installman override_dh_installexamples: dh_installexamples --exclude=.gitignore configure/%: dh_auto_configure -B$(BUILDDIR)/$* -- $(CMAKE_FLAGS_$*) # HACK: dh_auto_build strips the MAKEFLAGS jobserver option. Prevent this # by calling make manually. build/%: cd $(BUILDDIR)/$* && exec $(MAKE) "INSTALL=install --strip-program=true" test/%: dh_auto_test -B$(BUILDDIR)/$* install/%: ARCH=$(subst -qt,,$*) install/%: dh_auto_install -B$(BUILDDIR)/$* --destdir=$(CURDIR)/debian/nextpnr-$* if [ $(ARCH) != generic ] && [ -z "$(filter %-qt,$*)" ]; then \ install -D --mode=0644 -t \ $(CURDIR)/debian/nextpnr-$*-chipdb/usr/share/nextpnr/$(ARCH)/ \ $(BUILDDIR)/$*/$(ARCH)/chipdb/*.bin; fi