summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMatthew Garrett <mjg@redhat.com>2012-04-11 13:59:55 -0400
committerMatthew Garrett <mjg@redhat.com>2012-04-11 13:59:55 -0400
commitb2fe1780947117d5c6b6b79ccf36d73d1f889977 (patch)
tree327c955373c4bc8ffe600243c4a5212cc16c997b /Makefile
downloadefi-boot-shim-b2fe1780947117d5c6b6b79ccf36d73d1f889977.tar.gz
efi-boot-shim-b2fe1780947117d5c6b6b79ccf36d73d1f889977.zip
Initial commit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile40
1 files changed, 40 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..ddbb6f28
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,40 @@
+ARCH = $(shell uname -m | sed s,i[3456789]86,ia32,)
+
+LIB_PATH = /usr/lib64
+
+EFI_INCLUDE = /usr/include/efi
+EFI_INCLUDES = -I$(EFI_INCLUDE) -I$(EFI_INCLUDE)/$(ARCH) -I$(EFI_INCLUDE)/protocol
+EFI_PATH = /usr/lib64/gnuefi
+
+LIB_GCC = $(shell $(CC) -print-libgcc-file-name)
+EFI_LIBS = -lefi -lgnuefi $(LIB_GCC)
+
+EFI_CRT_OBJS = $(EFI_PATH)/crt0-efi-$(ARCH).o
+EFI_LDS = $(EFI_PATH)/elf_$(ARCH)_efi.lds
+
+
+CFLAGS = -O2 -fno-stack-protector -fno-strict-aliasing -fpic -fshort-wchar \
+ -Wall \
+ $(EFI_INCLUDES)
+ifeq ($(ARCH),x86_64)
+ CFLAGS += -DEFI_FUNCTION_WRAPPER
+endif
+LDFLAGS = -nostdlib -znocombreloc -T $(EFI_LDS) -shared -Bsymbolic -L$(EFI_PATH) -L$(LIB_PATH) $(EFI_CRT_OBJS)
+
+TARGET = shim.efi
+OBJS = shim.o
+
+all: $(TARGET)
+
+shim.efi: $(OBJS)
+
+%.efi: %.o
+ $(LD) $(LDFLAGS) $^ -o $@ $(EFI_LIBS)
+ objcopy -j .text -j .sdata -j .data \
+ -j .dynamic -j .dynsym -j .rel \
+ -j .rela -j .reloc \
+ --target=efi-app-$(ARCH) $@
+ strip $@
+
+clean:
+ rm -f $(TARGET) $(OBJS)