summarylogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorsee pkgbuild2019-05-21 14:26:07 +0000
committersee pkgbuild2019-05-21 15:35:06 +0000
commit2d3fa7d67bd62a807c849d42a6ad30eaa5188add (patch)
tree99a3fc775f7620e19dbc8f16e2410fe37957430a /Makefile
downloadaur-powerofforreboot.efi.tar.gz
Initial upload of the package
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 28 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000000..6dd34c15d8a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,28 @@
+ARCH = $(shell uname -m | sed s,i[3456789]86,ia32,)
+
+EFIINC = /usr/include/efi
+EFIINCS = -I$(EFIINC) -I$(EFIINC)/$(ARCH) -I$(EFIINC)/protocol
+LIB = /usr/lib
+EFILIB = /usr/lib
+EFI_CRT_OBJS = $(EFILIB)/crt0-efi-$(ARCH).o
+EFI_LDS = $(EFILIB)/elf_$(ARCH)_efi.lds
+
+CPPFLAGS =
+CFLAGS = $(EFIINCS) -fno-stack-protector -fpic \
+ -fshort-wchar -mno-red-zone -Wall
+ifeq ($(ARCH),x86_64)
+ CFLAGS += -DEFI_FUNCTION_WRAPPER
+endif
+
+LDFLAGS = -nostdlib -znocombreloc -T $(EFI_LDS) -shared \
+ -Bsymbolic -L $(EFILIB) -L $(LIB) $(EFI_CRT_OBJS)
+
+all: poweroff.efi reboot.efi
+
+%.so: %.o
+ ld $(LDFLAGS) $^ -o $@ -lefi -lgnuefi
+
+%.efi: %.so
+ objcopy -j .text -j .sdata -j .data -j .dynamic \
+ -j .dynsym -j .rel -j .rela -j .reloc \
+ --target=efi-app-$(ARCH) $^ $@