grub/conf/Makefile.common

139 lines
4.7 KiB
Makefile
Raw Normal View History

2010-08-20 12:51:31 +00:00
# -*- makefile -*-
CFLAGS_PLATFORM=
export LC_COLLATE := C
unexport LC_ALL
# Platform specific options
if COND_sparc64_ieee1275
LDFLAGS_PLATFORM = -Wl,-melf64_sparc
endif
2013-04-07 00:41:07 +00:00
if COND_arm
2013-12-08 01:59:21 +00:00
if !COND_emu
2013-04-07 00:41:07 +00:00
LDFLAGS_PLATFORM = -Wl,--wrap=__clear_cache
endif
2013-12-08 01:59:21 +00:00
endif
2013-11-16 19:52:55 +00:00
if COND_arm64
CFLAGS_PLATFORM += -mcmodel=large
endif
if COND_powerpc_ieee1275
CFLAGS_PLATFORM += -mcpu=powerpc
endif
# Other options
2010-08-30 04:07:35 +00:00
CPPFLAGS_DEFAULT = -DGRUB_FILE=\"$(subst $(srcdir)/,,$<)\"
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
CPPFLAGS_DEFAULT += -I$(top_srcdir)/grub-core/lib/libgcrypt-grub/src/
CCASFLAGS_DEFAULT = $(CPPFLAGS_DEFAULT) -DASM_FILE=1
BUILD_CPPFLAGS += $(CPPFLAGS_DEFAULT)
CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding
LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC)
CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx
CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding
LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
CPPFLAGS_MODULE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
CFLAGS_IMAGE = $(CFLAGS_PLATFORM) -fno-builtin
LDFLAGS_IMAGE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-S
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 =
# Other variables
grubconfdir = $(sysconfdir)/grub.d
platformdir = $(pkglibdir)/$(target_cpu)-$(platform)
Starfield theme. * Makefile.am: Define starfield_DATA and dejavu.pf2 generation. * conf/Makefile.common: Define starfielddir. * configure.ac: Configure starfield. * themes/starfield/COPYING.CC-BY-SA-3.0: New file. * themes/starfield/README: Likewise. * themes/starfield/blob_w.png: Likewise. * themes/starfield/boot_menu_c.png: Likewise. * themes/starfield/boot_menu_e.png: Likewise. * themes/starfield/boot_menu_n.png: Likewise. * themes/starfield/boot_menu_ne.png: Likewise. * themes/starfield/boot_menu_nw.png: Likewise. * themes/starfield/boot_menu_s.png: Likewise. * themes/starfield/boot_menu_se.png: Likewise. * themes/starfield/boot_menu_sw.png: Likewise. * themes/starfield/boot_menu_w.png: Likewise. * themes/starfield/slider_c.png: Likewise. * themes/starfield/slider_n.png: Likewise. * themes/starfield/slider_s.png: Likewise. * themes/starfield/src/blob_nw.xcf: Likewise. * themes/starfield/src/bootmenu/: Likewise. * themes/starfield/src/bootmenu/center.xcf: Likewise. * themes/starfield/src/bootmenu/corner.xcf: Likewise. * themes/starfield/src/bootmenu/side.xcf: Likewise. * themes/starfield/src/slider_c.xcf: Likewise. * themes/starfield/src/slider_n.xcf: Likewise. * themes/starfield/src/slider_s.xcf: Likewise. * themes/starfield/src/terminalbox/: Likewise. * themes/starfield/src/terminalbox/center.xcf: Likewise. * themes/starfield/src/terminalbox/corner.xcf: Likewise. * themes/starfield/src/terminalbox/side.xcf: Likewise. * themes/starfield/starfield.png: Likewise. * themes/starfield/terminal_box_c.png: Likewise. * themes/starfield/terminal_box_e.png: Likewise. * themes/starfield/terminal_box_n.png: Likewise. * themes/starfield/terminal_box_ne.png: Likewise. * themes/starfield/terminal_box_nw.png: Likewise. * themes/starfield/terminal_box_s.png: Likewise. * themes/starfield/terminal_box_se.png: Likewise. * themes/starfield/terminal_box_sw.png: Likewise. * themes/starfield/terminal_box_w.png: Likewise. * themes/starfield/theme.txt: Likewise.
2012-02-23 16:21:38 +00:00
starfielddir = $(pkgdatadir)/themes/starfield
CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion
CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/gnulib -I$(top_srcdir)/grub-core/gnulib
CFLAGS_POSIX = -fno-builtin
CPPFLAGS_POSIX = -I$(top_srcdir)/grub-core/lib/posix_wrap
2013-11-07 05:35:50 +00:00
CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers -Wno-redundant-decls -Wno-undef $(CFLAGS_POSIX)
CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap $(CPPFLAGS_POSIX) -D_GCRYPT_IN_LIBGCRYPT=1 -I$(top_srcdir)/include/grub/gcrypt
CPPFLAGS_EFIEMU = -I$(top_srcdir)/grub-core/efiemu/runtime
# 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_FDT_LIST := '-Dgrub_fdtbus_register(...)=FDT_DRIVER_LIST_MARKER(__VA_ARGS__)'
CPPFLAGS_MARKER = $(CPPFLAGS_FS_LIST) $(CPPFLAGS_VIDEO_LIST) \
$(CPPFLAGS_PARTTOOL_LIST) $(CPPFLAGS_PARTMAP_LIST) \
$(CPPFLAGS_TERMINAL_LIST) $(CPPFLAGS_COMMAND_LIST) \
$(CPPFLAGS_FDT_LIST)
# Define these variables to calm down automake
IMG_FILES =
MOD_FILES =
MODULE_FILES =
MARKER_FILES =
KERNEL_HEADER_FILES =
man_MANS =
noinst_DATA =
pkgdata_DATA =
bin_SCRIPTS =
sbin_SCRIPTS =
bin_PROGRAMS =
platform_DATA =
sbin_PROGRAMS =
check_SCRIPTS =
dist_grubconf_DATA =
check_PROGRAMS =
2010-08-23 07:53:56 +00:00
noinst_SCRIPTS =
noinst_PROGRAMS =
grubconf_SCRIPTS =
noinst_LIBRARIES =
dist_noinst_DATA =
platform_SCRIPTS =
platform_PROGRAMS =
TESTS =
EXTRA_DIST =
CLEANFILES =
BUILT_SOURCES =
2010-08-20 12:51:31 +00:00
# Rules for Automake input
2010-08-20 12:51:31 +00:00
.PRECIOUS: $(top_srcdir)/Makefile.util.am
$(top_srcdir)/Makefile.util.am: $(top_srcdir)/gentpl.py $(top_srcdir)/Makefile.util.def $(top_srcdir)/Makefile.utilgcry.def
python: Use AM_PATH_PYTHON to determine interpreter for gentpl.py gentpl.py is python2/3-agnostic, but there's no way to cause it to be run with any interpreter other than 'python', it's just hard-coded into Makefile.common that way. Adjust that to use AM_PATH_PYTHON (provided by automake) to find an interpreter and run gentpl.py with that instead. This makes grub buildable when `python` does not exist (but rather `python3` or `python2` or `python2.7`, etc.) Minimum version is set to 2.6 as this is the first version with `__future__.print_function` available. Note, AM_PATH_PYTHON respects the PYTHON environment variable and will treat its value as the *only* candidate for a valid interpreter if it is set - when PYTHON is set, AM_PATH_PYTHON will not try to find any alternative interpreter, it will only check whether the interpreter set as the value of PYTHON meets the requirements and use it if so or fail if not. This means that when using grub's `autogen.sh`, as it too uses the value of the PYTHON environment variable (and if it is not set, just sets it to 'python') you cannot rely on AM_PATH_PYTHON interpreter discovery. If your desired Python interpreter is not just 'python', you must set the PYTHON environment variable, e.g. 'PYTHON=/usr/local/bin/python3 ./autogen.sh'. The specified interpreter will then be used both by autogen.sh itself and by the autotools-driven build scripts. Signed-off-by: Adam Williamson <awilliam@redhat.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2018-07-04 16:55:52 +00:00
$(PYTHON) $^ > $@.new || (rm -f $@.new; exit 1)
2010-08-20 12:51:31 +00:00
mv $@.new $@
.PRECIOUS: $(top_srcdir)/grub-core/Makefile.core.am
$(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
Re-enable grub-extras. * autogen.sh: Create symlinks to ${GRUB_CONTRIB} if necessary to avoid confusing Automake. Run autogen only twice, once for the top level and once for grub-core. Add Makefile.util.def and Makefile.core.def from extra modules to the appropriate autogen invocations. If Makefile.common exists in an extra module, include it in both Makefile.util.am and grub-core/Makefile.core.am; similarly, include any Makefile.util.common file in Makefile.util.am and any Makefile.core.common file in grub-core/Makefile.core.am. * conf/Makefile.common ($(top_srcdir)/grub-core/Makefile.core.am): Depend on $(top_srcdir)/grub-core/Makefile.gcry.def. ($(top_srcdir)/grub-core/Makefile.gcry.def): Remove. * grub-core/Makefile.am: Remove inclusion of Makefile.gcry.am. * gentpl.py (gvar_add): Turn GVARS into a set. (global_variable_initializers): Sort global variables on output. (vars_init): New function. (first_time): Likewise. (library): Ensure that non-global variable initialisations are emitted before the first time we emit code for a library block. Append to variables rather than setting them. Only emit noinst_LIBRARIES, BUILT_SOURCES, and CLEANFILES the first time for each conditional path. (program): installdir() emits an Autogen macro, so must be passed to var_add rather than gvar_add. (data): Likewise. (script): Likewise. (rules): New function, centralising handling for different target types. Set up Guile association lists for first_time and vars_init, and send most output to a diversion so that variable initialisations can be emitted first. (module_rules): Use new rules function. (kernel_rules): Likewise. (image_rules): Likewise. (library_rules): Likewise. (program_rules): Likewise. (script_rules): Likewise. (data_rules): Likewise. * configure.ac: Add AC_PROG_LN_S, for the benefit of ntldr-img. * .bzrignore: Add contrib and grub-core/contrib. Remove grub-core/Makefile.gcry.am.
2010-09-24 08:48:27 +00:00
if [ "x$$GRUB_CONTRIB" != x ]; then echo "You need to run ./autogen.sh manually." >&2; exit 1; fi
python: Use AM_PATH_PYTHON to determine interpreter for gentpl.py gentpl.py is python2/3-agnostic, but there's no way to cause it to be run with any interpreter other than 'python', it's just hard-coded into Makefile.common that way. Adjust that to use AM_PATH_PYTHON (provided by automake) to find an interpreter and run gentpl.py with that instead. This makes grub buildable when `python` does not exist (but rather `python3` or `python2` or `python2.7`, etc.) Minimum version is set to 2.6 as this is the first version with `__future__.print_function` available. Note, AM_PATH_PYTHON respects the PYTHON environment variable and will treat its value as the *only* candidate for a valid interpreter if it is set - when PYTHON is set, AM_PATH_PYTHON will not try to find any alternative interpreter, it will only check whether the interpreter set as the value of PYTHON meets the requirements and use it if so or fail if not. This means that when using grub's `autogen.sh`, as it too uses the value of the PYTHON environment variable (and if it is not set, just sets it to 'python') you cannot rely on AM_PATH_PYTHON interpreter discovery. If your desired Python interpreter is not just 'python', you must set the PYTHON environment variable, e.g. 'PYTHON=/usr/local/bin/python3 ./autogen.sh'. The specified interpreter will then be used both by autogen.sh itself and by the autotools-driven build scripts. Signed-off-by: Adam Williamson <awilliam@redhat.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2018-07-04 16:55:52 +00:00
$(PYTHON) $^ > $@.new || (rm -f $@.new; exit 1)
2010-08-20 12:51:31 +00:00
mv $@.new $@