-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
90 lines (72 loc) · 1.65 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
##
## Makefile for WinClear in /home/arthur.melin/Code/WinClear
##
## Made by Arthur Melin
##
## Started on Fri Apr 21 12:07:15 2017 Arthur Melin
## Last update Fri Apr 21 17:01:16 2017 Arthur Melin
##
################
# Configuration:
ARCH = x86_64
BOOT_PATH = "L\"\\\\EFI\\\\Microsoft\\\\Boot\\\\bootmgfw.efi\""
################
NAME = WinClear-$(ARCH).efi
NAMESO = WinClear-$(ARCH).so
SRCS = WinClear.c
INCS = WinClear.h
OBJS = $(SRCS:.c=.o)
SRCSDIR = src
INCSDIR = include
OBJSDIR = obj
EFI_INCSDIRS = /usr/include/efi \
/usr/include/efi/$(ARCH)
EFI_LIBSDIRS = /usr/lib
EFI_LIBS = -lgnuefi -lefi
EFI_OBJS = /usr/lib/crt0-efi-$(ARCH).o
CC = gcc
LD = ld
OBJCP = objcopy
CFLAGS = -c -W -Wall -Wextra \
$(addprefix -I,$(INCSDIR) $(EFI_INCSDIRS)) \
-DEFI_FUNCTION_WRAPPER \
-DBOOT_PATH=$(BOOT_PATH) \
-ffreestanding \
-fno-stack-protector \
-fpic \
-fshort-wchar \
-mno-red-zone
LDFLAGS = -shared \
$(addprefix -L,$(EFI_LIBSDIRS)) \
-Telf_$(ARCH)_efi.lds \
$(EFI_LIBS) \
-Bsymbolic \
-nostdlib \
-zcombreloc
OBJCPFLAGS = -j .text \
-j .data \
-j .sdata \
-j .reloc \
-j .rel \
-j .rela \
-j .dynamic \
-j .dynsym \
--target=efi-app-$(ARCH)
RM = rm -rf
MKDIR = mkdir
all: $(NAME)
$(NAME): $(NAMESO)
$(OBJCP) $(OBJCPFLAGS) $< $@
$(NAMESO): $(addprefix $(OBJSDIR)/,$(OBJS)) $(EFI_OBJS)
$(LD) $^ $(LDFLAGS) -o $@
$(OBJSDIR)/%.o: $(SRCSDIR)/%.c $(addprefix $(INCSDIR)/,$(INCS)) | $(OBJSDIR)
$(CC) $< $(CFLAGS) -o $@
$(OBJSDIR):
$(MKDIR) $@
clean:
$(RM) $(OBJSDIR)
$(RM) $(NAMESO)
fclean: clean
$(RM) $(NAME)
re: fclean all
.PHONY: all clean fclean re