]>
Commit | Line | Data |
---|---|---|
8c411768 BC |
1 | AUTOMAKE_OPTIONS = subdir-objects |
2 | SUBDIRS = po | |
3 | DEPDIR = .deps-core | |
4 | ||
5 | include $(top_srcdir)/Makefile.extra-dist | |
6 | include $(top_srcdir)/Makefile.vars | |
7 | ||
8 | LDADD_KERNEL = -lgcc | |
9 | CFLAGS_KERNEL = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding | |
10 | LDFLAGS_KERNEL = $(TARGET_LDFLAGS) $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N -static-libgcc | |
11 | CPPFLAGS_KERNEL = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) | |
12 | CCASFLAGS_KERNEL = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) | |
13 | ||
14 | CFLAGS_MODULE = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding | |
15 | LDFLAGS_MODULE = $(TARGET_LDFLAGS) $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N,-r,-d | |
16 | CPPFLAGS_MODULE = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) | |
17 | CCASFLAGS_MODULE = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) | |
18 | ||
19 | CFLAGS_IMAGE = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -fno-builtin | |
20 | LDFLAGS_IMAGE = $(TARGET_LDFLAGS) $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N,-S | |
21 | CPPFLAGS_IMAGE = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) | |
22 | CCASFLAGS_IMAGE = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) | |
23 | ||
24 | CFLAGS_LIBRARY = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -fno-builtin | |
25 | CPPFLAGS_LIBRARY = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) | |
26 | CCASFLAGS_LIBRARY = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) | |
27 | ||
28 | CFLAGS_PROGRAM = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) | |
29 | LDFLAGS_PROGRAM = $(TARGET_LDFLAGS) $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) | |
30 | CPPFLAGS_PROGRAM = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) | |
31 | CCASFLAGS_PROGRAM = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) | |
32 | ||
33 | AM_CFLAGS = | |
34 | AM_LDFLAGS = | |
35 | AM_CPPFLAGS = $(CPPFLAGS_GRUB) -DGRUB_FILE=\"$(subst $(top_srcdir)/,,$<)\" | |
36 | AM_CCASFLAGS = -DASM_FILE=1 | |
37 | ||
38 | # gentrigtables | |
39 | gentrigtables: $(top_srcdir)/gentrigtables.c | |
40 | $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(CPPFLAGS) -lm $< | |
41 | CLEANFILES += gentrigtables | |
42 | ||
43 | # trigtables.c | |
44 | trigtables.c: gentrigtables.c configure.ac | |
45 | $(MAKE) $(AM_MAKEFLAGS) gentrigtables | |
46 | $(top_builddir)/gentrigtables > $@ | |
47 | CLEANFILES += trigtables.c | |
48 | ||
49 | # XXX Use Automake's LEX & YACC support | |
50 | # See Recording Dependencies Manually in automake doc for below rules | |
51 | script/sh_module-lexer.$(OBJEXT):grub_script.tab.h | |
52 | grub_script.tab.c grub_script.tab.h: $(top_srcdir)/script/parser.y | |
53 | $(YACC) -d -p grub_script_yy -b grub_script $(top_srcdir)/script/parser.y | |
54 | CLEANFILES += grub_script.tab.c grub_script.tab.h | |
55 | ||
56 | # For the lexer. | |
57 | # See Recording Dependencies Manually in automake doc for below rules | |
58 | script/sh_module-lexer.$(OBJEXT):grub_script.yy.h | |
59 | grub_script.yy.c grub_script.yy.h: $(top_srcdir)/script/yylex.l | |
60 | $(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $(top_srcdir)/script/yylex.l | |
61 | CLEANFILES += grub_script.yy.c grub_script.yy.h | |
62 | ||
63 | include $(srcdir)/modules.am | |
64 | include $(srcdir)/Makefile.kernel | |
65 | ||
66 | # .lst files | |
67 | platform_DATA += moddep.lst | |
68 | platform_DATA += fs.lst | |
69 | platform_DATA += command.lst | |
70 | platform_DATA += partmap.lst | |
71 | platform_DATA += handler.lst | |
72 | platform_DATA += terminal.lst | |
73 | platform_DATA += parttool.lst | |
74 | platform_DATA += video.lst | |
75 | platform_DATA += crypto.lst | |
76 | CLEANFILES += moddep.lst | |
77 | CLEANFILES += fs.lst | |
78 | CLEANFILES += command.lst | |
79 | CLEANFILES += partmap.lst | |
80 | CLEANFILES += handler.lst | |
81 | CLEANFILES += terminal.lst | |
82 | CLEANFILES += parttool.lst | |
83 | CLEANFILES += video.lst | |
84 | CLEANFILES += crypto.lst | |
85 | ||
86 | fs.lst: $(FS_FILES) | |
87 | cat $^ /dev/null | sort | uniq > $@ | |
88 | command.lst: $(COMMAND_FILES) | |
89 | cat $^ /dev/null | sort | uniq > $@ | |
90 | partmap.lst: $(PARTMAP_FILES) | |
91 | cat $^ /dev/null | sort | uniq > $@ | |
92 | handler.lst: $(HANDLER_FILES) | |
93 | cat $^ /dev/null | sort | uniq > $@ | |
94 | terminal.lst: $(TERMINAL_FILES) | |
95 | cat $^ /dev/null | sort | uniq > $@ | |
96 | parttool.lst: $(PARTTOOL_FILES) | |
97 | cat $^ /dev/null | sort | uniq > $@ | |
98 | video.lst: $(VIDEO_FILES) | |
99 | cat $^ /dev/null | sort | uniq > $@ | |
100 | ||
101 | # but, crypto.lst is simply copied | |
102 | crypto.lst: $(top_srcdir)/lib/libgcrypt-grub/cipher/crypto.lst | |
103 | cp $^ $@ | |
104 | ||
105 | # generate global module dependencies list | |
106 | moddep.lst: kernel_syms.lst genmoddep.awk $(DEF_FILES) $(UND_FILES) | |
107 | cat $(DEF_FILES) kernel_syms.lst /dev/null \ | |
108 | | $(AWK) -f $(top_srcdir)/genmoddep.awk $(UND_FILES) > $@ \ | |
109 | || (rm -f $@; exit 1) | |
110 | ||
111 | if COND_i386_pc | |
112 | if COND_ENABLE_EFIEMU | |
113 | efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF) | |
114 | -rm -f $@; \ | |
115 | if test "x$(TARGET_APPLE_CC)" = x1; then \ | |
116 | $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF32 -DAPPLE_CC -m32 -Wall -Werror -nostdlib -O2 -c -o $@.bin $< || exit 1; \ | |
117 | $(OBJCONV) -felf32 -nu -nd $@.bin $@ || exit 1; \ | |
118 | rm -f $@.bin; \ | |
119 | else \ | |
120 | $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF32 -m32 -Wall -Werror -nostdlib -O2 -c -o $@ $< || exit 1; \ | |
121 | if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \ | |
122 | fi | |
123 | ||
124 | efiemu64_c.o: efiemu/runtime/efiemu.c | |
125 | if test "x$(TARGET_APPLE_CC)" = x1; then \ | |
126 | $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF64 -DAPPLE_CC=1 -m64 -nostdlib -Wall -Werror -mno-red-zone -c -o $@ $< || exit 1; \ | |
127 | else \ | |
128 | $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF64 -m64 -nostdlib -Wall -Werror -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \ | |
129 | fi | |
130 | ||
131 | efiemu64_s.o: efiemu/runtime/efiemu.S | |
132 | -rm -f $@ | |
133 | if test "x$(TARGET_APPLE_CC)" = x1; then \ | |
134 | $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF64 -DAPPLE_CC=1 -m64 -Wall -Werror -nostdlib -O2 -mno-red-zone -c -o $@ $< || exit 1; \ | |
135 | else \ | |
136 | $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF64 -m64 -Wall -Werror -nostdlib -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \ | |
137 | fi | |
138 | ||
139 | efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELEF) | |
140 | -rm -f $@; \ | |
141 | if test "x$(TARGET_APPLE_CC)" = x1; then \ | |
142 | rm -f $@.bin; \ | |
143 | $(TARGET_CC) -m64 -Wl,-r -nostdlib -o $@.bin $^ || exit 1; \ | |
144 | $(OBJCONV) -felf64 -nu -nd $@.bin $@ || exit 1; \ | |
145 | rm -f $@.bin; \ | |
146 | else \ | |
147 | $(TARGET_CC) -m64 -nostdlib -Wl,-r -o $@ $^ || exit 1; \ | |
148 | if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \ | |
149 | fi | |
150 | ||
151 | platform_DATA += efiemu32.o efiemu64.o | |
152 | CLEANFILES += efiemu32.o efiemu64.o efiemu64_c.o efiemu64_s.o | |
153 | endif | |
154 | endif | |
155 |