]> git.proxmox.com Git - grub2.git/blob - conf/Makefile.common
Merge branch 'new-autogen'
[grub2.git] / conf / Makefile.common
1 # -*- makefile -*-
2
3 CFLAGS_PLATFORM=
4
5 export LC_COLLATE := C
6 unexport LC_ALL
7
8 # Platform specific options
9 if COND_mips_loongson
10 CFLAGS_PLATFORM += -mexplicit-relocs
11 CPPFLAGS_PLATFORM = -DUSE_ASCII_FALLBACK
12 endif
13 if COND_sparc64_ieee1275
14 CFLAGS_PLATFORM += -mno-app-regs
15 LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax
16 endif
17 if COND_arm
18 CFLAGS_PLATFORM += -mthumb-interwork -mlong-calls
19 CCASFLAGS_PLATFORM = -mthumb-interwork
20 LDFLAGS_PLATFORM = -Wl,--wrap=__clear_cache
21 endif
22
23 #FIXME: discover and check XEN headers
24 CPPFLAGS_XEN = -I/usr/include
25
26 # Other options
27
28 CPPFLAGS_DEFAULT = -DGRUB_FILE=\"$(subst $(srcdir)/,,$<)\"
29 CPPFLAGS_DEFAULT += -I$(builddir)
30 CPPFLAGS_DEFAULT += -I$(srcdir)
31 CPPFLAGS_DEFAULT += -I$(top_builddir)
32 CPPFLAGS_DEFAULT += -I$(top_srcdir)
33 CPPFLAGS_DEFAULT += -I$(top_srcdir)/include
34 CPPFLAGS_DEFAULT += -I$(top_builddir)/include
35 CPPFLAGS_DEFAULT += -I$(top_srcdir)/grub-core/lib/libgcrypt-grub/include
36 CPPFLAGS_DEFAULT += -I$(top_srcdir)/grub-core/lib/libgcrypt-grub/src/
37 CCASFLAGS_DEFAULT = $(CPPFLAGS_DEFAULT) -DASM_FILE=1
38 BUILD_CPPFLAGS += $(CPPFLAGS_DEFAULT)
39
40 LDADD_KERNEL = $(TARGET_LIBGCC)
41
42 CFLAGS_KERNEL = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
43 LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) $(TARGET_LDFLAGS_STATIC_LIBGCC)
44 CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
45 CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
46 if COND_CYGWIN
47 STRIPFLAGS_KERNEL = -F elf32-i386 -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version
48 else
49 STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .note.gnu.gold-version
50 endif
51
52 CFLAGS_MODULE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
53 LDFLAGS_MODULE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
54 CPPFLAGS_MODULE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
55 CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
56
57 CFLAGS_IMAGE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -fno-builtin
58 LDFLAGS_IMAGE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-S
59 CPPFLAGS_IMAGE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
60 CCASFLAGS_IMAGE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
61
62 CFLAGS_PROGRAM =
63 LDFLAGS_PROGRAM =
64 CPPFLAGS_PROGRAM =
65 CCASFLAGS_PROGRAM =
66
67 CFLAGS_LIBRARY =
68 CPPFLAGS_LIBRARY =
69 CCASFLAGS_LIBRARY =
70
71 # Other variables
72
73 grubconfdir = $(sysconfdir)/grub.d
74 platformdir = $(pkglibdir)/$(target_cpu)-$(platform)
75 starfielddir = $(pkgdatadir)/themes/starfield
76
77 CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion -Wno-old-style-definition
78 CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/gnulib -I$(top_srcdir)/grub-core/gnulib
79
80 CFLAGS_POSIX = -fno-builtin
81 CPPFLAGS_POSIX = -I$(top_srcdir)/grub-core/lib/posix_wrap
82
83 CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers -Wno-redundant-decls -Wno-undef $(CFLAGS_POSIX)
84 CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap $(CPPFLAGS_POSIX) -D_GCRYPT_IN_LIBGCRYPT=1 -I$(top_srcdir)/include/grub/gcrypt
85
86 CPPFLAGS_EFIEMU = -I$(top_srcdir)/grub-core/efiemu/runtime
87
88 # List file macros for recognizing /interesting/ modules
89 CPPFLAGS_FS_LIST = -Dgrub_fs_register=FS_LIST_MARKER
90 CPPFLAGS_VIDEO_LIST= -Dgrub_video_register=VIDEO_LIST_MARKER
91 CPPFLAGS_PARTMAP_LIST = -Dgrub_partition_map_register=PARTMAP_LIST_MARKER
92 CPPFLAGS_PARTTOOL_LIST = -Dgrub_parttool_register=PARTTOOL_LIST_MARKER
93 CPPFLAGS_TERMINAL_LIST = '-Dgrub_term_register_input(...)=INPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
94 CPPFLAGS_TERMINAL_LIST += '-Dgrub_term_register_output(...)=OUTPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
95 CPPFLAGS_COMMAND_LIST = '-Dgrub_register_command(...)=COMMAND_LIST_MARKER(__VA_ARGS__)'
96 CPPFLAGS_COMMAND_LIST += '-Dgrub_register_extcmd(...)=EXTCOMMAND_LIST_MARKER(__VA_ARGS__)'
97 CPPFLAGS_COMMAND_LIST += '-Dgrub_register_command_p1(...)=P1COMMAND_LIST_MARKER(__VA_ARGS__)'
98 CPPFLAGS_MARKER = $(CPPFLAGS_FS_LIST) $(CPPFLAGS_VIDEO_LIST) \
99 $(CPPFLAGS_PARTTOOL_LIST) $(CPPFLAGS_PARTMAP_LIST) \
100 $(CPPFLAGS_TERMINAL_LIST) $(CPPFLAGS_COMMAND_LIST)
101
102 # Define these variables to calm down automake
103
104 IMG_FILES =
105 MOD_FILES =
106 MODULE_FILES =
107 MARKER_FILES =
108 KERNEL_HEADER_FILES =
109
110 man_MANS =
111 noinst_DATA =
112 pkgdata_DATA =
113 bin_SCRIPTS =
114 sbin_SCRIPTS =
115 bin_PROGRAMS =
116 platform_DATA =
117 sbin_PROGRAMS =
118 check_SCRIPTS =
119 dist_grubconf_DATA =
120 check_PROGRAMS =
121 noinst_SCRIPTS =
122 noinst_PROGRAMS =
123 grubconf_SCRIPTS =
124 noinst_LIBRARIES =
125 dist_noinst_DATA =
126 platform_SCRIPTS =
127 platform_PROGRAMS =
128
129 TESTS =
130 EXTRA_DIST =
131 CLEANFILES =
132 BUILT_SOURCES =
133
134 # Rules for Automake input
135
136 .PRECIOUS: $(top_srcdir)/Makefile.util.am
137 $(top_srcdir)/Makefile.util.am: $(top_srcdir)/gentpl.py $(top_srcdir)/Makefile.util.def $(top_srcdir)/Makefile.utilgcry.def
138 python $^ > $@.new || (rm -f $@.new; exit 1)
139 mv $@.new $@
140
141 .PRECIOUS: $(top_srcdir)/grub-core/Makefile.core.am
142 $(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
143 if [ "x$$GRUB_CONTRIB" != x ]; then echo "You need to run ./autogen.sh manually." >&2; exit 1; fi
144 python $^ > $@.new || (rm -f $@.new; exit 1)
145 mv $@.new $@