-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
31 lines (19 loc) · 788 Bytes
/
Makefile
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
LANG="C"
.SUFFIXES= .c .cpp .s .o .so .efi #.lds
ARCH := x86_64
%.efi: %.so
#Mine
objcopy -j .text -j .sdata -j .data -j .dynamic -j .dynsym \
-j .rel -j .rela -j .reloc -S --target=$(FORMAT) $^ $@
%.so: platform/$(ARCH)/relocation_func.o platform/$(ARCH)/start_func.o examples/%.o
$(LD) $(LDFLAGS) -o $@ $^ $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
%.S: %.c
$(CC) headers $(CFLAGS) $(CPPFLAGS) -S $< -o $@
CFLAGS = -I headers -ffreestanding -fno-exceptions -fno-gnu-unique \
-fno-stack-protector -fshort-wchar -fpic -Wall -Werror
ifeq ($(ARCH),x86_64)
CFLAGS += -m64 -mno-red-zone -maccumulate-outgoing-args
endif
CPPFLAGS = $(CFLAGS)
LDFLAGS = -t -T platform/$(ARCH)/linker-script.lds -Bsymbolic -shared -nostdlib -znocombreloc
FORMAT = efi-app-$(ARCH)