File: Makefile

package info (click to toggle)
stubble 7-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 912 kB
  • sloc: ansic: 6,121; python: 738; makefile: 41
file content (45 lines) | stat: -rw-r--r-- 1,117 bytes parent folder | download | duplicates (2)
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
# SPDX-License-Identifier: LGPL-2.1-or-later

ARCH?=		$(shell uname -m)
PREFIX?=	/usr/local
MIN_SECTIONS?=2048

include ./Make.defaults

ifeq ($(ARCH),x86_64)
	CFLAGS += -m64 -march=x86-64 -mno-red-zone -mgeneral-regs-only -maccumulate-outgoing-args
	LDFLAGS += -m64
endif
ifeq ($(ARCH),aarch64)
	CFLAGS += -mgeneral-regs-only
endif

OBJS = devicetree.o efi-log.o efi-string.o linux.o stub.o util.o uki.o smbios.o initrd.o pe.o \
	chid.o edid.o sha1.o measure.o

.PHONY: all clean install

all: stubble.efi

%.o: %.c
	$(CC) $< $(CFLAGS) -c -o $@

stubble.efi: stubble
	./elf2efi.py --version-major=6 --version-minor=16 \
	    --efi-major=1 --efi-minor=1 --subsystem=10 \
	    --minimum-sections=${MIN_SECTIONS} \
	    --copy-sections=".sbat" $< $@

stubble: $(OBJS)
	$(CC) -o $@ $^ $(LDFLAGS)

install: stubble.efi
	install -m 755 -d ${DESTDIR}${PREFIX}/lib/stubble
	install -m 644 -t ${DESTDIR}${PREFIX}/lib/stubble stubble.efi
	install -m 755 -d ${DESTDIR}${PREFIX}/share/stubble/hwids
	install -m 644 -t ${DESTDIR}${PREFIX}/share/stubble/hwids hwids/json/*

clean:
	rm -f $(OBJS)
	rm -f stubble
	rm -f stubble.efi