blob: e8489aad3df80403728f51b510357b3b2ac4fddd (
plain) (
tree)
|
|
# TODO Autogen.obj
# Difference *.o *.obj
MAIN_FILE=MemtestEfi
CC=gcc
CFLAGS= -Werror -Wall -fno-builtin -fshort-wchar -fno-common -fno-strict-aliasing -g \
-Wno-array-bounds -fno-stack-protector -Wno-address -mno-red-zone \
-fpie -ffunction-sections -fdata-sections -flto -maccumulate-outgoing-args \
-fno-asynchronous-unwind-tables -nostdlib
LINKER=
M64=-m64 -mcmodel=small
M32=-m32
M=$(M64)
PREPROCESSOR=-DUEFI -DUSING_LTO -Os \
-D DISABLE_NEW_DEPRECATED_INTERFACES "-DEFIAPI=__attribute__((ms_abi))"
INCLUDE_FILES=main cpuid test smp config screen_buffer lib init controller pci \
spd dmi reloc patn linuxbios error vmem memsize random
ADDITIONAL_HEADER=$(addprefix memtest86+/, defs.h linuxbios_tables.h stdin.h io.h \
stdint.h stddef.h serial.h msr.h jedec_id.h elf.h)
OBJS=AutoGen.obj main.o test.o smp.o config.o screen_buffer.o lib.o init.o controller.o \
pci.o spd.o dmi.o reloc.o patn.o linuxbios.o error.o vmem.o cpuid.o memsize.o \
random.o MemtestEfi.obj
# STATIC_LIBRARY_FILES= libs/BaseLib.lib
# libs/BaseMemoryLib.lib libs/BasePcdLibNull.lib
# libs/BaseDebugPrintErrorLevelLib.lib libs/BasePrintLib.lib
# libs/UefiDebugLibStdErr.lib libs/UefiBootServicesTableLib.lib
# libs/UefiMemoryAllocationLib.lib libs/UefiRuntimeServicesTableLib.lib
# libs/UefiDevicePathLib.lib libs/UefiApplicationEntryPoint.lib libs/UefiLib.lib
all: clean MemtestEfi.efi
$(MAIN_FILE).efi: $(MAIN_FILE).dll
./Include/GenFw -e UEFI_APPLICATION -o OUTPUT/$MAIN_FILE.efi OUTPUT/$MAIN_FILE.dll
$(MAIN_FILE).dll: $(MAIN_FILE).lib
$(CC) $(CFLAGS) $(PREPROCESSOR) $(M)-o $(MAIN_FILE).dll \
-nostdlib \
-Wl,-n,-q,--gc-sections \
-Wl,--entry,_ModuleEntryPoint \
-Wl,-Map,OUTPUT/$MAIN_FILE.map,--whole-archive \
-Wl,-melf_x86_64,--oformat=elf64-x86-64,-pie \
-Wl,--start-group,@static_library_files.lst,--end-group \
-Wl,--defsym=PECOFF_HEADER_SIZE=0x228 \
-Wl,--script=Include/GccBase.lds \
-z common-page-size=0x40 \
-u _ModuleEntryPoint \
-DSTRING_ARRAY_NAME=${MAIN_FILE}Strings \
-I OUTPUT/ \
-I Library/
objcopy --strip-unneeded -R .eh_frame -v OUTPUT/$MAIN_FILE.dll OUTPUT/$MAIN_FILE.dll
$(MAIN_FILE).lib: $(OBJS)
gcc-ar crv OUTPUT/$(MAIN_FILE).lib $(OBJS)
$(MAIN_FILE).obj: $(MAIN_FILE).c
$(CC) $(CFLAGS) $(PREPROCESSOR) $(M) -o $(MAIN_FILE).obj \
-MMD -MF OUTPUT/$(MAIN_FILE).obj.deps \
-c \
-include memtest86+/efi/Include/AutoGen.h \
-DSTRING_ARRAY_NAME=${MAIN_FILE}Strings \
-I . \
-I"memtest86+" \
-I"memtest86+/efi/Include" \
$(MAIN_FILE).c
AutoGen.obj: memtest86+/efi/Include/AutoGen.c
$(CC) $(CFLAGS) $(PREPROCESSOR) $(M) -o AutoGen.obj \
-c \
-I .\
-I"memtest86+/efi/Include" \
memtest86+/efi/Include/AutoGen.c
%.o: memtest86+/%.c
$(CC) $(CFLAGS) $(PREPROCESSOR) $(M) -c -o $@ $<
clean:
rm -f OUTPUT/*
rm -f memtest86+/*.o
rm -f *.o
rm -f MemtestEfi.obj
# move:
# cp -OUTPUT/MemtestEfi.efi ../test_code/hda-contents
# run:
# sudo ./run.sh
|