summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:12:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:12:25 +0000
commit0013fdf36b7348479f57d989a014bdd9e8a656f1 (patch)
treecc90b6104296a98c953a704d6b0eab0ca5542010 /Makefile
parentInitial commit. (diff)
downloadisa-support-0013fdf36b7348479f57d989a014bdd9e8a656f1.tar.xz
isa-support-0013fdf36b7348479f57d989a014bdd9e8a656f1.zip
Adding upstream version 21.upstream/21
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile61
1 files changed, 61 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..5a7859a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,61 @@
+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 type,good static-good bad static-bad,$(foreach isa,$(ISAS),qemu-$(type)-$(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
+ALL_BINARIES = $(TEST_BINARIES) $(QEMU_BINARIES)
+
+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 $(GENERATED_FILES)
+ rm -f $(ALL_BINARIES)
+ 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