Makefile.am 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. AUTOMAKE_OPTIONS = subdir-objects -Wno-portability
  2. DEPDIR=.deps-core
  3. include $(top_srcdir)/conf/Makefile.common
  4. CC=$(TARGET_CC)
  5. CPP=$(TARGET_CC)
  6. CCAS=$(TARGET_CC)
  7. RANLIB=$(TARGET_RANLIB)
  8. STRIP=$(TARGET_STRIP)
  9. MACHO2IMG=$(top_builddir)/grub-macho2img
  10. AM_CFLAGS = $(TARGET_CFLAGS)
  11. AM_LDFLAGS = $(TARGET_LDFLAGS)
  12. AM_CPPFLAGS = $(TARGET_CPPFLAGS) $(CPPFLAGS_DEFAULT)
  13. AM_CCASFLAGS = $(TARGET_CCASFLAGS) $(CCASFLAGS_DEFAULT)
  14. CFLAGS_PROGRAM += $(CFLAGS_PLATFORM)
  15. LDFLAGS_PROGRAM += $(LDFLAGS_PLATFORM)
  16. CPPFLAGS_PROGRAM += $(CPPFLAGS_PLATFORM)
  17. CCASFLAGS_PROGRAM += $(CCASFLAGS_PLATFORM)
  18. CFLAGS_LIBRARY += $(CFLAGS_PLATFORM) -fno-builtin
  19. CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM)
  20. CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM)
  21. build-grub-pep2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
  22. $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=64 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pep2elf\" $^
  23. CLEANFILES += build-grub-pep2elf$(BUILD_EXEEXT)
  24. build-grub-pe2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
  25. $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=32 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pe2elf\" $^
  26. CLEANFILES += build-grub-pe2elf$(BUILD_EXEEXT)
  27. # gentrigtables
  28. gentrigtables$(BUILD_EXEEXT): gentrigtables.c
  29. $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $< $(BUILD_LIBM)
  30. CLEANFILES += gentrigtables$(BUILD_EXEEXT)
  31. build-grub-module-verifier$(BUILD_EXEEXT): $(top_srcdir)/util/grub-module-verifier.c $(top_srcdir)/util/grub-module-verifier32.c $(top_srcdir)/util/grub-module-verifier64.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
  32. $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-module-verifier\" $^
  33. CLEANFILES += build-grub-module-verifier$(BUILD_EXEEXT)
  34. # trigtables.c
  35. trigtables.c: gentrigtables$(BUILD_EXEEXT) gentrigtables.c $(top_srcdir)/configure.ac
  36. ./gentrigtables$(BUILD_EXEEXT) > $@
  37. CLEANFILES += trigtables.c
  38. # XXX Use Automake's LEX & YACC support
  39. grub_script.tab.h: script/parser.y
  40. $(YACC) -d -p grub_script_yy -b grub_script $<
  41. grub_script.tab.c: grub_script.tab.h
  42. CLEANFILES += grub_script.tab.c grub_script.tab.h
  43. # For the lexer.
  44. grub_script.yy.h: script/yylex.l
  45. $(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $<
  46. grub_script.yy.c: grub_script.yy.h
  47. rs_decoder.h: $(srcdir)/lib/reed_solomon.c
  48. $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Os -I$(top_builddir) -S -DSTANDALONE -o $@ $< -g0 -mregparm=3 -ffreestanding
  49. CLEANFILES += grub_script.yy.c grub_script.yy.h
  50. include $(srcdir)/Makefile.core.am
  51. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cache.h
  52. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h
  53. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/device.h
  54. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/disk.h
  55. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/dl.h
  56. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/sb.h
  57. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env.h
  58. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env_private.h
  59. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/err.h
  60. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/file.h
  61. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fs.h
  62. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h
  63. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/kernel.h
  64. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/list.h
  65. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lockdown.h
  66. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/misc.h
  67. if COND_emu
  68. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/compiler-rt-emu.h
  69. else
  70. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/compiler-rt.h
  71. endif
  72. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm.h
  73. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/parser.h
  74. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/partition.h
  75. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/key_protector.h
  76. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/stack_protector.h
  77. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h
  78. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h
  79. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/verify.h
  80. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h
  81. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h
  82. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h
  83. if COND_i386_pc
  84. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
  85. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pxe.h
  86. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/int.h
  87. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
  88. endif
  89. if COND_i386_xen_pvh
  90. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
  91. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/int.h
  92. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
  93. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
  94. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  95. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
  96. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
  97. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/xen.h
  98. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/xen/hypercall.h
  99. endif
  100. if COND_i386_efi
  101. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
  102. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
  103. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
  104. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
  105. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
  106. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
  107. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pmtimer.h
  108. endif
  109. if COND_i386_coreboot
  110. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
  111. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
  112. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/coreboot/lbio.h
  113. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h
  114. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h
  115. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h
  116. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h
  117. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h
  118. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
  119. endif
  120. if COND_i386_multiboot
  121. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
  122. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
  123. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
  124. endif
  125. if COND_i386_qemu
  126. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
  127. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
  128. endif
  129. if COND_i386_ieee1275
  130. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
  131. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
  132. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/alloc.h
  133. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
  134. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  135. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
  136. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
  137. endif
  138. if COND_i386_xen
  139. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
  140. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/xen.h
  141. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/xen/hypercall.h
  142. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
  143. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  144. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
  145. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
  146. endif
  147. if COND_x86_64_xen
  148. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/xen.h
  149. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/x86_64/xen/hypercall.h
  150. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
  151. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  152. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
  153. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
  154. endif
  155. if COND_x86_64_efi
  156. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
  157. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
  158. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
  159. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
  160. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
  161. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
  162. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pmtimer.h
  163. endif
  164. if COND_ia64_efi
  165. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
  166. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
  167. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
  168. endif
  169. if COND_mips
  170. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/kernel.h
  171. endif
  172. if COND_mips_arc
  173. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  174. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arc/arc.h
  175. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
  176. endif
  177. if COND_mips_qemu_mips
  178. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h
  179. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
  180. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/serial.h
  181. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
  182. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
  183. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  184. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
  185. endif
  186. if COND_mips_loongson
  187. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h
  188. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
  189. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/time.h
  190. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h
  191. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h
  192. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h
  193. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h
  194. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h
  195. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
  196. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cs5536.h
  197. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pci.h
  198. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/serial.h
  199. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
  200. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
  201. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  202. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
  203. endif
  204. if COND_mips_qemu_mips
  205. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
  206. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
  207. endif
  208. if COND_powerpc_ieee1275
  209. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
  210. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/alloc.h
  211. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
  212. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  213. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
  214. endif
  215. if COND_sparc64_ieee1275
  216. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
  217. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sparc64/ieee1275/ieee1275.h
  218. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
  219. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  220. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
  221. endif
  222. if COND_arm_uboot
  223. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/uboot/uboot.h
  224. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/uboot/disk.h
  225. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  226. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
  227. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h
  228. endif
  229. if COND_arm_coreboot
  230. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h
  231. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h
  232. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h
  233. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h
  234. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h
  235. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h
  236. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h
  237. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fdt.h
  238. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/dma.h
  239. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/coreboot/kernel.h
  240. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fdtbus.h
  241. endif
  242. if COND_arm_efi
  243. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
  244. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
  245. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h
  246. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
  247. endif
  248. if COND_arm64_efi
  249. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
  250. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
  251. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
  252. endif
  253. if COND_loongarch64_efi
  254. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
  255. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
  256. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
  257. endif
  258. if COND_riscv32_efi
  259. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
  260. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
  261. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
  262. endif
  263. if COND_riscv64_efi
  264. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
  265. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
  266. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
  267. endif
  268. if COND_emu
  269. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/datetime.h
  270. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/misc.h
  271. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/net.h
  272. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostdisk.h
  273. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostfile.h
  274. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  275. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/exec.h
  276. if COND_GRUB_EMU_SDL
  277. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h
  278. endif
  279. if COND_GRUB_EMU_SDL2
  280. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h
  281. endif
  282. if COND_GRUB_EMU_PCI
  283. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libpciaccess.h
  284. endif
  285. endif
  286. symlist.h: $(top_builddir)/config.h $(KERNEL_HEADER_FILES)
  287. @list='$^'; \
  288. for p in $$list; do \
  289. echo "#include <$$p>" >> $@ || (rm -f $@; exit 1); \
  290. done
  291. CLEANFILES += symlist.h
  292. BUILT_SOURCES += symlist.h
  293. symlist.c: symlist.h gensymlist.sh
  294. $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) -DGRUB_SYMBOL_GENERATOR=1 symlist.h > symlist.p || (rm -f symlist.p; exit 1)
  295. cat symlist.p | $(SHELL) $(srcdir)/gensymlist.sh $(top_builddir)/config.h $(KERNEL_HEADER_FILES) >$@ || (rm -f $@; exit 1)
  296. rm -f symlist.p
  297. CLEANFILES += symlist.c
  298. BUILT_SOURCES += symlist.c
  299. if COND_HAVE_ASM_USCORE
  300. ASM_PREFIX=_
  301. else
  302. ASM_PREFIX=
  303. endif
  304. noinst_DATA += kernel_syms.lst
  305. kernel_syms.lst: $(KERNEL_HEADER_FILES) $(top_builddir)/config.h
  306. $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) $(CFLAGS) -DGRUB_SYMBOL_GENERATOR=1 $^ >kernel_syms.input
  307. cat kernel_syms.input | grep -v '^#' | sed -n \
  308. -e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/defined kernel '"$(ASM_PREFIX)"'\1/;p;}' \
  309. -e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/defined kernel '"$(ASM_PREFIX)"'\1/;p;}' \
  310. | sort -u >$@
  311. rm -f kernel_syms.input
  312. CLEANFILES += kernel_syms.lst
  313. if COND_emu
  314. kern/emu/grub_emu-main.$(OBJEXT):grub_emu_init.h
  315. grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h
  316. kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h
  317. grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h
  318. grub_emu_init.h: genemuinitheader.sh $(MODULE_FILES)
  319. rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@
  320. CLEANFILES += grub_emu_init.h
  321. grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MODULE_FILES)
  322. rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@
  323. CLEANFILES += grub_emu_init.c
  324. endif
  325. # List files
  326. fs.lst: $(MARKER_FILES)
  327. (for pp in $^; do \
  328. b=`basename $$pp .marker`; \
  329. if grep 'FS_LIST_MARKER' $$pp >/dev/null 2>&1; then \
  330. echo $$b; \
  331. fi; \
  332. done) | sort -u > $@
  333. platform_DATA += fs.lst
  334. CLEANFILES += fs.lst
  335. command.lst: $(MARKER_FILES)
  336. (for pp in $^; do \
  337. b=`basename $$pp .marker`; \
  338. sed -n \
  339. -e "/EXTCOMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
  340. -e "/EXTCOMMAND_LOCKDOWN_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
  341. -e "/P1COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
  342. -e "/COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" \
  343. -e "/COMMAND_LOCKDOWN_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" $$pp; \
  344. done) | sort -u > $@
  345. platform_DATA += command.lst
  346. CLEANFILES += command.lst
  347. partmap.lst: $(MARKER_FILES)
  348. (for pp in $^; do \
  349. b=`basename $$pp .marker`; \
  350. if grep 'PARTMAP_LIST_MARKER' $$pp >/dev/null 2>&1; then \
  351. echo $$b; \
  352. fi; \
  353. done) | sort -u > $@
  354. platform_DATA += partmap.lst
  355. CLEANFILES += partmap.lst
  356. terminal.lst: $(MARKER_FILES)
  357. (for pp in $^; do \
  358. b=`basename $$pp .marker`; \
  359. sed -n \
  360. -e "/INPUT_TERMINAL_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/i\1: $$b/;p;}" \
  361. -e "/OUTPUT_TERMINAL_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/o\1: $$b/;p;}" $$pp; \
  362. done) | sort -u > $@
  363. platform_DATA += terminal.lst
  364. CLEANFILES += terminal.lst
  365. fdt.lst: $(MARKER_FILES)
  366. (for pp in $^; do \
  367. b=`basename $$pp .marker`; \
  368. sed -n \
  369. -e "/FDT_DRIVER_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/i\1: $$b/;p;}" \
  370. -e "/FDT_DRIVER_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/o\1: $$b/;p;}" $$pp; \
  371. done) | sort -u > $@
  372. platform_DATA += fdt.lst
  373. CLEANFILES += fdt.lst
  374. parttool.lst: $(MARKER_FILES)
  375. (for pp in $^; do \
  376. b=`basename $$pp .marker`; \
  377. sed -n \
  378. -e "/PARTTOOL_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" $$pp; \
  379. done) | sort -u > $@
  380. platform_DATA += parttool.lst
  381. CLEANFILES += parttool.lst
  382. video.lst: $(MARKER_FILES)
  383. (for pp in $^; do \
  384. b=`basename $$pp .marker`; \
  385. if grep 'VIDEO_LIST_MARKER' $$pp >/dev/null 2>&1; then \
  386. echo $$b; \
  387. fi; \
  388. done) | sort -u > $@
  389. platform_DATA += video.lst
  390. CLEANFILES += video.lst
  391. # but, crypto.lst is simply copied
  392. crypto.lst: $(srcdir)/lib/libgcrypt-grub/cipher/crypto.lst
  393. cp $^ $@
  394. platform_DATA += crypto.lst
  395. CLEANFILES += crypto.lst
  396. extra_deps.lst:
  397. @echo $(EXTRA_DEPS) | sed "s/\s*:\s*/\n/g" > $@
  398. syminfo.lst: gensyminfo.sh kernel_syms.lst extra_deps.lst $(MODULE_FILES)
  399. cat kernel_syms.lst extra_deps.lst > $@.new
  400. for m in $(MODULE_FILES); do \
  401. sh $< $$m >> $@.new || exit 1; \
  402. done
  403. mv $@.new $@
  404. # generate global module dependencies list
  405. moddep.lst: syminfo.lst genmoddep.awk video.lst
  406. cat $< | sort | $(AWK) -f $(srcdir)/genmoddep.awk > $@ || (rm -f $@; exit 1)
  407. platform_DATA += moddep.lst
  408. CLEANFILES += config.log syminfo.lst moddep.lst extra_deps.lst
  409. $(MOD_FILES): %.mod : genmod.sh moddep.lst %.module$(EXEEXT) build-grub-module-verifier$(BUILD_EXEEXT)
  410. TARGET_OBJ2ELF=@TARGET_OBJ2ELF@ sh $^ $@
  411. platform_DATA += $(MOD_FILES)
  412. platform_DATA += modinfo.sh
  413. CLEANFILES += $(MOD_FILES)
  414. if COND_ENABLE_EFIEMU
  415. efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
  416. -rm -f $@
  417. -rm -f $@.bin
  418. $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m32 -Wall -Werror -nostdlib -static -O2 -c -o $@.bin $<
  419. if test "x$(TARGET_APPLE_LINKER)" = x1; then \
  420. $(TARGET_OBJCONV) -felf32 -nu -nd $@.bin $@ || exit 1; \
  421. rm -f $@.bin ; \
  422. elif test ! -z "$(TARGET_OBJ2ELF)"; then \
  423. $(TARGET_OBJ2ELF) $@.bin || (rm -f $@.bin; exit 1); \
  424. mv $@.bin $@ ; \
  425. else \
  426. mv $@.bin $@ ; \
  427. fi
  428. # Link format -arch,x86_64 means Apple linker
  429. efiemu64_c.o: efiemu/runtime/efiemu.c
  430. $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -nostdlib -Wall -Werror -O2 -mcmodel=large -mno-red-zone -c -o $@ $<
  431. efiemu64_s.o: efiemu/runtime/efiemu.S
  432. $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -Wall -Werror -nostdlib -O2 -mcmodel=large -mno-red-zone -c -o $@ $<
  433. efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELEF)
  434. -rm -f $@
  435. -rm -f $@.bin
  436. $(TARGET_CC) -m64 $(EFIEMU64_LINK_FORMAT) -nostdlib -static -Wl,-r -o $@.bin $^
  437. if test "x$(EFIEMU64_LINK_FORMAT)" = x-arch,x86_64; then \
  438. $(TARGET_OBJCONV) -felf64 -nu -nd $@.bin $@ || exit 1; \
  439. rm -f $@.bin; \
  440. else \
  441. mv $@.bin $@ ; \
  442. fi
  443. platform_DATA += efiemu32.o efiemu64.o
  444. CLEANFILES += efiemu32.o efiemu64.o efiemu64_c.o efiemu64_s.o
  445. endif
  446. windowsdir=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows
  447. windowsdir: $(PROGRAMS) $(starfield_DATA) $(platform_DATA)
  448. test -d $(windowsdir)/$(target_cpu)-$(platform) || mkdir $(windowsdir)/$(target_cpu)-$(platform)
  449. for x in $(platform_DATA); do \
  450. cp -fp $$x $(windowsdir)/$(target_cpu)-$(platform)/$$x; \
  451. done