File: rules

package info (click to toggle)
gnu-efi 3.0.9-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,464 kB
  • sloc: ansic: 16,541; asm: 1,651; makefile: 241
file content (58 lines) | stat: -rwxr-xr-x 1,642 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/make -f

DEB_HOST_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU)
DEB_BUILD_ARCH_OS ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)

# Cross building support
ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
export CROSS_COMPILE = $(DEB_HOST_GNU_TYPE)-
endif

# The architecture we are building on
ifeq (i386,$(DEB_BUILD_ARCH_CPU))
	BUILD_ARCH := ia32
else ifeq (amd64,$(DEB_BUILD_ARCH_CPU))
	BUILD_ARCH := x86_64
else
	BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_GNU_CPU)
endif

# The architecture we are building for
ifeq (i386,$(DEB_BUILD_ARCH_CPU))
	HOST_ARCH := ia32
	ifeq (linux,$(DEB_BUILD_ARCH_OS))
		COMPAT_ARCH := x86_64
		COMPAT_APPEND := 64
	endif
else ifeq (amd64,$(DEB_BUILD_ARCH_CPU))
	HOST_ARCH := x86_64
	COMPAT_ARCH := ia32
	COMPAT_APPEND := 32
else
	# ARM CPUs
	HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
endif

%:
	dh $@

override_dh_auto_clean:
	$(MAKE) clean ARCH=$(HOST_ARCH)
ifneq (,$(COMPAT_ARCH))
		$(MAKE) clean ARCH=$(COMPAT_ARCH) HOSTARCH=$(BUILD_ARCH)
endif

override_dh_auto_build:
	$(MAKE) ARCH=$(HOST_ARCH)
ifneq (,$(COMPAT_ARCH))
		$(MAKE) ARCH=$(COMPAT_ARCH) HOSTARCH=$(BUILD_ARCH)
endif

# Fixme: This somehow rebuilds some parts
override_dh_auto_install:
	$(MAKE) install ARCH=$(HOST_ARCH) INSTALLROOT=$(CURDIR)/debian/gnu-efi PREFIX=/usr LIBDIR=/usr/lib
ifneq (,$(COMPAT_ARCH))
	$(MAKE) install ARCH=$(COMPAT_ARCH) HOSTARCH=$(BUILD_ARCH) INSTALLROOT=$(CURDIR)/debian/gnu-efi PREFIX=/usr LIBDIR=/usr/lib$(COMPAT_APPEND)
endif