2010-08-20 12:51:31 +00:00
|
|
|
# -*- makefile -*-
|
|
|
|
|
2010-09-11 14:58:06 +00:00
|
|
|
CFLAGS_PLATFORM=
|
|
|
|
|
2011-04-08 11:57:56 +00:00
|
|
|
export LC_COLLATE := C
|
|
|
|
export LC_CTYPE := C
|
|
|
|
unexport LC_ALL
|
|
|
|
|
2010-08-20 04:44:29 +00:00
|
|
|
# Platform specific options
|
|
|
|
if COND_i386_pc
|
2010-09-11 14:58:06 +00:00
|
|
|
CFLAGS_PLATFORM += -mrtd -mregparm=3
|
2010-08-20 04:44:29 +00:00
|
|
|
endif
|
|
|
|
if COND_i386_efi
|
2012-04-18 21:37:25 +00:00
|
|
|
LDFLAGS_PLATFORM = -Wl,-melf_i386
|
2010-08-20 04:44:29 +00:00
|
|
|
endif
|
|
|
|
if COND_x86_64_efi
|
2012-04-18 21:37:25 +00:00
|
|
|
LDFLAGS_PLATFORM = -Wl,-melf_x86_64
|
2010-08-20 04:44:29 +00:00
|
|
|
endif
|
|
|
|
if COND_i386_qemu
|
2010-09-11 14:58:06 +00:00
|
|
|
CFLAGS_PLATFORM += -mrtd -mregparm=3
|
2010-08-20 04:44:29 +00:00
|
|
|
endif
|
|
|
|
if COND_i386_coreboot
|
2010-09-11 14:58:06 +00:00
|
|
|
CFLAGS_PLATFORM += -mrtd -mregparm=3
|
2010-08-20 04:44:29 +00:00
|
|
|
endif
|
|
|
|
if COND_i386_ieee1275
|
2010-09-11 14:58:06 +00:00
|
|
|
CFLAGS_PLATFORM += -mrtd -mregparm=3
|
2010-08-20 04:44:29 +00:00
|
|
|
endif
|
2011-02-19 12:18:05 +00:00
|
|
|
if COND_mips_loongson
|
2010-11-07 15:29:10 +00:00
|
|
|
CFLAGS_PLATFORM += -mexplicit-relocs
|
2013-06-07 13:35:16 +00:00
|
|
|
CPPFLAGS_PLATFORM = -DUSE_ASCII_FALLBACK
|
2010-08-20 04:44:29 +00:00
|
|
|
endif
|
2010-09-11 14:58:06 +00:00
|
|
|
if COND_mips
|
2013-03-03 14:57:30 +00:00
|
|
|
CFLAGS_PLATFORM += -mflush-func=grub_red_herring
|
2011-05-13 14:36:05 +00:00
|
|
|
CCASFLAGS_PLATFORM = -march=mips3
|
2010-09-11 14:58:06 +00:00
|
|
|
endif
|
2010-08-20 04:44:29 +00:00
|
|
|
if COND_sparc64_ieee1275
|
2010-09-11 14:58:06 +00:00
|
|
|
CFLAGS_PLATFORM += -mno-app-regs
|
2012-04-18 21:37:25 +00:00
|
|
|
LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax
|
2010-08-20 04:44:29 +00:00
|
|
|
endif
|
2013-04-07 00:41:07 +00:00
|
|
|
if COND_arm
|
2013-05-03 12:41:08 +00:00
|
|
|
CFLAGS_PLATFORM += -mthumb-interwork -mlong-calls
|
2013-04-07 00:41:07 +00:00
|
|
|
LDFLAGS_PLATFORM = -Wl,--wrap=__clear_cache
|
|
|
|
endif
|
2010-08-20 04:44:29 +00:00
|
|
|
|
|
|
|
# Other options
|
|
|
|
|
2013-05-08 09:05:37 +00:00
|
|
|
if ! COND_emu
|
2013-08-21 18:59:18 +00:00
|
|
|
CFLAGS_PLATFORM += -Dfloat=__grub_poison
|
|
|
|
CFLAGS_PLATFORM += -Ddouble=__grub_poison
|
2013-05-08 09:05:37 +00:00
|
|
|
endif
|
|
|
|
|
2010-08-30 04:07:35 +00:00
|
|
|
CPPFLAGS_DEFAULT = -DGRUB_FILE=\"$(subst $(srcdir)/,,$<)\"
|
2010-08-20 04:44:29 +00:00
|
|
|
CPPFLAGS_DEFAULT += -I$(builddir)
|
|
|
|
CPPFLAGS_DEFAULT += -I$(srcdir)
|
|
|
|
CPPFLAGS_DEFAULT += -I$(top_builddir)
|
|
|
|
CPPFLAGS_DEFAULT += -I$(top_srcdir)
|
|
|
|
CPPFLAGS_DEFAULT += -I$(top_srcdir)/include
|
|
|
|
CPPFLAGS_DEFAULT += -I$(top_builddir)/include
|
2013-01-11 20:32:42 +00:00
|
|
|
CPPFLAGS_DEFAULT += -I$(top_srcdir)/grub-core/lib/libgcrypt-grub/include
|
|
|
|
CPPFLAGS_DEFAULT += -I$(top_srcdir)/grub-core/lib/libgcrypt-grub/src/
|
2013-05-30 19:36:12 +00:00
|
|
|
CCASFLAGS_DEFAULT = $(CPPFLAGS_DEFAULT) -DASM_FILE=1
|
2013-08-14 08:56:55 +00:00
|
|
|
BUILD_CPPFLAGS += $(CPPFLAGS_DEFAULT)
|
2010-08-20 04:44:29 +00:00
|
|
|
|
2010-11-14 22:36:20 +00:00
|
|
|
LDADD_KERNEL =
|
|
|
|
|
|
|
|
if ! COND_i386_pc
|
|
|
|
if ! COND_i386_efi
|
|
|
|
if ! COND_i386_qemu
|
|
|
|
if ! COND_i386_coreboot
|
|
|
|
if ! COND_i386_multiboot
|
|
|
|
if ! COND_i386_ieee1275
|
|
|
|
if ! COND_x86_64_efi
|
|
|
|
LDADD_KERNEL += -lgcc
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2010-08-20 04:44:29 +00:00
|
|
|
CFLAGS_KERNEL = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
|
2012-02-29 15:30:20 +00:00
|
|
|
LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -static-libgcc
|
2010-08-20 04:44:29 +00:00
|
|
|
CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
|
|
|
|
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
2011-01-13 21:23:49 +00:00
|
|
|
if COND_CYGWIN
|
2012-03-10 15:55:48 +00:00
|
|
|
STRIPFLAGS_KERNEL = -F elf32-i386 -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version
|
2011-01-13 21:23:49 +00:00
|
|
|
else
|
2012-03-10 15:55:48 +00:00
|
|
|
STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .note.gnu.gold-version
|
2011-01-13 21:23:49 +00:00
|
|
|
endif
|
2010-08-20 04:44:29 +00:00
|
|
|
|
|
|
|
CFLAGS_MODULE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
|
2012-02-29 15:30:20 +00:00
|
|
|
LDFLAGS_MODULE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
|
2010-08-20 04:44:29 +00:00
|
|
|
CPPFLAGS_MODULE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
|
|
|
|
CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
|
|
|
|
|
|
|
CFLAGS_IMAGE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -fno-builtin
|
2012-02-29 15:30:20 +00:00
|
|
|
LDFLAGS_IMAGE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-S
|
2010-08-20 04:44:29 +00:00
|
|
|
CPPFLAGS_IMAGE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
|
|
|
|
CCASFLAGS_IMAGE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
|
|
|
|
|
|
|
CFLAGS_PROGRAM =
|
|
|
|
LDFLAGS_PROGRAM =
|
|
|
|
CPPFLAGS_PROGRAM =
|
|
|
|
CCASFLAGS_PROGRAM =
|
|
|
|
|
2010-10-19 05:14:57 +00:00
|
|
|
CFLAGS_LIBRARY =
|
|
|
|
CPPFLAGS_LIBRARY =
|
|
|
|
CCASFLAGS_LIBRARY =
|
2010-08-20 04:44:29 +00:00
|
|
|
|
|
|
|
# Other variables
|
|
|
|
|
|
|
|
grubconfdir = $(sysconfdir)/grub.d
|
2012-02-27 00:44:10 +00:00
|
|
|
platformdir = $(pkglibdir)/$(target_cpu)-$(platform)
|
2012-02-23 16:21:38 +00:00
|
|
|
starfielddir = $(pkgdatadir)/themes/starfield
|
2010-08-20 04:44:29 +00:00
|
|
|
|
2012-02-24 11:30:32 +00:00
|
|
|
CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion -Wno-old-style-definition -Wno-unsafe-loop-optimizations
|
2010-09-21 12:37:50 +00:00
|
|
|
CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/gnulib -I$(top_srcdir)/grub-core/gnulib
|
2010-08-20 04:44:29 +00:00
|
|
|
|
|
|
|
CFLAGS_POSIX = -fno-builtin
|
|
|
|
CPPFLAGS_POSIX = -I$(top_srcdir)/grub-core/lib/posix_wrap
|
|
|
|
|
2013-04-07 00:41:07 +00:00
|
|
|
CPPFLAGS_LIBFDT = -I$(top_srcdir)/grub-core/lib/dtc-grub/libfdt $(CPPFLAGS_POSIX)
|
|
|
|
|
2013-08-22 14:30:44 +00:00
|
|
|
CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers -Wno-redundant-decls $(CFLAGS_POSIX)
|
2013-01-11 20:32:42 +00:00
|
|
|
CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap $(CPPFLAGS_POSIX) -D_GCRYPT_IN_LIBGCRYPT=1 -I$(top_srcdir)/include/grub/gcrypt
|
|
|
|
|
2010-08-20 04:44:29 +00:00
|
|
|
CPPFLAGS_EFIEMU = -I$(top_srcdir)/grub-core/efiemu/runtime
|
|
|
|
|
2010-08-29 15:52:41 +00:00
|
|
|
# List file macros for recognizing /interesting/ modules
|
|
|
|
CPPFLAGS_FS_LIST = -Dgrub_fs_register=FS_LIST_MARKER
|
|
|
|
CPPFLAGS_VIDEO_LIST= -Dgrub_video_register=VIDEO_LIST_MARKER
|
|
|
|
CPPFLAGS_PARTMAP_LIST = -Dgrub_partition_map_register=PARTMAP_LIST_MARKER
|
|
|
|
CPPFLAGS_PARTTOOL_LIST = -Dgrub_parttool_register=PARTTOOL_LIST_MARKER
|
|
|
|
CPPFLAGS_TERMINAL_LIST = '-Dgrub_term_register_input(...)=INPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
|
|
|
|
CPPFLAGS_TERMINAL_LIST += '-Dgrub_term_register_output(...)=OUTPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
|
|
|
|
CPPFLAGS_COMMAND_LIST = '-Dgrub_register_command(...)=COMMAND_LIST_MARKER(__VA_ARGS__)'
|
|
|
|
CPPFLAGS_COMMAND_LIST += '-Dgrub_register_extcmd(...)=EXTCOMMAND_LIST_MARKER(__VA_ARGS__)'
|
|
|
|
CPPFLAGS_COMMAND_LIST += '-Dgrub_register_command_p1(...)=P1COMMAND_LIST_MARKER(__VA_ARGS__)'
|
|
|
|
CPPFLAGS_MARKER = $(CPPFLAGS_FS_LIST) $(CPPFLAGS_VIDEO_LIST) \
|
|
|
|
$(CPPFLAGS_PARTTOOL_LIST) $(CPPFLAGS_PARTMAP_LIST) \
|
|
|
|
$(CPPFLAGS_TERMINAL_LIST) $(CPPFLAGS_COMMAND_LIST)
|
|
|
|
|
2010-08-20 04:44:29 +00:00
|
|
|
# Define these variables to calm down automake
|
|
|
|
|
|
|
|
IMG_FILES =
|
|
|
|
MOD_FILES =
|
|
|
|
MODULE_FILES =
|
2010-08-29 15:52:41 +00:00
|
|
|
MARKER_FILES =
|
2010-08-20 04:44:29 +00:00
|
|
|
KERNEL_HEADER_FILES =
|
|
|
|
|
|
|
|
man_MANS =
|
|
|
|
noinst_DATA =
|
2012-01-24 12:17:36 +00:00
|
|
|
pkgdata_DATA =
|
2010-08-20 04:44:29 +00:00
|
|
|
bin_SCRIPTS =
|
|
|
|
sbin_SCRIPTS =
|
|
|
|
bin_PROGRAMS =
|
|
|
|
platform_DATA =
|
|
|
|
sbin_PROGRAMS =
|
|
|
|
check_SCRIPTS =
|
2013-05-14 16:54:05 +00:00
|
|
|
dist_grubconf_DATA =
|
2010-08-20 04:44:29 +00:00
|
|
|
check_PROGRAMS =
|
2010-08-23 07:53:56 +00:00
|
|
|
noinst_SCRIPTS =
|
2010-08-20 04:44:29 +00:00
|
|
|
noinst_PROGRAMS =
|
|
|
|
grubconf_SCRIPTS =
|
|
|
|
noinst_LIBRARIES =
|
2010-09-03 15:53:00 +00:00
|
|
|
dist_noinst_DATA =
|
2012-02-18 19:25:11 +00:00
|
|
|
platform_SCRIPTS =
|
|
|
|
platform_PROGRAMS =
|
2010-08-20 04:44:29 +00:00
|
|
|
|
|
|
|
TESTS =
|
|
|
|
EXTRA_DIST =
|
|
|
|
CLEANFILES =
|
|
|
|
BUILT_SOURCES =
|
2010-08-20 12:51:31 +00:00
|
|
|
|
|
|
|
# Rules for autogen definition files
|
|
|
|
|
|
|
|
.PRECIOUS: $(top_srcdir)/Makefile.tpl
|
|
|
|
$(top_srcdir)/Makefile.tpl: $(top_srcdir)/gentpl.py
|
|
|
|
python $< | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
|
|
|
|
mv $@.new $@
|
|
|
|
|
|
|
|
.PRECIOUS: $(top_srcdir)/Makefile.util.am
|
2013-01-20 22:44:42 +00:00
|
|
|
$(top_srcdir)/Makefile.util.am: $(top_srcdir)/Makefile.util.def $(top_srcdir)/Makefile.utilgcry.def $(top_srcdir)/Makefile.tpl
|
|
|
|
cat $(top_srcdir)/Makefile.util.def $(top_srcdir)/Makefile.utilgcry.def | autogen -T $(top_srcdir)/Makefile.tpl | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
|
2010-08-20 12:51:31 +00:00
|
|
|
mv $@.new $@
|
|
|
|
|
|
|
|
.PRECIOUS: $(top_srcdir)/grub-core/Makefile.core.am
|
2010-09-24 08:48:27 +00:00
|
|
|
$(top_srcdir)/grub-core/Makefile.core.am: $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def $(top_srcdir)/Makefile.tpl
|
|
|
|
if [ "x$$GRUB_CONTRIB" != x ]; then echo "You need to run ./autogen.sh manually." >&2; exit 1; fi
|
2013-01-20 22:44:42 +00:00
|
|
|
cat $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def | autogen -T $(top_srcdir)/Makefile.tpl | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
|
2010-08-20 12:51:31 +00:00
|
|
|
mv $@.new $@
|