CFLAGS = $(OPTIMFLAGS) -fno-stack-protector -fshort-wchar -Wall
# ...for GNU-EFI....
-GNUEFI_CFLAGS = -I$(EFIINC) -I$(EFIINC)/$(ARCH) -I$(EFIINC)/protocol -I../include -I../refind -I../libeg -I../mok
-#GNUEFI_CFLAGS = -I$(EFIINC) -I$(EFIINC)/$(ARCH) -I$(EFIINC)/protocol -I. -I./../include -I./../libeg -I./../mok -I../include -I../refind -I../libeg
+GNUEFI_CFLAGS = -fpic -I$(EFIINC) -I$(EFIINC)/$(ARCH) -I$(EFIINC)/protocol -I../include -I../refind -I../libeg -I../mok
# ...and for TianoCore....
TIANO_INCLUDE_DIRS = -I $(EDK2BASE)/MdePkg \
TIANO_LDFLAGS = -nostdlib -n -q --gc-sections --script=$(EDK2BASE)/BaseTools/Scripts/gcc4.4-ld-script \
--entry $(ENTRYPOINT) -u $(ENTRYPOINT) -m $(LD_CODE)
-
-
#
# objcopy flags for GNU-EFI
#
FORMAT = --target=efi-app-$(ARCH)
FORMAT_DRIVER = --target=efi-bsdrv-$(ARCH)
-
#
# Modifications on a per-architecture basis....
#
ifeq ($(ARCH),x86_64)
-# CFLAGS += -DEFI_FUNCTION_WRAPPER
-# GNUEFI_CFLAGS += -DEFIX64
GNUEFI_LDFLAGS += -znocombreloc -zdefs
ARCH_CFLAGS = -DEFIX64 -DEFI_FUNCTION_WRAPPER -m64 -mno-red-zone
ifeq ($(MAKEWITH),TIANO)
ARCH_CFLAGS += -mcmodel=large "-DEFIAPI=__attribute__((ms_abi))"
-endif
-ifeq ($(MAKEWITH),GNUEFI)
- ARCH_CFLAGS += -fpic
endif
ARCHDIR = X64
UC_ARCH = X64
FILENAME_CODE = x64
LD_CODE = elf_x86_64
-
-# ifeq ($(HOSTARCH),ia32)
-# ARCH3264 = -m64
-#
-# GNUEFILIB := $(GNUEFILIB)64
-# EFILIB := $(EFILIB)64
-# EFICRT0 := $(EFICRT0)64
-# endif
endif
ifeq ($(ARCH),ia32)
-# GNUEFI_CFLAGS += -DEFI32 -malign-double
GNUEFI_LDFLAGS += -znocombreloc -zdefs
+ # In practice, cross-compiling filesystem drivers works, but not the main
+ # rEFInd binary....
ifeq ($(HOSTARCH),x86_64)
-# ARCH3264 = -m32
-
GNUEFILIB := $(GNUEFILIB)32
EFILIB := $(EFILIB)32
EFICRT0 := $(EFICRT0)32
endif
ARCH_CFLAGS = -m32 -DEFI32 -malign-double
-ifeq ($(MAKEWITH),GNUEFI)
- ARCH_CFLAGS += -fpic
-endif
ARCHDIR = Ia32
UC_ARCH = IA32
FILENAME_CODE = ia32
endif
ifeq ($(ARCH), aarch64)
-# CFLAGS += -fno-stack-check
GNUEFI_CFLAGS += -DEFIAARCH64
FORMAT = -O binary
FORMAT_DRIVER = -O binary
LD_CODE = aarch64elf
endif
-# ifneq (,$(findstring FreeBSD,$(OS)))
-# ifeq ($(ARCH),x86_64)
-# LDSCRIPT = $(EFICRT0)/elf_$(ARCH)_fbsd_efi.lds
-# else
-# LDSCRIPT = $(EFICRT0)/elf_$(ARCH)_efi.lds
-# endif
-# else
-# LDSCRIPT = $(EFICRT0)/elf_$(ARCH)_efi.lds
-# endif
-
-#
-# general rules
-#
-
+# GNU-EFI compilation path uses .o files for compiled object code
%.o: %.c
$(CC) $(CFLAGS) $(ARCH_CFLAGS) $(GNUEFI_CFLAGS) $(LOCAL_GNUEFI_CFLAGS) \
-D__MAKEWITH_GNUEFI -DREFIND_VERSION=$(REFIND_VERSION) -c $< -o $@
+# TianoCore compilation path uses .obj files for compiled object code
%.obj: %.c
$(CC) $(CFLAGS) $(ARCH_CFLAGS) $(TIANO_INCLUDE_DIRS) -DNO_BUILTIN_VA_FUNCS \
-D__MAKEWITH_TIANO -DREFIND_VERSION=$(REFIND_VERSION) -c $< -o $@