Makefile.common 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. # -*- makefile -*-
  2. CFLAGS_PLATFORM=
  3. export LC_COLLATE := C
  4. unexport LC_ALL
  5. # Platform specific options
  6. if COND_sparc64_ieee1275
  7. LDFLAGS_PLATFORM = -Wl,-melf64_sparc
  8. endif
  9. if COND_arm
  10. if !COND_emu
  11. LDFLAGS_PLATFORM = -Wl,--wrap=__clear_cache
  12. endif
  13. endif
  14. if COND_arm64
  15. CFLAGS_PLATFORM += -mcmodel=large
  16. endif
  17. if COND_powerpc_ieee1275
  18. CFLAGS_PLATFORM += -mcpu=powerpc
  19. endif
  20. # Other options
  21. CPPFLAGS_DEFAULT = -DGRUB_FILE=\"$(subst $(srcdir)/,,$<)\"
  22. CPPFLAGS_DEFAULT += -I$(builddir)
  23. CPPFLAGS_DEFAULT += -I$(srcdir)
  24. CPPFLAGS_DEFAULT += -I$(top_builddir)
  25. CPPFLAGS_DEFAULT += -I$(top_srcdir)
  26. CPPFLAGS_DEFAULT += -I$(top_srcdir)/include
  27. CPPFLAGS_DEFAULT += -I$(top_builddir)/include
  28. CPPFLAGS_DEFAULT += -I$(top_srcdir)/grub-core/lib/libgcrypt-grub/src/
  29. CCASFLAGS_DEFAULT = $(CPPFLAGS_DEFAULT) -DASM_FILE=1
  30. BUILD_CPPFLAGS += $(CPPFLAGS_DEFAULT)
  31. CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding
  32. LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC)
  33. CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
  34. CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
  35. STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx
  36. CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding
  37. LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
  38. CPPFLAGS_MODULE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
  39. CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
  40. CFLAGS_IMAGE = $(CFLAGS_PLATFORM) -fno-builtin
  41. LDFLAGS_IMAGE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-S
  42. CPPFLAGS_IMAGE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
  43. CCASFLAGS_IMAGE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
  44. CFLAGS_PROGRAM =
  45. LDFLAGS_PROGRAM =
  46. CPPFLAGS_PROGRAM =
  47. CCASFLAGS_PROGRAM =
  48. CFLAGS_LIBRARY =
  49. CPPFLAGS_LIBRARY =
  50. CCASFLAGS_LIBRARY =
  51. # Other variables
  52. grubconfdir = $(sysconfdir)/grub.d
  53. platformdir = $(pkglibdir)/$(target_cpu)-$(platform)
  54. starfielddir = $(pkgdatadir)/themes/starfield
  55. CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion
  56. CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/gnulib -I$(top_srcdir)/grub-core/gnulib
  57. CFLAGS_POSIX = -fno-builtin
  58. CPPFLAGS_POSIX = -I$(top_srcdir)/grub-core/lib/posix_wrap
  59. CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers -Wno-redundant-decls -Wno-undef $(CFLAGS_POSIX)
  60. CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap $(CPPFLAGS_POSIX) -D_GCRYPT_IN_LIBGCRYPT=1 -I$(top_srcdir)/include/grub/gcrypt
  61. CPPFLAGS_EFIEMU = -I$(top_srcdir)/grub-core/efiemu/runtime
  62. # List file macros for recognizing /interesting/ modules
  63. CPPFLAGS_FS_LIST = -Dgrub_fs_register=FS_LIST_MARKER
  64. CPPFLAGS_VIDEO_LIST= -Dgrub_video_register=VIDEO_LIST_MARKER
  65. CPPFLAGS_PARTMAP_LIST = -Dgrub_partition_map_register=PARTMAP_LIST_MARKER
  66. CPPFLAGS_PARTTOOL_LIST = -Dgrub_parttool_register=PARTTOOL_LIST_MARKER
  67. CPPFLAGS_TERMINAL_LIST = '-Dgrub_term_register_input(...)=INPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
  68. CPPFLAGS_TERMINAL_LIST += '-Dgrub_term_register_output(...)=OUTPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
  69. CPPFLAGS_COMMAND_LIST = '-Dgrub_register_command(...)=COMMAND_LIST_MARKER(__VA_ARGS__)'
  70. CPPFLAGS_COMMAND_LIST += '-Dgrub_register_extcmd(...)=EXTCOMMAND_LIST_MARKER(__VA_ARGS__)'
  71. CPPFLAGS_COMMAND_LIST += '-Dgrub_register_command_p1(...)=P1COMMAND_LIST_MARKER(__VA_ARGS__)'
  72. CPPFLAGS_FDT_LIST := '-Dgrub_fdtbus_register(...)=FDT_DRIVER_LIST_MARKER(__VA_ARGS__)'
  73. CPPFLAGS_MARKER = $(CPPFLAGS_FS_LIST) $(CPPFLAGS_VIDEO_LIST) \
  74. $(CPPFLAGS_PARTTOOL_LIST) $(CPPFLAGS_PARTMAP_LIST) \
  75. $(CPPFLAGS_TERMINAL_LIST) $(CPPFLAGS_COMMAND_LIST) \
  76. $(CPPFLAGS_FDT_LIST)
  77. # Define these variables to calm down automake
  78. IMG_FILES =
  79. MOD_FILES =
  80. MODULE_FILES =
  81. MARKER_FILES =
  82. KERNEL_HEADER_FILES =
  83. man_MANS =
  84. noinst_DATA =
  85. pkgdata_DATA =
  86. bin_SCRIPTS =
  87. sbin_SCRIPTS =
  88. bin_PROGRAMS =
  89. platform_DATA =
  90. sbin_PROGRAMS =
  91. check_SCRIPTS =
  92. dist_grubconf_DATA =
  93. check_PROGRAMS =
  94. noinst_SCRIPTS =
  95. noinst_PROGRAMS =
  96. grubconf_SCRIPTS =
  97. noinst_LIBRARIES =
  98. dist_noinst_DATA =
  99. platform_SCRIPTS =
  100. platform_PROGRAMS =
  101. TESTS =
  102. EXTRA_DIST =
  103. CLEANFILES =
  104. BUILT_SOURCES =
  105. # Rules for Automake input
  106. .PRECIOUS: $(top_srcdir)/Makefile.util.am
  107. $(top_srcdir)/Makefile.util.am: $(top_srcdir)/gentpl.py $(top_srcdir)/Makefile.util.def $(top_srcdir)/Makefile.utilgcry.def
  108. python $^ > $@.new || (rm -f $@.new; exit 1)
  109. mv $@.new $@
  110. .PRECIOUS: $(top_srcdir)/grub-core/Makefile.core.am
  111. $(top_srcdir)/grub-core/Makefile.core.am: $(top_srcdir)/gentpl.py $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def
  112. if [ "x$$GRUB_CONTRIB" != x ]; then echo "You need to run ./autogen.sh manually." >&2; exit 1; fi
  113. python $^ > $@.new || (rm -f $@.new; exit 1)
  114. mv $@.new $@