diff options
author | Regia König | 2022-03-10 14:51:02 +0100 |
---|---|---|
committer | Regia König | 2022-03-10 14:51:02 +0100 |
commit | e97baaaa249e922a15b586d10a340c8e1076ad6d (patch) | |
tree | 76098632d8a8bb965963cbe5675fd00318d0b3ff /efi_memtest/Makefile | |
parent | Add stuff (diff) | |
download | memtest86-e97baaaa249e922a15b586d10a340c8e1076ad6d.tar.gz memtest86-e97baaaa249e922a15b586d10a340c8e1076ad6d.tar.xz memtest86-e97baaaa249e922a15b586d10a340c8e1076ad6d.zip |
Split build process into debug build and release build (gdb vs lto)
Diffstat (limited to 'efi_memtest/Makefile')
-rw-r--r-- | efi_memtest/Makefile | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/efi_memtest/Makefile b/efi_memtest/Makefile index 4574cfa..24d0875 100644 --- a/efi_memtest/Makefile +++ b/efi_memtest/Makefile @@ -2,15 +2,18 @@ MAIN_FILE = MemtestEfi CC = gcc -# Warnings -CFLAGS = -Werror -Wall -Wno-array-bounds -Wno-address +# Treat all warnings as errors +#CFLAGS = -Werror + +CFLAGS += -Wall -Wno-array-bounds CFLAGS += -fno-builtin + # EFI requires -fshort-wchar CFLAGS += -fshort-wchar + CFLAGS += -fno-common -CFLAGS += -fno-strict-aliasing -# Create debugging symbols -CFLAGS += -g +CFLAGS += -fno-strict-aliasing + # EFI uses Microsoft ABI so no red zone is defined CFLAGS += -mno-red-zone @@ -21,21 +24,25 @@ CFLAGS += -fpie CFLAGS += -fPIC CFLAGS += -ffunction-sections CFLAGS += -fdata-sections -CFLAGS += -flto + CFLAGS += -maccumulate-outgoing-args CFLAGS += -fno-asynchronous-unwind-tables + +# Don't use standard library CFLAGS += -nostdlib + CFLAGS += -mcmodel=small #CFLAGS += -fno-stack-protector e -M64=-m64 -march=x86-64 +M64=-m64 +#-march=x86-64 M32=-m32 M=$(M64) -PREPROCESSOR=-DUEFI -DUSING_LTO -Os \ +PREPROCESSOR=-DUEFI -Os \ -D DISABLE_NEW_DEPRECATED_INTERFACES "-DEFIAPI=__attribute__((ms_abi))" OBJS=Efi_Defs.obj config.o controller.o cpuid.o display.o dmi.o error.o init.o \ @@ -67,11 +74,20 @@ BaseLib_OBJS=ARShiftU64.o BitField.o CheckSum.o CpuDeadLoop.o Cpu.o DivU64x64Rem LIBRARIES=MemtestEfi.lib +debug: CFLAGS += -g +debug: all + +release: #CFLAGS += -flto +release: PREPROCESSOR += -DUSING_LTO +release: all + + all: clean MemtestEfi.efi move run clean $(MAIN_FILE).efi: $(MAIN_FILE).dll ./memtest86+/efi/Include/GenFw -e UEFI_APPLICATION -o $(MAIN_FILE).efi $(MAIN_FILE).dll + #objcopy --add-gnu-debuglink=MemtestEfi.debug MemtestEfi.efi $(MAIN_FILE).dll: $(MAIN_FILE).lib @@ -91,6 +107,7 @@ $(MAIN_FILE).dll: $(MAIN_FILE).lib $(MAIN_FILE).lib: $(OBJS) gcc-ar crv $(MAIN_FILE).lib $^ + #objcopy --only-keep-debug MemtestEfi.lib MemtestEfi.debug #rm $^ $(MAIN_FILE).obj: $(MAIN_FILE).c |