From 26e28a2558801b64bb7c3caf741f87c91476666a Mon Sep 17 00:00:00 2001 From: bzt Date: Sun, 31 Jan 2021 00:11:45 +0100 Subject: [PATCH] Modifications for clang, see issue #36 --- x86_64-efi/Makefile | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/x86_64-efi/Makefile b/x86_64-efi/Makefile index cc75d5a..65d9954 100644 --- a/x86_64-efi/Makefile +++ b/x86_64-efi/Makefile @@ -3,7 +3,10 @@ GNUEFI_INCLUDES = -I/usr/include -I. -I/usr/include/efi -I/usr/include/efi/$( GNUEFI_CRT_OBJS = crt0-efi-$(ARCH).o GNUEFI_LDS = elf_$(ARCH)_efi.lds -CFLAGS = -mno-red-zone -mno-mmx -mno-sse -O2 -fpic -pedantic -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 +CC ?= gcc +LD ?= ld +OBJCOPY ?= objcopy +CFLAGS = -mno-red-zone -mno-mmx -mno-sse -O2 -fpic -pedantic -Wall -Wextra -Werror -fshort-wchar -fno-strict-aliasing -ffreestanding -fno-stack-protector -fno-stack-check -DCONFIG_$(ARCH) -DGNU_EFI_USE_MS_ABI --std=c11 LDFLAGS = -nostdlib LDFLAGS += -shared -Bsymbolic -L. $(GNUEFI_CRT_OBJS) @@ -14,21 +17,21 @@ all: tinflate.o smp.o $(TARGET) %.efi: %.so @echo " src x86_64-efi (UEFI)" - @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 $^ $@ - @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) + @$(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 $^ $@ + @printf "BOOTBOOT Loader do not " | dd conv=notrunc of=$(TARGET) bs=1 seek=78 1>/dev/null 2>/dev/null + @$(CC) $(GNUEFI_INCLUDES) -Wall -fshort-wchar efirom.c -o efirom $(LIBS) @./efirom $(TARGET) ../dist/bootboot.rom || true @mv $(TARGET) ../dist/$(TARGET) @rm tinflate.o smp.o efirom %.so: %.o - @ld $(LDFLAGS) tinflate.o smp.o $^ -o $@ -lefi -lgnuefi -T $(GNUEFI_LDS) + @$(LD) $(LDFLAGS) tinflate.o smp.o $^ -o $@ -lefi -lgnuefi -T $(GNUEFI_LDS) %.o: %.c - @gcc $(GNUEFI_INCLUDES) $(CFLAGS) -c $< -o $@ + @$(CC) $(GNUEFI_INCLUDES) $(CFLAGS) -c $< -o $@ %.o: %.S - @gcc $(GNUEFI_INCLUDES) $(CFLAGS) -c $< -o $@ + @$(CC) $(GNUEFI_INCLUDES) $(CFLAGS) -c $< -o $@ clean: @rm bootboot.o $(TARGET) ../dist/$(TARGET) ../dist/bootboot.rom *.so *.efi efirom tinflate.o smp.o 2>/dev/null || true