-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile.uefi.common
40 lines (34 loc) · 1.34 KB
/
Makefile.uefi.common
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
EXE_CC = clang
RM = rm -f
STRIP = $(CROSS_COMPILE)strip
ARCH_DEFAULT != echo `$(EXE_CC) -dumpmachine` | tr "-" "\n" | \
head -n 1 | \
sed 's/i[3456]86/x86/;s/x86_64/x86/;s/amd64/x86/'
ARCH ?= $(ARCH_DEFAULT)
TARGET_x86 = -target x86_64-unknown-windows
TARGET_aarch64 = -target aarch64-unknown-windows
TARGET = $(TARGET_$(ARCH))
CFLAGS_x86 = -mno-red-zone -mno-sse -I$(EDK2_INC)/X64
CFLAGS_aarch64 = -march=armv8-a -mgeneral-regs-only -mstrict-align \
-I$(EDK2_INC)/AArch64
CFLAGS_ARCH = $(CFLAGS_$(ARCH))
# We use clang to call lld-link for us instead of using lld-link directly
# because on some platforms, lld-link is not symlinked by default.
#
# About for stripping symbols, the caller should use 'strip' command if it
# wants to. Old lld-link does not have an option for stripping symbol.
LDFLAGS = -nostdlib -fuse-ld=lld -Wl,-dll -Wl,-nodefaultlib \
$(TARGET)
LDFLAGS_EFI_APP = -Wl,-entry:efi_main -Wl,-subsystem:efi_application
LDFLAGS_EFI_BSDRV = -Wl,-entry:EfiDriverEntryPoint \
-Wl,-subsystem:efi_boot_service_driver
CFLAGS = -nostdinc -O -ffreestanding -fno-builtin \
-fno-stack-protector -fno-strict-aliasing -fno-PIE -MMD \
-Wno-microsoft-static-assert $(TARGET) $(CFLAGS_ARCH)\
-I. \
-I$(INC_SHARE_DIR) \
-I$(EDK2_INC)
.SUFFIXES :
.SUFFIXES : .c .o
.c.o :
$(EXE_CC) $(CFLAGS) -c $< -o $@