Makefile.am 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  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/env.h
  57. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env_private.h
  58. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/err.h
  59. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/file.h
  60. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fs.h
  61. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h
  62. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/kernel.h
  63. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/list.h
  64. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/misc.h
  65. if COND_emu
  66. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/compiler-rt-emu.h
  67. else
  68. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/compiler-rt.h
  69. endif
  70. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm.h
  71. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/parser.h
  72. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/partition.h
  73. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h
  74. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h
  75. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h
  76. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h
  77. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h
  78. if COND_i386_pc
  79. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
  80. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pxe.h
  81. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/int.h
  82. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
  83. endif
  84. if COND_i386_efi
  85. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
  86. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
  87. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
  88. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
  89. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
  90. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pmtimer.h
  91. endif
  92. if COND_i386_coreboot
  93. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
  94. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/coreboot/lbio.h
  95. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h
  96. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h
  97. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h
  98. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h
  99. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h
  100. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
  101. endif
  102. if COND_i386_multiboot
  103. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
  104. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
  105. endif
  106. if COND_i386_qemu
  107. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
  108. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
  109. endif
  110. if COND_i386_ieee1275
  111. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
  112. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
  113. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  114. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
  115. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
  116. endif
  117. if COND_i386_xen
  118. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/xen.h
  119. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/xen/hypercall.h
  120. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
  121. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  122. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
  123. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
  124. endif
  125. if COND_x86_64_xen
  126. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/xen.h
  127. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/x86_64/xen/hypercall.h
  128. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
  129. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  130. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
  131. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
  132. endif
  133. if COND_x86_64_efi
  134. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
  135. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
  136. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
  137. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
  138. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
  139. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pmtimer.h
  140. endif
  141. if COND_ia64_efi
  142. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
  143. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
  144. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
  145. endif
  146. if COND_mips
  147. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/kernel.h
  148. endif
  149. if COND_mips_arc
  150. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  151. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arc/arc.h
  152. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
  153. endif
  154. if COND_mips_qemu_mips
  155. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h
  156. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
  157. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/serial.h
  158. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
  159. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
  160. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  161. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
  162. endif
  163. if COND_mips_loongson
  164. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h
  165. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
  166. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/time.h
  167. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h
  168. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h
  169. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h
  170. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h
  171. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h
  172. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
  173. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cs5536.h
  174. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pci.h
  175. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/serial.h
  176. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
  177. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
  178. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  179. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
  180. endif
  181. if COND_mips_qemu_mips
  182. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
  183. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
  184. endif
  185. if COND_powerpc_ieee1275
  186. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
  187. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
  188. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  189. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
  190. endif
  191. if COND_sparc64_ieee1275
  192. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
  193. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sparc64/ieee1275/ieee1275.h
  194. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
  195. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  196. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
  197. endif
  198. if COND_arm_uboot
  199. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/uboot/uboot.h
  200. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/uboot/disk.h
  201. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  202. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
  203. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h
  204. endif
  205. if COND_arm_coreboot
  206. KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h
  207. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h
  208. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h
  209. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h
  210. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h
  211. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h
  212. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h
  213. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fdt.h
  214. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/dma.h
  215. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/coreboot/kernel.h
  216. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fdtbus.h
  217. endif
  218. if COND_arm_efi
  219. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/efi/loader.h
  220. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
  221. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
  222. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h
  223. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
  224. endif
  225. if COND_arm64_efi
  226. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
  227. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
  228. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
  229. endif
  230. if COND_emu
  231. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/datetime.h
  232. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/misc.h
  233. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/net.h
  234. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostdisk.h
  235. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostfile.h
  236. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
  237. if COND_GRUB_EMU_SDL
  238. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h
  239. endif
  240. if COND_GRUB_EMU_PCI
  241. KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libpciaccess.h
  242. endif
  243. endif
  244. symlist.h: $(top_builddir)/config.h $(KERNEL_HEADER_FILES)
  245. @list='$^'; \
  246. for p in $$list; do \
  247. echo "#include <$$p>" >> $@ || (rm -f $@; exit 1); \
  248. done
  249. CLEANFILES += symlist.h
  250. BUILT_SOURCES += symlist.h
  251. symlist.c: symlist.h gensymlist.sh
  252. $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) -DGRUB_SYMBOL_GENERATOR=1 symlist.h > symlist.p || (rm -f symlist.p; exit 1)
  253. cat symlist.p | $(SHELL) $(srcdir)/gensymlist.sh $(top_builddir)/config.h $(KERNEL_HEADER_FILES) >$@ || (rm -f $@; exit 1)
  254. rm -f symlist.p
  255. CLEANFILES += symlist.c
  256. BUILT_SOURCES += symlist.c
  257. if COND_HAVE_ASM_USCORE
  258. ASM_PREFIX=_
  259. else
  260. ASM_PREFIX=
  261. endif
  262. noinst_DATA += kernel_syms.lst
  263. kernel_syms.lst: $(KERNEL_HEADER_FILES) $(top_builddir)/config.h
  264. $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) $(CFLAGS) -DGRUB_SYMBOL_GENERATOR=1 $^ >kernel_syms.input
  265. cat kernel_syms.input | grep -v '^#' | sed -n \
  266. -e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/defined kernel '"$(ASM_PREFIX)"'\1/;p;}' \
  267. -e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/defined kernel '"$(ASM_PREFIX)"'\1/;p;}' \
  268. | sort -u >$@
  269. rm -f kernel_syms.input
  270. CLEANFILES += kernel_syms.lst
  271. if COND_emu
  272. kern/emu/grub_emu-main.$(OBJEXT):grub_emu_init.h
  273. grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h
  274. kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h
  275. grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h
  276. grub_emu_init.h: genemuinitheader.sh $(MODULE_FILES)
  277. rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@
  278. CLEANFILES += grub_emu_init.h
  279. grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MODULE_FILES)
  280. rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@
  281. CLEANFILES += grub_emu_init.c
  282. endif
  283. # List files
  284. fs.lst: $(MARKER_FILES)
  285. (for pp in $^; do \
  286. b=`basename $$pp .marker`; \
  287. if grep 'FS_LIST_MARKER' $$pp >/dev/null 2>&1; then \
  288. echo $$b; \
  289. fi; \
  290. done) | sort -u > $@
  291. platform_DATA += fs.lst
  292. CLEANFILES += fs.lst
  293. command.lst: $(MARKER_FILES)
  294. (for pp in $^; do \
  295. b=`basename $$pp .marker`; \
  296. sed -n \
  297. -e "/EXTCOMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
  298. -e "/P1COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
  299. -e "/COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" $$pp; \
  300. done) | sort -u > $@
  301. platform_DATA += command.lst
  302. CLEANFILES += command.lst
  303. partmap.lst: $(MARKER_FILES)
  304. (for pp in $^; do \
  305. b=`basename $$pp .marker`; \
  306. if grep 'PARTMAP_LIST_MARKER' $$pp >/dev/null 2>&1; then \
  307. echo $$b; \
  308. fi; \
  309. done) | sort -u > $@
  310. platform_DATA += partmap.lst
  311. CLEANFILES += partmap.lst
  312. terminal.lst: $(MARKER_FILES)
  313. (for pp in $^; do \
  314. b=`basename $$pp .marker`; \
  315. sed -n \
  316. -e "/INPUT_TERMINAL_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/i\1: $$b/;p;}" \
  317. -e "/OUTPUT_TERMINAL_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/o\1: $$b/;p;}" $$pp; \
  318. done) | sort -u > $@
  319. platform_DATA += terminal.lst
  320. CLEANFILES += terminal.lst
  321. fdt.lst: $(MARKER_FILES)
  322. (for pp in $^; do \
  323. b=`basename $$pp .marker`; \
  324. sed -n \
  325. -e "/FDT_DRIVER_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/i\1: $$b/;p;}" \
  326. -e "/FDT_DRIVER_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/o\1: $$b/;p;}" $$pp; \
  327. done) | sort -u > $@
  328. platform_DATA += fdt.lst
  329. CLEANFILES += fdt.lst
  330. parttool.lst: $(MARKER_FILES)
  331. (for pp in $^; do \
  332. b=`basename $$pp .marker`; \
  333. sed -n \
  334. -e "/PARTTOOL_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" $$pp; \
  335. done) | sort -u > $@
  336. platform_DATA += parttool.lst
  337. CLEANFILES += parttool.lst
  338. video.lst: $(MARKER_FILES)
  339. (for pp in $^; do \
  340. b=`basename $$pp .marker`; \
  341. if grep 'VIDEO_LIST_MARKER' $$pp >/dev/null 2>&1; then \
  342. echo $$b; \
  343. fi; \
  344. done) | sort -u > $@
  345. platform_DATA += video.lst
  346. CLEANFILES += video.lst
  347. # but, crypto.lst is simply copied
  348. crypto.lst: $(srcdir)/lib/libgcrypt-grub/cipher/crypto.lst
  349. cp $^ $@
  350. platform_DATA += crypto.lst
  351. CLEANFILES += crypto.lst
  352. syminfo.lst: gensyminfo.sh kernel_syms.lst $(MODULE_FILES)
  353. cat kernel_syms.lst > $@.new
  354. for m in $(MODULE_FILES); do \
  355. sh $< $$m >> $@.new || exit 1; \
  356. done
  357. mv $@.new $@
  358. # generate global module dependencies list
  359. moddep.lst: syminfo.lst genmoddep.awk video.lst
  360. cat $< | sort | $(AWK) -f $(srcdir)/genmoddep.awk > $@ || (rm -f $@; exit 1)
  361. platform_DATA += moddep.lst
  362. CLEANFILES += config.log syminfo.lst moddep.lst
  363. $(MOD_FILES): %.mod : genmod.sh moddep.lst %.module$(EXEEXT) build-grub-module-verifier$(BUILD_EXEEXT)
  364. TARGET_OBJ2ELF=@TARGET_OBJ2ELF@ sh $^ $@
  365. platform_DATA += $(MOD_FILES)
  366. platform_DATA += modinfo.sh
  367. CLEANFILES += $(MOD_FILES)
  368. if COND_ENABLE_EFIEMU
  369. efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
  370. -rm -f $@
  371. -rm -f $@.bin
  372. $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m32 -Wall -Werror -nostdlib -static -O2 -c -o $@.bin $<
  373. if test "x$(TARGET_APPLE_LINKER)" = x1; then \
  374. $(TARGET_OBJCONV) -felf32 -nu -nd $@.bin $@ || exit 1; \
  375. rm -f $@.bin ; \
  376. elif test ! -z "$(TARGET_OBJ2ELF)"; then \
  377. $(TARGET_OBJ2ELF) $@.bin || (rm -f $@.bin; exit 1); \
  378. mv $@.bin $@ ; \
  379. else \
  380. mv $@.bin $@ ; \
  381. fi
  382. # Link format -arch,x86_64 means Apple linker
  383. efiemu64_c.o: efiemu/runtime/efiemu.c
  384. $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -nostdlib -Wall -Werror -O2 -mcmodel=large -mno-red-zone -c -o $@ $<
  385. efiemu64_s.o: efiemu/runtime/efiemu.S
  386. $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -Wall -Werror -nostdlib -O2 -mcmodel=large -mno-red-zone -c -o $@ $<
  387. efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELEF)
  388. -rm -f $@
  389. -rm -f $@.bin
  390. $(TARGET_CC) -m64 $(EFIEMU64_LINK_FORMAT) -nostdlib -static -Wl,-r -o $@.bin $^
  391. if test "x$(EFIEMU64_LINK_FORMAT)" = x-arch,x86_64; then \
  392. $(TARGET_OBJCONV) -felf64 -nu -nd $@.bin $@ || exit 1; \
  393. rm -f $@.bin; \
  394. else \
  395. mv $@.bin $@ ; \
  396. fi
  397. platform_DATA += efiemu32.o efiemu64.o
  398. CLEANFILES += efiemu32.o efiemu64.o efiemu64_c.o efiemu64_s.o
  399. endif
  400. windowsdir=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows
  401. windowsdir: $(PROGRAMS) $(starfield_DATA) $(platform_DATA)
  402. test -d $(windowsdir)/$(target_cpu)-$(platform) || mkdir $(windowsdir)/$(target_cpu)-$(platform)
  403. for x in $(platform_DATA); do \
  404. cp -fp $$x $(windowsdir)/$(target_cpu)-$(platform)/$$x; \
  405. done