blob: 110d34821cca4d6cf3787c8d48dbe9a60da5710b (
plain)
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
|
CC ?= gcc
CFLAGS ?= -Os -g
CFLAGS += -Wall
CVETEST := cve-2016-3712
PCITEST := cve-2017-2615 cve-2017-2620
USBTEST := cve-2017-5898
RAWTEST := boot-cve-2017-13672.raw boot-cve-2017-13673.raw
TARGETS := $(CVETEST) $(PCITEST) $(USBTEST) $(RAWTEST)
DEPENDS := libpci libusb-1.0
$(PCITEST) : CFLAGS += $(shell pkg-config --cflags libpci)
$(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:
rm -f $(TARGETS)
rm -f *~ *.o
boot-%.raw: boot-%.asm
nasm -o $@ $<
cve-2017-2615: cve-2017-2615.o pci.o cirrus.o
cve-2017-2620: cve-2017-2620.o pci.o cirrus.o
cve-2017-5898: cve-2017-5898.o usb.o
|