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
|
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
prefix?=/usr
exec_prefix?=$(prefix)
DESTDIR?=
libexecdir?=$(exec_prefix)/libexec
archlibexecdir?=$(exec_prefix)/libexec/$(DEB_HOST_MULTIARCH)
INSTALL?=install
uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
ISAS_ARCH_LIST:=$(shell cat isa-list | grep '^Architecture:' | cut -d ':' -f2 | sort -u)
ISAS_ARCH_FORUS:=$(call uniq, $(foreach isaarch, $(ISAS_ARCH_LIST), $(shell dpkg-architecture -a $(DEB_HOST_ARCH) -i $(isaarch) && echo $(isaarch))))
ISAS_ARCH_FORUS_GREP:=$(foreach isa, $(ISAS_ARCH_FORUS), -e '^Architecture:.*[[:space:]]$(isa)')
ISAS:= $(shell cat isa-list | grep -A1 ^Name | grep -B1 $(ISAS_ARCH_FORUS_GREP) -e 'FakeArchIsEmptySet' | grep ^Name | cut -d ' ' -f2)
TEST_BINARIES = $(foreach isa,$(ISAS),test-$(isa))
QEMU_BINARIES = $(foreach isa,$(ISAS),qemu-good-$(isa)) $(foreach isa,$(ISAS),qemu-bad-$(isa))
TEST_SOURCES = $(foreach isa,$(ISAS),test-$(isa).c)
GENERATED_FILES += $(foreach isa,$(ISAS),debian/$(isa).docs)
GENERATED_FILES += $(foreach isa,$(ISAS),debian/$(isa).lintian-overrides)
GENERATED_FILES += $(foreach isa,$(ISAS),debian/$(isa).preinst)
GENERATED_FILES += $(foreach isa,$(ISAS),debian/$(isa).templates)
GENERATED_FILES += $(TEST_SOURCES)
ALL_GENERATED_FILES += $(GENERATED_FILES) debian/control
INPUT_FILES = $(wildcard debian/*.in)
CFLAGS ?=
CFLAGS += -Wall
CFLAGS += $(shell cat isa-list | sed -e 's/^Name: /Name: test-/' | grep $@ -A3 | grep '^CFLAGS:' | cut -d ' ' -f2-)
all: $(TEST_BINARIES)
@:
clean:
rm -f $(TEST_BINARIES)
rm -f $(GENERATED_FILES)
rm -f .last-refresh
install:
mkdir -p $(DESTDIR)/$(archlibexecdir)/isa-support
for bin in $(TEST_BINARIES); do $(INSTALL) $$bin $(DESTDIR)/$(archlibexecdir)/isa-support; done
for bin in $(QEMU_BINARIES); do if test -e $$bin; then $(INSTALL) $$bin $(DESTDIR)/$(archlibexecdir)/isa-support; fi; done
refresh: $(ALL_GENERATED_FILES) $(TEST_SOURCES)
@:
$(GENERATED_FILES): .last-refresh
@:
.last-refresh: refresh-package $(INPUT_FILES)
./refresh-package
touch $@
.PHONY: all clean refresh
|