File: rules

package info (click to toggle)
nextpnr 0.9-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 45,032 kB
  • sloc: cpp: 218,128; python: 24,276; ansic: 10,907; pascal: 1,328; sh: 849; makefile: 563; vhdl: 44; objc: 42; tcl: 41
file content (120 lines) | stat: -rwxr-xr-x 3,636 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/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 \
    ecp5-qt ecp5 \
    himbaechel-qt himbaechel \
#

%:
	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_himbaechel := \
    $(CMAKE_FLAGS_common) \
    -DARCH=himbaechel \
    -DHIMBAECHEL_UARCH=gowin \
    -DHIMBAECHEL_SPLIT=ON \
    -DHIMBAECHEL_GOWIN_DEVICES=all

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-ecp5-qt/usr/bin/nextpnr-ecp5 > debian/nextpnr-ecp5.1
	help2man $(HELP2MAN_FLAGS) debian/nextpnr-himbaechel-qt/usr/bin/nextpnr-himbaechel-gowin > debian/nextpnr-himbaechel-gowin.1
	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-$*

execute_before_dh_install:
	for comp in $(filter %-qt,$(COMPONENTS)); do \
	  rm -rv debian/nextpnr-$$comp/usr/share; \
	done

	set -x; \
	for comp in $(filter-out %-qt,$(COMPONENTS)); do \
	  dir=usr/share/nextpnr/$$comp; \
	  if [ -d debian/nextpnr-$$comp/$$dir ]; then \
	    mkdir -p debian/tmp/$$dir && rm -r debian/tmp/$$dir && \
	    mv -viT debian/nextpnr-$$comp/$$dir debian/tmp/$$dir </dev/null; \
	  fi; \
	done