summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRegina König2021-06-29 14:07:06 +0200
committerRegina König2021-06-29 14:07:06 +0200
commit692e93e141ce9f147708de1a86de6e3c03721440 (patch)
tree703434fd567eef7a6d0706cdd5be26d39a6ce879
parentCreate second version of Makefile to produce an extra version for debugging (diff)
downloadmemtest86-692e93e141ce9f147708de1a86de6e3c03721440.tar.gz
memtest86-692e93e141ce9f147708de1a86de6e3c03721440.tar.xz
memtest86-692e93e141ce9f147708de1a86de6e3c03721440.zip
Get a more consistent version of new Makefile
-rw-r--r--efi_memtest/Makefile28
-rw-r--r--efi_memtest/Makefile_orig (renamed from efi_memtest/_Makefile)0
2 files changed, 13 insertions, 15 deletions
diff --git a/efi_memtest/Makefile b/efi_memtest/Makefile
index ab3a34b..65ac462 100644
--- a/efi_memtest/Makefile
+++ b/efi_memtest/Makefile
@@ -16,10 +16,13 @@ CFLAGS += -mno-red-zone
CFLAGS += -fpie
#CFLAGS += -fno-pie -no-pie -static
+# the UEFI PE executables must be relocatable
CFLAGS += -fPIC
CFLAGS += -ffunction-sections
CFLAGS += -fdata-sections
CFLAGS += -flto
+
+# function calls must include the number of arguments passed to the functions
CFLAGS += -maccumulate-outgoing-args
CFLAGS += -fno-asynchronous-unwind-tables
CFLAGS += -nostdlib
@@ -35,13 +38,13 @@ M=$(M64)
PREPROCESSOR=-DUEFI -DUSING_LTO -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 \
+OBJS=Efi_Defs.o config.o controller.o cpuid.o display.o dmi.o error.o init.o \
lib.o logger.o main.o memory_tables.o memsize.o page_allocator.o patn.o pci.o reloc.o \
screen_buffer.o random.o smp.o spd.o test.o vmem.o \
BaseLib.o BaseMemoryLib.o BasePrintLib.o \
UefiDebugLibStdErr.o UefiDevicePathLib2.o UefiLib2.o ApplicationEntryPoint.o \
BaseDebugPrintErrorLevelLib.o UefiMemoryAllocationLib.o BasePcdLibNull.o \
- UefiRuntimeServicesTableLib.o UefiBootServicesTableLib.o MemtestEfi.obj
+ UefiRuntimeServicesTableLib.o UefiBootServicesTableLib.o MemtestEfi.o
BaseMemoryLib_OBJS=CompareMemWrapper.o CopyMem.o CopyMemWrapper.o IsZeroBufferWrapper.o \
@@ -62,8 +65,6 @@ BaseLib_OBJS=ARShiftU64.o BitField.o CheckSum.o CpuDeadLoop.o Cpu.o DivU64x64Rem
-LIBRARIES=OUTPUT/MemtestEfi.lib
-
all: clean MemtestEfi.efi move run
@@ -71,8 +72,8 @@ $(MAIN_FILE).efi: $(MAIN_FILE).dll
./memtest86+/efi/Include/GenFw -e UEFI_APPLICATION -o $(MAIN_FILE).efi $(MAIN_FILE).dll
-$(MAIN_FILE).dll: $(MAIN_FILE).lib
- $(CC) $(CFLAGS) $(PREPROCESSOR) $(M) $(LIBRARIES) -o $(MAIN_FILE).dll \
+$(MAIN_FILE).dll: OUTPUT/$(MAIN_FILE).lib
+ $(CC) $(CFLAGS) $(PREPROCESSOR) $(M) -o $@ $< \
-nostdlib \
-Wl,-n,-q,--gc-sections \
-Wl,--entry,_ModuleEntryPoint \
@@ -86,24 +87,21 @@ $(MAIN_FILE).dll: $(MAIN_FILE).lib
objcopy --strip-unneeded -R .eh_frame -v $(MAIN_FILE).dll $(MAIN_FILE).dll
strip -R .strtab MemtestEfi.dll
-$(MAIN_FILE).lib: $(OBJS)
+OUTPUT/$(MAIN_FILE).lib: $(OBJS)
gcc-ar crv OUTPUT/$(MAIN_FILE).lib $^
#rm $^
-$(MAIN_FILE).obj: $(MAIN_FILE).c
- $(CC) $(CFLAGS) $(PREPROCESSOR) $(M) -o $(MAIN_FILE).obj \
+$(MAIN_FILE).o: $(MAIN_FILE).c
+ $(CC) $(CFLAGS) $(PREPROCESSOR) $(M) -c -o $@ $< \
-MMD -MF OUTPUT/$(MAIN_FILE).obj.deps \
- -c \
-include memtest86+/efi/Include/Efi_Defs.h \
-DSTRING_ARRAY_NAME=${MAIN_FILE}Strings \
-I . \
-I"memtest86+" \
- -I"memtest86+/efi/Include" \
- $(MAIN_FILE).c
+ -I"memtest86+/efi/Include"
-Efi_Defs.obj: memtest86+/efi/Include/Efi_Defs.c
- $(CC) $(CFLAGS) $(PREPROCESSOR) $(M) -o $@ $< \
- -c \
+Efi_Defs.o: memtest86+/efi/Include/Efi_Defs.c
+ $(CC) $(CFLAGS) $(PREPROCESSOR) $(M) -c -o $@ $< \
-I"memtest86+/efi/Include"
%.o: memtest86+/%.c
diff --git a/efi_memtest/_Makefile b/efi_memtest/Makefile_orig
index ab3a34b..ab3a34b 100644
--- a/efi_memtest/_Makefile
+++ b/efi_memtest/Makefile_orig