summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2017-02-21 08:34:37 +0100
committerGerd Hoffmann <kraxel@redhat.com>2017-02-21 08:34:37 +0100
commit7586f669b31a2a758f765eb0863176e3e7a27822 (patch)
tree8af32e9bd545140ee85d7d880ae2080b7085be8c /Makefile
parentefd56db22fa3f4ce3a6361743cc7487cfaf57871 (diff)
downloadqemu-security-7586f669b31a2a758f765eb0863176e3e7a27822.tar.gz
add build dep check
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 20 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index afb1f89..8876164 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,7 @@ CVETEST := cve-2016-3712
PCITEST := cve-2017-2615
USBTEST := cve-2017-5898
TARGETS := $(CVETEST) $(PCITEST) $(USBTEST)
+DEPENDS := libpci libusb-1.0
$(PCITEST) : CFLAGS += $(shell pkg-config --cflags libpci)
$(PCITEST) : LDLIBS += $(shell pkg-config --libs libpci)
@@ -14,6 +15,25 @@ $(PCITEST) : LDLIBS += $(shell pkg-config --libs libpci)
$(USBTEST) : CFLAGS += $(shell pkg-config --cflags libusb-1.0)
$(USBTEST) : LDLIBS += $(shell pkg-config --libs libusb-1.0)
+#
+# handle build dependencies
+#
+HAVEDEPS := $(shell pkg-config $(DEPENDS) && echo yes)
+ifneq ($(HAVEDEPS),yes)
+.PHONY: deps
+deps:
+ @echo "Build dependencies are missing, needed: $(DEPENDS)"
+ @echo "Please install. You can use 'make yum' or 'make dnf'."
+ @false
+
+yum dnf:
+ sudo $@ install $(patsubst %,"pkgconfig(%)",$(DEPENDS))
+
+endif
+
+#
+# build rules
+#
all: $(TARGETS)
clean: