]> code.delx.au - refind/blobdiff - Make.common
More cleanup relating to ARM64 support.
[refind] / Make.common
index d098e2e2d0f3b02f672d96a2c642bbdf420e343c..4f440530082584a15865e86cb687f050ef3fcc98 100644 (file)
@@ -3,22 +3,29 @@
 # Common make rules for building with gnu-efi
 #
 
-EFIINC          = /usr/local/include/efi
-GNUEFILIB       = /usr/local/lib
-EFILIB          = /usr/local/lib
-EFICRT0         = /usr/local/lib
+EFIINC          = /usr/include/efi
+GNUEFILIB       = /usr/lib
+EFILIB          = /usr/lib
+EFICRT0         = /usr/lib
+
+# Comment out above and uncomment below if using locally-compiled GNU-EFI....
+#EFIINC          = /usr/local/include/efi
+#GNUEFILIB       = /usr/local/lib
+#EFILIB          = /usr/local/lib
+#EFICRT0         = /usr/local/lib
 
 HOSTARCH        = $(shell uname -m | sed s,i[3456789]86,ia32,)
 ARCH            := $(HOSTARCH)
 OS             = $(shell uname -s)
-CPPFLAGS        = -I$(EFIINC) -I$(EFIINC)/$(ARCH) -I$(EFIINC)/protocol -DCONFIG_$(ARCH)
+CPPFLAGS        = -I$(EFIINC) -I$(EFIINC)/$(ARCH) -I$(EFIINC)/protocol -I../include -I../refind -I../libeg -DCONFIG_$(ARCH) -D__MAKEWITH_GNUEFI
 
 OPTIMFLAGS      = -O2 -fno-strict-aliasing
 DEBUGFLAGS      = -Wall
 #CFLAGS          = $(ARCH3264) $(OPTIMFLAGS) -fpic -fshort-wchar $(DEBUGFLAGS)
 CFLAGS          = $(ARCH3264) $(OPTIMFLAGS) -fno-stack-protector -fpic -fshort-wchar $(DEBUGFLAGS)
 ASFLAGS         = $(ARCH3264)
-LDFLAGS         = -nostdlib -znocombreloc
+LDFLAGS         = -nostdlib
+DRV_LDFLAGS     =
 
 prefix          = /usr/bin/
 CC              = $(prefix)gcc
@@ -33,9 +40,13 @@ ifeq ($(ARCH),ia64)
   CFLAGS       += -frename-registers -mfixed-range=f32-f127
 endif
 
+FORMAT          = --target=efi-app-$(ARCH)
+FORMAT_DRIVER   = --target=efi-bsdrv-$(ARCH)
+
 ifeq ($(ARCH),x86_64)
-  CFLAGS += -DEFI_FUNCTION_WRAPPER
+  CFLAGS += -DEFI_FUNCTION_WRAPPER -mno-red-zone 
   CPPFLAGS += -DEFIX64
+  LDFLAGS += -znocombreloc -zdefs
 
   ifeq ($(HOSTARCH),ia32)
     ARCH3264 = -m64
@@ -47,7 +58,8 @@ ifeq ($(ARCH),x86_64)
 endif
 
 ifeq ($(ARCH),ia32)
-  CPPFLAGS += -DEFI32
+  CPPFLAGS += -DEFI32 -malign-double
+  LDFLAGS += -znocombreloc -zdefs
 
   ifeq ($(HOSTARCH),x86_64)
     ARCH3264 = -m32
@@ -58,6 +70,14 @@ ifeq ($(ARCH),ia32)
   endif
 endif
 
+ifeq ($(ARCH), aarch64)
+  CFLAGS += -fno-stack-check -g -fno-merge-constants -ffreestanding -fno-stack-check 
+  CPPFLAGS += -DEFIAARCH64
+  FORMAT          = -O binary
+  FORMAT_DRIVER   = -O binary
+  LDFLAGS         += --defsym=EFI_SUBSYSTEM=0xa --warn-common --no-undefined --fatal-warnings
+  DRV_LDFLAGS     += --defsym=EFI_SUBSYSTEM=0xb --warn-common --no-undefined --fatal-warnings
+endif
 
 CRTOBJS         = $(EFICRT0)/crt0-efi-$(ARCH).o
 
@@ -72,9 +92,8 @@ else
 endif
 
 LDFLAGS        += -T $(LDSCRIPT) -shared -Bsymbolic -L$(EFILIB) -L$(GNUEFILIB) $(CRTOBJS)
+DRV_LDFLAGS    += -T $(LDSCRIPT) -shared -Bsymbolic -L$(EFILIB) -L$(GNUEFILIB) $(CRTOBJS)
 LIBS            = -lefi -lgnuefi $(shell $(CC) $(ARCH3264) -print-libgcc-file-name)
-FORMAT          = efi-app-$(ARCH)
-FORMAT_DRIVER   = efi-bsdrv-$(ARCH)
 
 
 # general rules
@@ -88,13 +107,6 @@ ifneq (,$(filter %.efi,$(TARGET)))
 
 SHLIB_TARGET = $(subst .efi,.so,$(TARGET))
 
-$(SHLIB_TARGET): $(OBJS)
-       $(LD) $(LOCAL_LDFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(LOCAL_LIBS) $(LIBS)
-
-#$(TARGET): $(SHLIB_TARGET)
-#      $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
-#                 -j .rela -j .reloc --target=$(FORMAT) $< $@
-
 endif
 
 # rules for libraries
@@ -109,6 +121,6 @@ endif
 # utility rules
 
 clean:
-       rm -f $(TARGET) *~ *.so $(OBJS) *.efi
+       rm -f $(TARGET) *~ *.so $(OBJS) *.efi *.obj refind_*.txt refind_*.dll *.lib
 
 # EOF