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

Modifications for clang, see issue #36

This commit is contained in:
bzt 2021-01-31 00:11:45 +01:00
parent c2cf423c2c
commit 26e28a2558

View file

@ -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_CRT_OBJS = crt0-efi-$(ARCH).o
GNUEFI_LDS = elf_$(ARCH)_efi.lds 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 = -nostdlib
LDFLAGS += -shared -Bsymbolic -L. $(GNUEFI_CRT_OBJS) LDFLAGS += -shared -Bsymbolic -L. $(GNUEFI_CRT_OBJS)
@ -14,21 +17,21 @@ all: tinflate.o smp.o $(TARGET)
%.efi: %.so %.efi: %.so
@echo " src x86_64-efi (UEFI)" @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 $^ $@ @$(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 @printf "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) @$(CC) $(GNUEFI_INCLUDES) -Wall -fshort-wchar efirom.c -o efirom $(LIBS)
@./efirom $(TARGET) ../dist/bootboot.rom || true @./efirom $(TARGET) ../dist/bootboot.rom || true
@mv $(TARGET) ../dist/$(TARGET) @mv $(TARGET) ../dist/$(TARGET)
@rm tinflate.o smp.o efirom @rm tinflate.o smp.o efirom
%.so: %.o %.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 %.o: %.c
@gcc $(GNUEFI_INCLUDES) $(CFLAGS) -c $< -o $@ @$(CC) $(GNUEFI_INCLUDES) $(CFLAGS) -c $< -o $@
%.o: %.S %.o: %.S
@gcc $(GNUEFI_INCLUDES) $(CFLAGS) -c $< -o $@ @$(CC) $(GNUEFI_INCLUDES) $(CFLAGS) -c $< -o $@
clean: clean:
@rm bootboot.o $(TARGET) ../dist/$(TARGET) ../dist/bootboot.rom *.so *.efi efirom tinflate.o smp.o 2>/dev/null || true @rm bootboot.o $(TARGET) ../dist/$(TARGET) ../dist/bootboot.rom *.so *.efi efirom tinflate.o smp.o 2>/dev/null || true