1
0
Fork 0
mirror of https://gitlab.com/bztsrc/bootboot.git synced 2023-02-13 20:54:32 -05:00
bztsrc--bootboot/x86_64-efi/Makefile

36 lines
1.4 KiB
Makefile
Raw Normal View History

2018-06-05 14:34:03 -04:00
ARCH = $(shell uname -m | sed s,i[3456789]86,ia32,)
GNUEFI_INCLUDES = -I/usr/include -I. -I/usr/include/efi -I/usr/include/efi/$(ARCH) -I/usr/include/efi/protocol
GNUEFI_CRT_OBJS = crt0-efi-$(ARCH).o
GNUEFI_LDS = elf_$(ARCH)_efi.lds
2020-09-23 09:49:20 -04:00
CFLAGS = -mno-red-zone -mno-mmx -mno-sse -O2 -fpic -Wall -Wextra -Werror -fshort-wchar -fno-strict-aliasing -ffreestanding -fno-stack-protector -fno-stack-check -DCONFIG_$(ARCH) -DGNU_EFI_USE_MS_ABI -maccumulate-outgoing-args --std=c11
2018-06-05 14:34:03 -04:00
LDFLAGS = -nostdlib
LDFLAGS += -shared -Bsymbolic -L. $(GNUEFI_CRT_OBJS)
TARGET = bootboot.efi
2020-09-17 16:36:06 -04:00
all: tinflate.o smp.o $(TARGET)
2018-06-05 14:34:03 -04:00
%.efi: %.so
@echo " src x86_64-efi (UEFI)"
2020-01-05 08:03:22 -05:00
@objcopy -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .reloc --target efi-app-$(ARCH) --subsystem=10 $^ $@
2018-06-05 14:34:03 -04:00
@echo -n "BOOTBOOT Loader do not " | dd conv=notrunc of=$(TARGET) bs=1 seek=78 1>/dev/null 2>/dev/null
@gcc $(GNUEFI_INCLUDES) -Wall -fshort-wchar efirom.c -o efirom $(LIBS)
2020-06-24 10:33:08 -04:00
@./efirom $(TARGET) ../dist/bootboot.rom || true
@mv $(TARGET) ../dist/$(TARGET)
2020-09-17 16:36:06 -04:00
@rm tinflate.o smp.o efirom
2018-06-05 14:34:03 -04:00
%.so: %.o
2020-09-17 16:36:06 -04:00
@ld $(LDFLAGS) tinflate.o smp.o $^ -o $@ -lefi -lgnuefi -T $(GNUEFI_LDS)
2018-06-05 14:34:03 -04:00
%.o: %.c
@gcc $(GNUEFI_INCLUDES) $(CFLAGS) -c $< -o $@
%.o: %.S
@gcc $(GNUEFI_INCLUDES) $(CFLAGS) -c $< -o $@
clean:
2020-09-17 16:36:06 -04:00
@rm bootboot.o $(TARGET) ../dist/$(TARGET) ../dist/bootboot.rom *.so *.efi efirom tinflate.o smp.o 2>/dev/null || true
2018-06-05 14:34:03 -04:00