File: rules

package info (click to toggle)
pocl 1.3-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 15,252 kB
  • sloc: lisp: 113,066; ansic: 60,134; cpp: 21,335; sh: 164; makefile: 147; pascal: 142; java: 72; xml: 49; python: 18
file content (127 lines) | stat: -rwxr-xr-x 4,697 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
121
122
123
124
125
126
127
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#DH_VERBOSE = 1

# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/pkg-info.mk

# When updating this variable, do not forget to adapt the build-depends
# in debian/control
LLVM_VERSION=8

# see FEATURE AREAS in dpkg-buildflags(1)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# package maintainers to append LDFLAGS
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

LLVM_ARCH-amd64			 = distro
#LLVM_ARCH-amd64			 = x86-64
#LLVM_ARCH-arm64			 = generic
LLVM_ARCH-armel			 = arm946e-s		# arch=armv5te
# armhf should rather be arch=armv7-a, e.g. cpu=cortex-a5 or similar with attr=+vfp3,+d16,+thumb2,-neon,-vfp4
LLVM_ARCH-armhf			 = arm1156t2f-s
LLVM_ARCH-hurd-i386		 = $(LLVM_ARCH-i386)
LLVM_ARCH-i386			 = i686			# clang targets pentium4 by default
LLVM_ARCH-kfreebsd-amd64	 = $(LLVM_ARCH-amd64)
LLVM_ARCH-kfreebsd-i386		 = $(LLVM_ARCH-i386)
#LLVM_ARCH-mips			 = mips32r2 # guess
#LLVM_ARCH-mips64el		 = mips64r2 # guess
#LLVM_ARCH-mipsel		 = mips32r2 # guess
#LLVM_ARCH-powerpc		 = ppc
#LLVM_ARCH-ppc64			 = ppc64 # guess
#LLVM_ARCH-ppc64el		 = ppc64le
#LLVM_ARCH-s390x			 = z10
#LLVM_ARCH-sparc64		 = v8 # guess
LLVM_ARCH-x32			 = $(LLVM_ARCH-amd64)

LLC_HOST_CPU	 = $(or $(patsubst pocl_cpu=%,%,$(filter pocl_cpu=%,$(DEB_BUILD_OPTIONS))),$(LLVM_ARCH-$(DEB_HOST_ARCH)),GENERIC)

# NEON, optional for Debian, must not be used
EXTRA_HOST_CLANG_FLAGS-armhf	 = -mfpu=vfp3-d16
# TODO: export KERNEL_LIB_OPT_FLAGS= -mattr=-neon,+d16,+vfp3,-vfp4,+v7,+aclass,+thumb2

# doc for symbols:
# http://www.eyrie.org/~eagle/journal/2012-01/008.html
# main packaging script based on dh7 syntax
%:
	dh $@ --with pkgkde_symbolshelper --with sphinxdoc --buildsystem=cmake

getval			 = $(or $($1-$(DEB_HOST_ARCH)),$($1))
var2flag		 = $(if $(strip $(call getval,$1)),-D$1="$(call getval,$1)")
POCL_CONFIGURE_FLAGS	 =
POCL_CONFIGURE_FLAGS	+= -DENABLE_ICD=yes
POCL_CONFIGURE_FLAGS	+= -DWITH_LLVM_CONFIG=/usr/bin/llvm-config-$(LLVM_VERSION)
POCL_CONFIGURE_FLAGS	+= $(if $(filter distro,$(LLC_HOST_CPU)),-DLLC_HOST_CPU=GENERIC -DKERNELLIB_HOST_CPU_VARIANTS=distro,-DLLC_HOST_CPU=$(LLC_HOST_CPU))
POCL_CONFIGURE_FLAGS	+= $(call var2flag,EXTRA_HOST_CLANG_FLAGS)
POCL_CONFIGURE_FLAGS	+= -DPOCL_ICD_ABSOLUTE_PATH=OFF

override_dh_auto_configure:
	@echo Using LLC_HOST_CPU=$(LLC_HOST_CPU)
	-/usr/lib/llvm-$(LLVM_VERSION)/bin/llc -version
	-/usr/lib/llvm-$(LLVM_VERSION)/bin/llc -mattr=help
	dh_auto_configure -- $(POCL_CONFIGURE_FLAGS)

override_dh_auto_build-indep:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	sphinx-build -N -b html doc/sphinx/source build-doc/html
else
	mkdir -p build-doc/html
endif

override_dh_shlibdeps:
	dh_shlibdeps -a -- --warnings=7

override_dh_missing:
	dh_missing --list-missing

override_dh_auto_test-indep:
override_dh_auto_test-arch:
	# Failure in testsuite is delayed until symbols handling
	# and all files are logged.
	$(RM) debian/stamp-failed-testsuite
	$(RM) -r debian/kcache
	mkdir debian/kcache
	env POCL_CACHE_DIR=$(CURDIR)/debian/kcache \
		OCL_ICD_VENDORS=$(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)/ocl-vendors/pocl-tests.icd \
		POCL_BUILDING=1 POCL_DEVICES=basic clinfo
	env POCL_CACHE_DIR=$(CURDIR)/debian/kcache \
		OCL_ICD_VENDORS=$(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)/ocl-vendors/pocl-tests.icd \
		POCL_BUILDING=1 clinfo
	@set -ex; if ! env POCL_CACHE_DIR="$(CURDIR)/debian/kcache" dh_auto_test ; then \
		echo "***** The testsuite has failed! *****" ; \
		touch debian/stamp-failed-testsuite; \
	fi
	$(RM) -r debian/kcache

run_dh_makeshlibs:
	dh_makeshlibs

delayed_check_dh_auto_test_result: run_dh_makeshlibs
	@set -ex; if test -f debian/stamp-failed-testsuite ; then \
		echo "***** The testsuite has failed! *****" ; \
		exit 1 ; \
	fi
	@test -f obj-*/Testing/Temporary/LastTest.log && echo 'The testsuite has passed all tests.' || echo '*** The testsuite was *NOT* run! ***'

override_dh_makeshlibs: run_dh_makeshlibs delayed_check_dh_auto_test_result

# fails on 32-bit: #918903
override_dh_dwz:

override_dh_gencontrol:
	dh_gencontrol -- \
		-V'LLVM:Version=$(LLVM_VERSION)' \
	        -V'Built-Using:clang=$(shell dpkg-query -f '$${source:Package} (= $${source:Version})' -W libclang-$(LLVM_VERSION)-dev)' \


fix-symbols:
	pkgkde-getbuildlogs
	echo "pkgkde-symbolshelper batchpatch -v $(DEB_VERSION_EPOCH_UPSTREAM) pocl_$(DEB_DISTRIBUTION)_logs/pocl_$(DEB_VERSION)_*build"