Makefile 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ################################################################################
  2. #
  3. # Copyright (c) 2014 Minoca Corp.
  4. #
  5. # This file is licensed under the terms of the GNU General Public License
  6. # version 3. Alternative licensing terms are available. Contact
  7. # info@minocacorp.com for details. See the LICENSE file at the root of this
  8. # project for complete licensing information.
  9. #
  10. # Binary Name:
  11. #
  12. # Boot Manager (UEFI)
  13. #
  14. # Abstract:
  15. #
  16. # This module implements the UEFI boot manager that can load a Minoca OS
  17. # loader.
  18. #
  19. # Author:
  20. #
  21. # Evan Green 21-Feb-2014
  22. #
  23. # Environment:
  24. #
  25. # Boot
  26. #
  27. ################################################################################
  28. include $(SRCDIR)/../sources
  29. BINARY := bootmefi.elf
  30. VPATH += $(SRCDIR)/..:
  31. OBJS += bootxfr.o \
  32. main.o \
  33. INCLUDES += $(SRCROOT)/os/boot/lib/include;$(SRCDIR)/..;
  34. TARGETLIBS += $(OBJROOT)/os/boot/lib/efi/bootefi.a \
  35. ENTRY = BmEfiApplicationMain
  36. EXTRA_LDFLAGS += -pie -nodefaultlibs -nostartfiles -Wl,--whole-archive
  37. ifeq ($(ARCH), x86)
  38. LINKER_SCRIPT = $(SRCROOT)/os/uefi/include/link_x86.x
  39. endif
  40. ifeq ($(ARCH), armv7)
  41. LINKER_SCRIPT = $(SRCROOT)/os/uefi/include/link_arm.x
  42. TARGETLIBS += $(OBJROOT)/os/kernel/$(ARCH)/boot/armboot.a
  43. LDFLAGS += -Wl,--no-wchar-size-warning
  44. endif
  45. ifeq ($(ARCH), armv6)
  46. LINKER_SCRIPT = $(SRCROOT)/os/uefi/include/link_arm.x
  47. TARGETLIBS += $(OBJROOT)/os/kernel/$(ARCH)/boot/armboot.a
  48. LDFLAGS += -Wl,--no-wchar-size-warning
  49. endif
  50. ##
  51. ## On architectures that produce ELF binaries, convert it to a PE image.
  52. ##
  53. postbuild: bootmefi.efi
  54. bootmefi.efi: $(BINARY)
  55. @echo Converting - $^
  56. @cd $(OBJROOT)/$(THISDIR) && elfconv -o $@ -t efiapp $^
  57. @cd $(OBJROOT)/$(THISDIR) && cp $@ $(BINROOT)
  58. include $(SRCROOT)/os/minoca.mk
  59. CFLAGS += -fshort-wchar