File: rules

package info (click to toggle)
seabios 1.12.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,348 kB
  • sloc: ansic: 52,658; asm: 1,850; cpp: 1,826; python: 850; yacc: 604; makefile: 550; perl: 416; lex: 363; sh: 287
file content (123 lines) | stat: -rwxr-xr-x 4,154 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
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1)))
DEB_VERSION = $(call dpkg_late_eval,DEB_VERSION,dpkg-parsechangelog -SVersion)
# everything after last minus sign
DEB_VERSION_RELEASE = $(call dpkg_late_eval,DEB_VERSION_RELEASE,echo '$(DEB_VERSION)' | sed -e 's/^.*-//')

VGABIOSES = cirrus stdvga virtio vmware qxl isavga
VGABIOS_TARGETS = $(addprefix build/vgabios-, $(addsuffix .bin, $(VGABIOSES)))
BIOS_TARGETS = build/bios.bin build/bios-256k.bin ${VGABIOS_TARGETS}
BUILD_TARGETS = $(BIOS_TARGETS) build/optionrom-stamp

build build-arch build-indep: $(BUILD_TARGETS)

# common rule to build any bios.
# $1: build target: bios or vgabios, builds $(OUT)/$1
# $2: config options to put into .config without CONFIG_ prefix
# $@: where to put output; build dir will be $(basename $@)
define build-bios
set -e; d=$(basename $@); \
if [ ! -e $$d/.config.old ]; then \
 rm -rf $$d; mkdir -p $$d; \
 for x in $2; do \
  case $$x in \
   (*=n) echo "# CONFIG_$${x%=*} is not set";; \
   (*) echo CONFIG_$$x;; \
  esac; \
 done > $$d/.config; \
 $(MAKE) KCONFIG_CONFIG=$(CURDIR)/$$d/.config OUT=$$d/ oldnoconfig; \
fi; \
$(MAKE) KCONFIG_CONFIG=$(CURDIR)/$$d/.config OUT=$$d/ EXTRAVERSION="-${DEB_VERSION_RELEASE}" $$d/$1.bin; \
rm -f $@; ln $$d/$1.bin $@
endef

build/bios.bin:
# A stripped-down version of bios, to fit in 128Kb, for qemu <= 1.7
	$(call build-bios,bios,QEMU=y ROM_SIZE=128 ATA_DMA=y PVSCSI=n BOOTSPLASH=n XEN=n USB_OHCI=n USB_XHCI=n USB_UAS=n SDCARD=n TCGBIOS=n MPT_SCSI=n NVME=n USE_SMM=n VGAHOOKS=n)
build/bios-256k.bin:
	$(call build-bios,bios,QEMU=y ROM_SIZE=256 ATA_DMA=y)

# upstream ships .hex files in tarball, result of iasl compilation
# ensure it is actually built during build
FWS = acpi-dsdt q35-acpi-dsdt ssdt-misc ssdt-pcihp ssdt-proc
FW_FILES = $(addsuffix .hex,$(addprefix src/fw/,${FWS}))

${BIOS_TARGETS}: build/env-stamp
build/env-stamp:
# upstream checks for .git and .version in scripts/buildversion.py
# .version comes in upstream tarball, and .git should not be there
	[ ! -d .git ] || { echo "Directory .git exists, aborting" >&2; exit 1; }
	[ -f .version ] || echo ${DEB_VERSION} | sed 's/-.*//' > .version
	mkdir -p build
# remove out shipped .hex files (iasl-compiled .dsl)
	rm -f ${FW_FILES}
	make OUT=build/ ${FW_FILES}
	touch $@

build/vgabios-cirrus.bin:
	$(call build-bios,vgabios,BUILD_VGABIOS=y VGA_CIRRUS=y VGA_PCI=y)
build/vgabios-stdvga.bin:
	$(call build-bios,vgabios,BUILD_VGABIOS=y VGA_BOCHS=y VGA_PCI=y)
build/vgabios-virtio.bin:
	$(call build-bios,vgabios,BUILD_VGABIOS=y VGA_BOCHS=y VGA_PCI=y \
		OVERRIDE_PCI_ID=y VGA_VID=0x1af4 VGA_DID=0x1050)
build/vgabios-vmware.bin:
	$(call build-bios,vgabios,BUILD_VGABIOS=y VGA_BOCHS=y VGA_PCI=y \
		OVERRIDE_PCI_ID=y VGA_VID=0x15ad VGA_DID=0x0405)
build/vgabios-qxl.bin:
	$(call build-bios,vgabios,BUILD_VGABIOS=y VGA_BOCHS=y VGA_PCI=y \
		OVERRIDE_PCI_ID=y VGA_VID=0x1b36 VGA_DID=0x0100)
build/vgabios-isavga.bin:
	$(call build-bios,vgabios,BUILD_VGABIOS=y VGA_BOCHS=y VGA_PCI=n)

build/optionrom-stamp:
	$(MAKE) -C debian/optionrom/
	chmod -x debian/optionrom/*.bin
	ln -s kvmvapic.bin debian/optionrom/vapic.bin
	mkdir -p $(dir $@) && touch $@

clean:
	dh_testdir
	rm -rf build/
	rm -f scripts/*pyc
	for f in src/fw/*.hex.sav; do [ ! -f $$f ] || mv -f $$f $${f%.sav}; done
# one file isn't shipped by upstream
	rm -f src/fw/q35-acpi-dsdt.hex
	$(MAKE) -C debian/optionrom/ clean
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	dh_install

# Build architecture-independent files here.
binary-arch: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installman
	dh_installchangelogs
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install