automake commit without merge history

This commit is contained in:
BVK Chaitanya 2010-05-06 11:34:04 +05:30
parent 265d68cd10
commit 8c41176882
810 changed files with 4980 additions and 2508 deletions

View file

@ -71,3 +71,9 @@ stamp-h.in
symlist.c
trigtables.c
update-grub_lib
Makefile.in
modules.am
GPATH
GRTAGS
GSYMS
GTAGS

223
ABOUT-NLS Normal file
View file

@ -0,0 +1,223 @@
1 Notes on the Free Translation Project
***************************************
Free software is going international! The Free Translation Project is
a way to get maintainers of free software, translators, and users all
together, so that free software will gradually become able to speak many
languages. A few packages already provide translations for their
messages.
If you found this `ABOUT-NLS' file inside a distribution, you may
assume that the distributed package does use GNU `gettext' internally,
itself available at your nearest GNU archive site. But you do _not_
need to install GNU `gettext' prior to configuring, installing or using
this package with messages translated.
Installers will find here some useful hints. These notes also
explain how users should proceed for getting the programs to use the
available translations. They tell how people wanting to contribute and
work on translations can contact the appropriate team.
When reporting bugs in the `intl/' directory or bugs which may be
related to internationalization, you should tell about the version of
`gettext' which is used. The information can be found in the
`intl/VERSION' file, in internationalized packages.
1.1 Quick configuration advice
==============================
If you want to exploit the full power of internationalization, you
should configure it using
./configure --with-included-gettext
to force usage of internationalizing routines provided within this
package, despite the existence of internationalizing capabilities in the
operating system where this package is being installed. So far, only
the `gettext' implementation in the GNU C library version 2 provides as
many features (such as locale alias, message inheritance, automatic
charset conversion or plural form handling) as the implementation here.
It is also not possible to offer this additional functionality on top
of a `catgets' implementation. Future versions of GNU `gettext' will
very likely convey even more functionality. So it might be a good idea
to change to GNU `gettext' as soon as possible.
So you need _not_ provide this option if you are using GNU libc 2 or
you have installed a recent copy of the GNU gettext package with the
included `libintl'.
1.2 INSTALL Matters
===================
Some packages are "localizable" when properly installed; the programs
they contain can be made to speak your own native language. Most such
packages use GNU `gettext'. Other packages have their own ways to
internationalization, predating GNU `gettext'.
By default, this package will be installed to allow translation of
messages. It will automatically detect whether the system already
provides the GNU `gettext' functions. If not, the included GNU
`gettext' library will be used. This library is wholly contained
within this package, usually in the `intl/' subdirectory, so prior
installation of the GNU `gettext' package is _not_ required.
Installers may use special options at configuration time for changing
the default behaviour. The commands:
./configure --with-included-gettext
./configure --disable-nls
will, respectively, bypass any pre-existing `gettext' to use the
internationalizing routines provided within this package, or else,
_totally_ disable translation of messages.
When you already have GNU `gettext' installed on your system and run
configure without an option for your new package, `configure' will
probably detect the previously built and installed `libintl.a' file and
will decide to use this. This might not be desirable. You should use
the more recent version of the GNU `gettext' library. I.e. if the file
`intl/VERSION' shows that the library which comes with this package is
more recent, you should use
./configure --with-included-gettext
to prevent auto-detection.
The configuration process will not test for the `catgets' function
and therefore it will not be used. The reason is that even an
emulation of `gettext' on top of `catgets' could not provide all the
extensions of the GNU `gettext' library.
Internationalized packages usually have many `po/LL.po' files, where
LL gives an ISO 639 two-letter code identifying the language. Unless
translations have been forbidden at `configure' time by using the
`--disable-nls' switch, all available translations are installed
together with the package. However, the environment variable `LINGUAS'
may be set, prior to configuration, to limit the installed set.
`LINGUAS' should then contain a space separated list of two-letter
codes, stating which languages are allowed.
1.3 Using This Package
======================
As a user, if your language has been installed for this package, you
only have to set the `LANG' environment variable to the appropriate
`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code,
and `CC' is an ISO 3166 two-letter country code. For example, let's
suppose that you speak German and live in Germany. At the shell
prompt, merely execute `setenv LANG de_DE' (in `csh'),
`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash').
This can be done from your `.login' or `.profile' file, once and for
all.
You might think that the country code specification is redundant.
But in fact, some languages have dialects in different countries. For
example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The
country code serves to distinguish the dialects.
The locale naming convention of `LL_CC', with `LL' denoting the
language and `CC' denoting the country, is the one use on systems based
on GNU libc. On other systems, some variations of this scheme are
used, such as `LL' or `LL_CC.ENCODING'. You can get the list of
locales supported by your system for your language by running the
command `locale -a | grep '^LL''.
Not all programs have translations for all languages. By default, an
English message is shown in place of a nonexistent translation. If you
understand other languages, you can set up a priority list of languages.
This is done through a different environment variable, called
`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG'
for the purpose of message handling, but you still need to have `LANG'
set to the primary language; this is required by other parts of the
system libraries. For example, some Swedish users who would rather
read translations in German than English for when Swedish is not
available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'.
Special advice for Norwegian users: The language code for Norwegian
bokma*l changed from `no' to `nb' recently (in 2003). During the
transition period, while some message catalogs for this language are
installed under `nb' and some older ones under `no', it's recommended
for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and
older translations are used.
In the `LANGUAGE' environment variable, but not in the `LANG'
environment variable, `LL_CC' combinations can be abbreviated as `LL'
to denote the language's main dialect. For example, `de' is equivalent
to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT'
(Portuguese as spoken in Portugal) in this context.
1.4 Translating Teams
=====================
For the Free Translation Project to be a success, we need interested
people who like their own language and write it well, and who are also
able to synergize with other translators speaking the same language.
Each translation team has its own mailing list. The up-to-date list of
teams can be found at the Free Translation Project's homepage,
`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams"
area.
If you'd like to volunteer to _work_ at translating messages, you
should become a member of the translating team for your own language.
The subscribing address is _not_ the same as the list itself, it has
`-request' appended. For example, speakers of Swedish can send a
message to `sv-request@li.org', having this message body:
subscribe
Keep in mind that team members are expected to participate
_actively_ in translations, or at solving translational difficulties,
rather than merely lurking around. If your team does not exist yet and
you want to start one, or if you are unsure about what to do or how to
get started, please write to `translation@iro.umontreal.ca' to reach the
coordinator for all translator teams.
The English team is special. It works at improving and uniformizing
the terminology in use. Proven linguistic skills are praised more than
programming skills, here.
1.5 Available Packages
======================
Languages are not equally supported in all packages. The following
matrix shows the current state of internationalization, as of October
2006. The matrix shows, in regard of each package, for which languages
PO files have been submitted to translation coordination, with a
translation percentage of at least 50%.
# Matrix here is removed!
Some counters in the preceding matrix are higher than the number of
visible blocks let us expect. This is because a few extra PO files are
used for implementing regional variants of languages, or language
dialects.
For a PO file in the matrix above to be effective, the package to
which it applies should also have been internationalized and
distributed as such by its maintainer. There might be an observable
lag between the mere existence a PO file and its wide availability in a
distribution.
If October 2006 seems to be old, you may fetch a more recent copy of
this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date
matrix with full percentage details can be found at
`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'.
1.6 Using `gettext' in new packages
===================================
If you are writing a freely available program and want to
internationalize it you are welcome to use GNU `gettext' in your
package. Of course you have to respect the GNU Library General Public
License which covers the use of the GNU `gettext' library. This means
in particular that even non-free programs can use `libintl' as a shared
library, whereas only free software can use `libintl' as a static
library or use modified versions of `libintl'.
Once the sources are changed appropriately and the setup can handle
the use of `gettext' the only thing missing are the translations. The
Free Translation Project is also available for packages which are not
developed inside the GNU project. Therefore the information given above
applies also for every other Free Software Project. Contact
`translation@iro.umontreal.ca' to make the `.pot' files available to
the translation teams.

87
Makefile.am Normal file
View file

@ -0,0 +1,87 @@
AUTOMAKE_OPTIONS = subdir-objects
DEPDIR = .deps-util
EXTRA_DIST = autogen.sh gentpl.py Makefile.tpl modules.def \
\
geninit.sh \
\
gnulib/progname.h gnulib/fnmatch_loop.c gnulib/alloca.h \
gnulib/error.h gnulib/fnmatch.h gnulib/getopt.h \
gnulib/getopt_int.h gnulib/gettext.h gnulib/progname.h \
\
util/mkisofs/mkisofs.h util/mkisofs/iso9660.h \
util/mkisofs/include/prototyp.h util/mkisofs/defaults.h \
util/mkisofs/match.h util/mkisofs/exclude.h \
util/mkisofs/msdos_partition.h util/mkisofs/include/fctldefs.h \
util/mkisofs/include/mconfig.h util/mkisofs/include/statdefs.h
SUBDIRS = . grub-core po docs
include $(top_srcdir)/grub-core/Makefile.vars
CFLAGS_PROGRAM = $(HOST_CFLAGS) $(CFLAGS_GNULIB)
LDFLAGS_PROGRAM = $(HOST_LDFLAGS) $(LDFLAGS_GNULIB) $(LIBINTL)
CPPFLAGS_PROGRAM = $(HOST_CPPFLAGS) $(CPPFLAGS_GNULIB)
CCASFLAGS_PROGRAM = $(HOST_CCASFLAGS) $(CCASFLAGS_GNULIB)
CFLAGS_LIBRARY = $(CFLAGS_PROGRAM)
CPPFLAGS_LIBRARY = $(CPPFLAGS_PROGRAM)
CCASFLAGS_LIBRARY = $(CCASFLAGS_PROGRAM)
AM_CFLAGS =
AM_LDFLAGS =
AM_CPPFLAGS = $(CPPFLAGS_GRUB) -DGRUB_FILE=\"$(subst $(top_srcdir)/,,$<)\"
AM_CCASFLAGS = -DASM_FILE=1
# XXX Use Automake's LEX & YACC support
grub_script.tab.c grub_script.tab.h: $(top_srcdir)/grub-core/script/parser.y
$(YACC) -d -p grub_script_yy -b grub_script $(top_srcdir)/grub-core/script/parser.y
CLEANFILES += grub_script.tab.c grub_script.tab.h
# For the lexer.
grub_script.yy.c grub_script.yy.h: $(top_srcdir)/grub-core/script/yylex.l
$(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $(top_srcdir)/grub-core/script/yylex.l
CLEANFILES += grub_script.yy.c grub_script.yy.h
# For libutil.a
libutil_a_init.lst: grub_script.tab.h grub_script.yy.h $(libutil_a_SOURCES)
rm -f $@
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutil_a_CPPFLAGS) $(CPPFLAGS) \
-D'GRUB_MOD_INIT(x)=@MARKER@x@' $^ \
| grep '@MARKER@' | sed 's/@MARKER@\(.*\)@/\1/g' | sort -u > $@ || (rm -f $@; exit 1)
CLEANFILES += libutil_a_init.lst
libutil_a_init.c: libutil_a_init.lst $(top_srcdir)/geninit.sh
rm -f $@; sh $(top_srcdir)/geninit.sh `cat $<` > $@ || (rm -f $@; exit 1)
CLEANFILES += libutil_a_init.c
if COND_GRUB_MKFONT
if COND_HAVE_FONT_SOURCE
pkgdata_DATA = unicode.pf2 ascii.pf2 ascii.h
endif
endif
unicode.pf2: $(FONT_SOURCE) grub-mkfont
$(builddir)/grub-mkfont -o $@ $(FONT_SOURCE)
CLEANFILES += unicode.pf2
# Arrows and lines are needed to draw the menu, so always include them
UNICODE_ARROWS=0x2190-0x2193
UNICODE_LINES=0x2501-0x251B
ascii.pf2: $(FONT_SOURCE) grub-mkfont
$(builddir)/grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES)
CLEANFILES += ascii.pf2
ascii.bitmaps: $(FONT_SOURCE) grub-mkfont
$(builddir)/grub-mkfont --ascii-bitmaps -o $@ $(FONT_SOURCE)
CLEANFILES += ascii.bitmaps
ascii.h: ascii.bitmaps grub-bin2h
$(builddir)/grub-bin2h ascii_bitmaps < $< > $@
cp $@ $(top_builddir)/grub-core/include
CLEANFILES += ascii.h $(top_builddir)/grub-core/include/ascii.h
platform_HEADERS = config.h
include $(srcdir)/modules.am

View file

@ -1,564 +0,0 @@
# -*- makefile -*-
#
# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
#
# This Makefile.in is free software; the author
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
### The configure script will replace these variables.
SHELL = /bin/sh
@SET_MAKE@
transform = @program_transform_name@
srcdir = @srcdir@
builddir = @builddir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datarootdir = @datarootdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
localedir = @localedir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
pkgdatadir = $(datadir)/`echo @PACKAGE_TARNAME@ | sed '$(transform)'`
pkglibdir = $(libdir)/`echo @PACKAGE_TARNAME@/$(target_cpu)-$(platform) | sed '$(transform)'`
# Internationalization library.
LIBINTL = @LIBINTL@
TARGET_NO_MODULES = @TARGET_NO_MODULES@
# Util library.
LIBUTIL = @LIBUTIL@
XGETTEXT = @XGETTEXT@
MSGMERGE = @MSGMERGE@
MSGFMT = @MSGFMT@
LINGUAS = $(shell for i in $(srcdir)/po/*.po ; do \
if test -e $$i ; then echo $$i ; fi ; \
done | sed -e "s,.*/po/\(.*\)\.po$$,\1,")
PACKAGE = @PACKAGE@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
host_os = @host_os@
host_kernel = @host_kernel@
host_cpu = @host_cpu@
target_cpu = @target_cpu@
platform = @platform@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
MKDIR_P = @MKDIR_P@
mkinstalldirs = $(srcdir)/mkinstalldirs
LIBS = @LIBS@ $(LIBINTL) $(LIBUTIL)
CC = @CC@
CFLAGS = @CFLAGS@
POSIX_CFLAGS = -I$(srcdir)/lib/posix_wrap
GNULIB_UTIL_CFLAGS = -Wno-undef -Wno-sign-compare -Wno-unused -D_GL_UNUSED="__attribute__ ((unused))" -I$(srcdir)/gnulib
GNULIB_CFLAGS = $(GNULIB_UTIL_CFLAGS) $(POSIX_CFLAGS)
ASFLAGS = @ASFLAGS@
LDFLAGS = @LDFLAGS@ $(LIBS)
CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/gnulib -I$(srcdir)/include -Wall -W \
-DGRUB_LIBDIR=\"$(pkglibdir)\" -DLOCALEDIR=\"$(localedir)\"
TARGET_CC = @TARGET_CC@
TARGET_CFLAGS = -ffreestanding @TARGET_CFLAGS@
TARGET_ASFLAGS = -nostdinc -fno-builtin @TARGET_ASFLAGS@
TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@
TARGET_APPLE_CC = @TARGET_APPLE_CC@
OBJCONV = @OBJCONV@
TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \
-Wall -W
TARGET_LDFLAGS = -nostdlib -static-libgcc @TARGET_LDFLAGS@
TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@
TARGET_IMG_LDFLAGS = -nostdlib @TARGET_IMG_LDFLAGS@
TARGET_IMG_CFLAGS = @TARGET_IMG_CFLAGS@
TARGET_OBJ2ELF = @TARGET_OBJ2ELF@
kernel_img_LDFLAGS = -lgcc
EXEEXT = @EXEEXT@
OBJCOPY = @OBJCOPY@
STRIP = @STRIP@
NM = @NM@
RUBY = @RUBY@
MAKEINFO = @MAKEINFO@
ifeq (, $(MAKEINFO))
MAKEINFO = true
endif
HELP2MAN = @HELP2MAN@
ifeq (, $(HELP2MAN))
HELP2MAN = true
else
HELP2MAN := LANG=C $(HELP2MAN) --no-info --source=FSF
endif
AWK = @AWK@
LIBCURSES = @LIBCURSES@
LIBUSB = @LIBUSB@
LIBSDL = @LIBSDL@
LIBPCIACCESS = @LIBPCIACCESS@
LEX = @LEX@
YACC = @YACC@
FONT_SOURCE = @FONT_SOURCE@
# Options.
enable_grub_emu_usb = @enable_grub_emu_usb@
enable_grub_emu_sdl = @enable_grub_emu_sdl@
enable_grub_emu_pci = @enable_grub_emu_pci@
enable_grub_fstest = @enable_grub_fstest@
enable_grub_pe2elf = @enable_grub_pe2elf@
enable_grub_mkfont = @enable_grub_mkfont@
freetype_cflags = @freetype_cflags@
freetype_libs = @freetype_libs@
enable_efiemu = @enable_efiemu@
### General variables.
RMKFILES = $(wildcard $(srcdir)/conf/*.rmk)
MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES))
PKGLIB = $(pkglib_IMAGES) $(pkglib_MODULES) $(pkglib_PROGRAMS) \
$(pkglib_DATA) $(pkglib_BUILDDIR)
PKGDATA = $(pkgdata_DATA)
PROGRAMS = $(bin_UTILITIES) $(sbin_UTILITIES)
SCRIPTS = $(bin_SCRIPTS) $(sbin_SCRIPTS) $(grub-mkconfig_SCRIPTS) \
$(lib_SCRIPTS)
INFOS = $(info_INFOS)
CLEANFILES =
MOSTLYCLEANFILES =
DISTCLEANFILES = config.status config.cache config.log config.h \
Makefile stamp-h stamp-h1 include/grub/cpu include/grub/machine \
gensymlist.sh genkernsyms.sh build_env.mk \
docs/grub.info docs/version.texi docs/stamp-vti
MAINTAINER_CLEANFILES = $(srcdir)/configure $(srcdir)/aclocal.m4 \
$(MKFILES) $(srcdir)/config.guess \
$(srcdir)/config.sub $(srcdir)/install-sh $(srcdir)/missing \
$(srcdir)/DISTLIST $(srcdir)/config.h.in $(srcdir)/stamp-h.in $(INFOS)
# The default target.
all: all-local
### Include an arch-specific Makefile.
$(addprefix $(srcdir)/,$(MKFILES)): %.mk: %.rmk genmk.rb
if test "x$(RUBY)" = x; then \
touch $@; \
else \
$(RUBY) $(srcdir)/genmk.rb < $< > $@; \
fi
ifeq ($(platform), emu)
include $(srcdir)/conf/any-emu.mk
else
include $(srcdir)/conf/$(target_cpu)-$(platform).mk
# For tests.
include $(srcdir)/conf/tests.mk
# For external modules.
-include $(wildcard $(GRUB_CONTRIB)/*/conf/common.mk)
endif
ifeq ($(TARGET_NO_MODULES), yes)
TARGET_CFLAGS += -DGRUB_TARGET_NO_MODULES=1
CFLAGS += -DGRUB_TARGET_NO_MODULES=1
endif
### General targets.
CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA) po/*.mo
ifneq ($(TARGET_NO_MODULES), yes)
pkglib_DATA += moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst
endif
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep.awk
cat $(DEFSYMFILES) /dev/null \
| $(AWK) -f $(srcdir)/genmoddep.awk $(UNDSYMFILES) > $@ \
|| (rm -f $@; exit 1)
command.lst: $(COMMANDFILES)
cat $^ /dev/null | sort > $@
fs.lst: $(FSFILES)
cat $^ /dev/null | sort > $@
partmap.lst: $(PARTMAPFILES)
cat $^ /dev/null | sort > $@
handler.lst: $(HANDLERFILES)
cat $^ /dev/null | sort > $@
terminal.lst: $(TERMINALFILES)
cat $^ /dev/null | sort > $@
parttool.lst: $(PARTTOOLFILES)
cat $^ /dev/null | sort | uniq > $@
video.lst: $(VIDEOFILES)
cat $^ /dev/null | sort | uniq > $@
crypto.lst: lib/libgcrypt-grub/cipher/crypto.lst
cp $^ $@
ifneq (true, $(MAKEINFO))
info_INFOS += docs/grub.info
endif
MOSTLYCLEANFILES += vti.tmp
MAINTAINER_CLEANFILES += docs/stamp-vti docs/version.texi
docs/version.texi: docs/stamp-vti
docs/stamp-vti: docs/grub.texi configure.ac
$(MKDIR_P) docs
(set `$(SHELL) $(srcdir)/docs/mdate-sh $<`; \
echo "@set UPDATED $$1 $$2 $$3"; \
echo "@set UPDATED-MONTH $$2 $$3"; \
echo "@set EDITION $(PACKAGE_VERSION)"; \
echo "@set VERSION $(PACKAGE_VERSION)") > vti.tmp
@cmp -s vti.tmp $(builddir)/docs/version.texi \
|| (echo "Updating $(builddir)/docs/version.texi"; \
cp vti.tmp $(builddir)/docs/version.texi)
-@rm -f vti.tmp
@cp $(builddir)/docs/version.texi $@
# Use --force until such time as the documentation is cleaned up.
docs/grub.info: docs/grub.texi docs/version.texi docs/fdl.texi
$(MKDIR_P) docs
-$(MAKEINFO) -P $(builddir)/docs --no-split --force $< -o $@
ifeq (, $(FONT_SOURCE))
else
ifeq ($(enable_grub_mkfont),yes)
pkgdata_DATA += unicode.pf2 ascii.pf2 ascii.h
CLEANFILES += ascii.bitmaps
# Arrows and lines are needed to draw the menu, so we always include them
UNICODE_ARROWS=0x2190-0x2193
UNICODE_LINES=0x2501-0x251B
unicode.pf2: $(FONT_SOURCE) grub-mkfont
$(builddir)/grub-mkfont -o $@ $(FONT_SOURCE)
ascii.pf2: $(FONT_SOURCE) grub-mkfont
$(builddir)/grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES)
ascii.bitmaps: $(FONT_SOURCE) grub-mkfont
$(builddir)/grub-mkfont --ascii-bitmaps -o $@ $(FONT_SOURCE)
ascii.h: ascii.bitmaps grub-bin2h
$(builddir)/grub-bin2h ascii_bitmaps < $< > $@
TARGET_CFLAGS += -DUSE_ASCII_FAILBACK=1
endif
endif
# Used for building modules externally
pkglib_BUILDDIR += build_env.mk
build_env.mk: Makefile
(\
echo "TARGET_CC=$(TARGET_CC)" ; \
echo "TARGET_CFLAGS=$(TARGET_CFLAGS)" ; \
echo "TARGET_ASFLAGS=$(TARGET_ASFLAGS)" ; \
echo "TARGET_CPPFLAGS=$(TARGET_CPPFLAGS) -I$(pkglibdir) -I$(includedir)" ; \
echo "STRIP=$(STRIP)" ; \
echo "OBJCONV=$(OBJCONV)" ; \
echo "TARGET_MODULE_FORMAT=$(TARGET_MODULE_FORMAT)" ; \
echo "TARGET_APPLE_CC=$(TARGET_APPLE_CC)" ; \
echo "COMMON_ASFLAGS=$(COMMON_ASFLAGS)" ; \
echo "COMMON_CFLAGS=$(COMMON_CFLAGS)" ; \
echo "COMMON_LDFLAGS=$(COMMON_LDFLAGS)"\
) > $@
pkglib_BUILDDIR += config.h grub_script.tab.h
all-local: $(PROGRAMS) $(GRUB_EMU) $(PKGLIB) $(PKGDATA) $(SCRIPTS) $(INFOS) $(MKFILES) $(foreach lang, $(LINGUAS), po/$(lang).mo)
install: install-local
install-local: all
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(pkglibdir)
rm -f $(DESTDIR)$(pkglibdir)/*
@list='$(PKGLIB)'; \
for file in $$list; do \
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
dest="`echo $$file | sed 's,.*/,,'`"; \
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(pkglibdir)/$$dest; \
done
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
@list='$(PKGDATA)'; \
for file in $$list; do \
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
dest="`echo $$file | sed 's,.*/,,'`"; \
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(pkgdatadir)/$$dest; \
done
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
@list='$(bin_UTILITIES) $(GRUB_EMU)'; for file in $$list; do \
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
$(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
$(HELP2MAN) --section=1 -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \
done
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8
@list='$(sbin_UTILITIES)'; for file in $$list; do \
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
$(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \
$(HELP2MAN) --section=8 -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \
done
@list='$(bin_SCRIPTS)'; for file in $$list; do \
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
$(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
$(HELP2MAN) --section=1 -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \
done
@list='$(sbin_SCRIPTS)'; for file in $$list; do \
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
$(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \
$(HELP2MAN) --section=8 -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \
done
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/grub.d
@list='$(grub-mkconfig_SCRIPTS)'; for file in $$list; do \
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
$(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sysconfdir)/grub.d/$$dest; \
done
@list='$(grub-mkconfig_DATA)'; for file in $$list; do \
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(sysconfdir)/grub.d/$$dest; \
done
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(libdir)/grub
@list='$(lib_SCRIPTS)'; \
for file in $$list; do \
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
dest="`echo $$file | sed 's,.*/,,'`"; \
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(libdir)/grub/$$dest; \
done
@langs='$(LINGUAS)'; \
for lang in $$langs; do \
$(SHELL) $(mkinstalldirs) $(DESTDIR)/$(datadir)/locale/$$lang/LC_MESSAGES; \
file="po/$$lang.mo"; \
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
$(INSTALL_DATA) $$dir$$file $(DESTDIR)/$(datadir)/locale/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
done
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(infodir)
@list='$(info_INFOS)'; \
for file in $$list; do \
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
dest="`echo $$file | sed 's,.*/,,'`"; \
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(infodir); \
if (install-info --version && \
install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$dest" || :; \
fi; \
done
install-strip:
$(MAKE) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" install
uninstall:
@list='$(PKGLIB)'; \
for file in $$list; do \
dest="`echo $$file | sed 's,.*/,,'`"; \
rm -f $(DESTDIR)$(pkglibdir)/$$dest; \
done
@list='$(PKGDATA)'; \
for file in $$list; do \
dest="`echo $$file | sed 's,.*/,,'`"; \
rm -f $(DESTDIR)$(pkgdatadir)/$$dest; \
done
@list='$(bin_UTILITIES) $(bin_SCRIPTS) $(GRUB_EMU)'; for file in $$list; do \
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
rm -f $(DESTDIR)$(bindir)/$$dest; \
rm -f $(DESTDIR)$(mandir)/man1/$$dest.1; \
done
@list='$(sbin_UTILITIES) $(sbin_SCRIPTS)'; for file in $$list; do \
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
rm -f $(DESTDIR)$(sbindir)/$$dest; \
rm -f $(DESTDIR)$(mandir)/man8/$$dest.8; \
done
@list='$(grub-mkconfig_SCRIPTS) $(grub-mkconfig_DATA)'; for file in $$list; do \
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
rm -f $(DESTDIR)$(sysconfdir)/grub.d/$$dest; \
done
@list='$(lib_SCRIPTS)'; \
for file in $$list; do \
dest="`echo $$file | sed 's,.*/,,'`"; \
rm -f $(DESTDIR)$(libdir)/grub/$$dest; \
done
@list='$(info_INFOS)'; \
for file in $$list; do \
dest="`echo $$file | sed 's,.*/,,'`"; \
if (install-info --version && \
install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$dest"; then \
:; \
else \
test ! -f "$(DESTDIR)$(infodir)/$$dest" || exit 1; \
fi; \
fi; \
rm -f $(DESTDIR)$(infodir)/$$dest; \
done
clean: $(CLEAN_IMAGE_TARGETS) $(CLEAN_MODULE_TARGETS) $(CLEAN_UTILITY_TARGETS)
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
mostlyclean: clean $(MOSTLYCLEAN_IMAGE_TARGETS) $(MOSTLYCLEAN_MODULE_TARGETS) $(MOSTLYCLEAN_UTILITY_TARGETS)
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
distclean: mostlyclean
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
-rm -rf $(srcdir)/autom4te.cache
maintainer-clean: distclean
-test -z "$(MAINTAINER_CLEANFILES)" || rm -f $(MAINTAINER_CLEANFILES)
-rmdir $(srcdir)/lib/libgcrypt-grub/cipher
-rmdir $(srcdir)/lib/libgcrypt-grub
info:
dvi:
distdir=$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
DISTLIST: gendistlist.sh
$(SHELL) $(srcdir)/gendistlist.sh > $(srcdir)/DISTLIST
distdir: DISTLIST
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
$(SHELL) $(mkinstalldirs) $(distdir)
for i in `cat $(srcdir)/DISTLIST`; do \
dir=`echo "$$i" | sed 's:/[^/]*$$::'`; \
if test -d $(srcdir)/$$dir; then \
$(SHELL) $(mkinstalldirs) $(distdir)/$$dir; \
fi; \
cp -p $(srcdir)/$$i $(distdir)/$$i || exit 1; \
done
chmod -R a+r $(distdir)
GZIP_ENV = --best
dist: distdir
tar chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
distcheck: dist
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
GZIP=$(GZIP_ENV) gzip -cd $(distdir).tar.gz | tar xf -
chmod -R a-w $(distdir)
chmod a+w $(distdir)
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
chmod a-w $(distdir)
dc_instdir=`CDPATH=: && cd $(distdir)/=inst && pwd` \
&& cd $(distdir)/=build \
&& $(SHELL) ../configure --srcdir=.. --prefix=$$dc_instdir \
&& $(MAKE) all dvi check install && $(MAKE) uninstall \
&& (test `find $$dc_instdir -type f -print | wc -l` -le 1 \
|| (echo "Error: files left after uninstall" 1>&2; \
exit 1)) \
&& $(MAKE) dist && $(MAKE) distclean \
&& rm -f $(distdir).tar.gz \
&& (test `find . -type f -print | wc -l` -eq 0 \
|| (echo "Error: files left after distclean" 1>&2; \
exit 1))
-chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
@echo "$(distdir).tar.gz is ready for distribution" | \
sed 'h;s/./=/g;p;x;p;x'
check: all $(UNIT_TESTS) $(FUNCTIONAL_TESTS) $(SCRIPTED_TESTS)
@list="$(UNIT_TESTS)"; \
set -e; \
for file in $$list; do \
$(builddir)/$$file; \
done
@list="$(FUNCTIONAL_TESTS)"; \
set -e; \
for file in $$list; do \
mod=`basename $$file .mod`; \
echo "insmod functional_test; insmod $$mod; functional_test" \
| $(builddir)/grub-shell; \
done
@list="$(SCRIPTED_TESTS)"; \
set -e; \
for file in $$list; do \
$(builddir)/$$file; \
done
.SUFFIX:
.SUFFIX: .c .o .S .d
# Regenerate configure and Makefile automatically.
$(srcdir)/aclocal.m4: configure.ac acinclude.m4
cd $(srcdir) && aclocal
$(srcdir)/configure: configure.ac aclocal.m4
cd $(srcdir) && autoconf
$(srcdir)/config.h.in: stamp-h.in
$(srcdir)/stamp-h.in: configure.ac aclocal.m4
cd $(srcdir) && autoheader
echo timestamp > $(srcdir)/stamp-h.in
config.h: stamp-h
stamp-h: config.h.in config.status
$(SHELL) ./config.status
Makefile: Makefile.in config.status
$(SHELL) ./config.status
config.status: configure
$(SHELL) ./config.status --recheck
gensymlist.sh: gensymlist.sh.in config.status
$(SHELL) ./config.status
genkernsyms.sh: genkernsyms.sh.in config.status
$(SHELL) ./config.status
$(srcdir)/po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell
cd $(srcdir) && $(XGETTEXT) -ctranslate --from-code=utf-8 -o po/$(PACKAGE).pot -f po/POTFILES --keyword=_ --keyword=N_
cd $(srcdir) && $(XGETTEXT) -ctranslate --from-code=utf-8 -o po/$(PACKAGE).pot -f po/POTFILES-shell -j --language=Shell
$(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): po/$(PACKAGE).pot
$(MSGMERGE) -U $@ $^
po/%.mo: po/%.po
$(MKDIR_P) $$(dirname $@)
$(MSGFMT) -c --statistics -o $@ $^
.PHONY: all install install-strip uninstall clean mostlyclean distclean
.PHONY: maintainer-clean info dvi dist check
# Prevent an overflow.
.NOEXPORT:
.DELETE_ON_ERROR:

View file

@ -2,22 +2,33 @@
set -e
aclocal
autoconf
autoheader
ln -sf ../NEWS grub-core/
ln -sf ../README grub-core/
ln -sf ../INSTALL grub-core/
ln -sf ../AUTHORS grub-core/
ln -sf ../COPYING grub-core/
ln -sf ../ABOUT-NLS grub-core/
ln -sf ../ChangeLog grub-core/
ln -sf ../aclocal.m4 grub-core/
ln -sf ../acinclude.m4 grub-core/
ln -sf ../config.rpath grub-core/
ln -sf ../gentpl.py grub-core/
ln -sf ../configure.common grub-core/
# FIXME: automake doesn't like that there's no Makefile.am
automake -a -c -f || true
ln -sf grub-core/include .
ln -sf grub-core/gnulib .
ln -sf grub-core/lib .
python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl
autogen -T Makefile.tpl modules.def | sed -e '/^$/{N;/^\n$/D;}' > modules.am
(cd grub-core && python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl)
(cd grub-core && autogen -T Makefile.tpl modules.def | sed -e '/^$/{N;/^\n$/D;}' > modules.am)
(cd grub-core && echo timestamp > stamp-h.in)
(cd grub-core && python import_gcry.py lib/libgcrypt/ .)
echo timestamp > stamp-h.in
python util/import_gcry.py lib/libgcrypt/ .
for rmk in conf/*.rmk ${GRUB_CONTRIB}/*/conf/*.rmk; do
if test -e $rmk ; then
ruby genmk.rb < $rmk > `echo $rmk | sed 's/\.rmk$/.mk/'`
fi
done
sh gendistlist.sh > DISTLIST
autoreconf -vi
exit 0

View file

@ -1,6 +1,6 @@
# Process this file with autoconf to produce a configure script.
# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
# Copyright (C) 2010 Free Software Foundation, Inc.
#
# This configure.ac is free software; the author
# gives unlimited permission to copy and/or distribute it,
@ -23,782 +23,50 @@ dnl which specifies the system running GRUB, such as firmware.
dnl This is necessary because the target type in autoconf does not
dnl describe such a system very well.
dnl
dnl The current strategy is to use variables with no prefix (such as
dnl CC, CFLAGS, etc.) for the host type as well as the build type,
dnl because GRUB does not need to use those variables for the build
dnl type, so there is no conflict. Variables with the prefix "TARGET_"
dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
dnl type.
dnl The current strategy is to build utilities using host
dnl cross-compiler and grub core and modules using target
dnl cross-compiler. For this we use nested packages approach, where
dnl top-level package grub utilities is built with HOSTCC and nested
dnl package (in grub-core directory) builds with TARGETCC.
# NOTE: grub-core/configure.ac must also be updated.
AC_INIT([GRUB],[1.98],[bug-grub@gnu.org])
AM_INIT_AUTOMAKE()
AC_PREREQ(2.60)
AC_CONFIG_SRCDIR([include/grub/dl.h])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_AUX_DIR([.])
# Checks for host and target systems.
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
# Program name transformations
AC_ARG_PROGRAM
AM_INIT_AUTOMAKE()
AC_PREREQ(2.60)
AC_CONFIG_SRCDIR([grub-core/include/grub/dl.h])
AC_CONFIG_HEADER([config.h])
# Optimization flag. Allow user to override.
if test "x$TARGET_CFLAGS" = x; then
TARGET_CFLAGS="$TARGET_CFLAGS -Os"
fi
case "$target_cpu" in
i[[3456]]86) target_cpu=i386 ;;
amd64) target_cpu=x86_64 ;;
sparc) target_cpu=sparc64 ;;
mipsel|mips64el)
target_cpu=mips;
TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPSEL=1";
CFLAGS="$CFLAGS -DGRUB_CPU_MIPSEL=1";
;;
mips|mips64)
target_cpu=mips;
TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPS=1";
CFLAGS="$CFLAGS -DGRUB_CPU_MIPS=1";
;;
esac
# Specify the platform (such as firmware).
AC_ARG_WITH([platform],
AS_HELP_STRING([--with-platform=PLATFORM],
[select the host platform [[guessed]]]))
# Guess the platform if not specified.
if test "x$with_platform" = x; then
case "$target_cpu"-"$target_vendor" in
i386-apple) platform=efi ;;
i386-*) platform=pc ;;
x86_64-apple) platform=efi ;;
x86_64-*) platform=pc ;;
powerpc-*) platform=ieee1275 ;;
powerpc64-*) platform=ieee1275 ;;
sparc64-*) platform=ieee1275 ;;
mips-*) platform=yeeloong ;;
*) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
esac
else
platform="$with_platform"
fi
# Adjust CPU unless target was explicitly specified.
if test -z "$target_alias"; then
case "$target_cpu"-"$platform" in
x86_64-efi) ;;
x86_64-emu) ;;
x86_64-*) target_cpu=i386 ;;
powerpc64-ieee1275) target_cpu=powerpc ;;
esac
fi
# Check if the platform is supported, make final adjustments.
case "$target_cpu"-"$platform" in
i386-efi) ;;
x86_64-efi) ;;
i386-pc) ;;
i386-multiboot) ;;
i386-coreboot) ;;
i386-linuxbios) platform=coreboot ;;
i386-ieee1275) ;;
i386-qemu) ;;
powerpc-ieee1275) ;;
sparc64-ieee1275) ;;
mips-qemu-mips) ;;
mips-yeeloong) ;;
*-emu) ;;
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
esac
case "$target_cpu" in
i386 | powerpc) target_m32=1 ;;
x86_64 | sparc64) target_m64=1 ;;
esac
case "$host_os" in
mingw32*) host_os=cygwin ;;
esac
# This normalizes the names, and creates a new variable ("host_kernel")
# while at it, since the mapping is not always 1:1 (e.g. different OSes
# using the same kernel type).
case "$host_os" in
gnu*) host_kernel=hurd ;;
linux*) host_kernel=linux ;;
freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
netbsd*) host_kernel=netbsd ;;
cygwin) host_kernel=windows ;;
esac
case "$platform" in
coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;;
multiboot) machine_CFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;;
efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;;
ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;;
qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;;
emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
yeeloong) machine_CFLAGS="-DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
qemu-mips) machine_CFLAGS="-DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
esac
case "$target_cpu" in
mips) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_MIPS=1" ;;
sparc64) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
esac
CFLAGS="$CFLAGS $machine_CFLAGS"
TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS"
AC_SUBST(host_cpu)
AC_SUBST(host_os)
AC_SUBST(host_kernel)
AC_SUBST(target_cpu)
AC_SUBST(platform)
#
# Checks for build programs.
#
# Although cmp is listed in the GNU Coding Standards as a command which
# can used directly, OpenBSD lacks cmp in the default installation.
AC_CHECK_PROGS([CMP], [cmp])
if test "x$CMP" = x; then
AC_MSG_ERROR([cmp is not found])
fi
AC_CHECK_PROGS([YACC], [bison])
if test "x$YACC" = x; then
AC_MSG_ERROR([bison is not found])
fi
for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz /usr/share/fonts/unifont/unifont.pcf.gz; do
if test -e $file ; then
AC_SUBST([FONT_SOURCE], [$file])
break
fi
done
AC_PROG_INSTALL
AC_PROG_AWK
AC_PROG_LEX
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P
if test "x$LEX" = x; then
AC_MSG_ERROR([flex is not found])
else
version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
if test -n "$version" -a "$version" -ge 20535; then
:
else
AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
fi
fi
# These are not a "must".
AC_PATH_PROG(RUBY, ruby)
AC_PATH_PROG(MAKEINFO, makeinfo)
#
# Checks for host programs.
#
AC_PROG_CC
# Must be GCC.
test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
AC_GNU_SOURCE
AM_GNU_GETTEXT([external])
AC_SYS_LARGEFILE
# Identify characteristics of the host architecture.
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(long)
grub_apple_cc
if test x$grub_cv_apple_cc = xyes ; then
CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
ASFLAGS="$ASFLAGS -DAPPLE_CC=1"
fi
if test "x$cross_compiling" = xyes; then
AC_MSG_WARN([cannot generate manual pages while cross compiling])
else
AC_PATH_PROG(HELP2MAN, help2man)
fi
# Check for functions.
AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf)
# For grub-mkisofs
AC_HEADER_MAJOR
AC_HEADER_DIRENT
AC_CHECK_FUNCS(memmove sbrk strdup lstat getuid getgid)
AC_CHECK_HEADERS(sys/mkdev.h sys/sysmacros.h malloc.h termios.h sys/types.h)
AC_CHECK_HEADERS(unistd.h string.h strings.h sys/stat.h sys/fcntl.h limits.h)
# For opendisk() and getrawpartition() on NetBSD.
# Used in util/deviceiter.c and in util/hostdisk.c.
AC_CHECK_HEADER([util.h], [
AC_CHECK_LIB([util], [opendisk], [
LIBUTIL="-lutil"
AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
])
AC_CHECK_LIB([util], [getrawpartition], [
LIBUTIL="-lutil"
AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
])
])
AC_SUBST([LIBUTIL])
#
# Check for target programs.
#
# Find tools for the target.
if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
tmp_ac_tool_prefix="$ac_tool_prefix"
ac_tool_prefix=$target_alias-
AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
[AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
AC_CHECK_TOOL(OBJCOPY, objcopy)
AC_CHECK_TOOL(STRIP, strip)
AC_CHECK_TOOL(NM, nm)
ac_tool_prefix="$tmp_ac_tool_prefix"
else
if test "x$TARGET_CC" = x; then
TARGET_CC=$CC
fi
AC_CHECK_TOOL(OBJCOPY, objcopy)
AC_CHECK_TOOL(STRIP, strip)
AC_CHECK_TOOL(NM, nm)
fi
AC_SUBST(TARGET_CC)
# Test the C compiler for the target environment.
tmp_CC="$CC"
tmp_CFLAGS="$CFLAGS"
tmp_LDFLAGS="$LDFLAGS"
tmp_CPPFLAGS="$CPPFLAGS"
tmp_LIBS="$LIBS"
CC="$TARGET_CC"
CFLAGS="$TARGET_CFLAGS"
CPPFLAGS="$TARGET_CPPFLAGS"
LDFLAGS="$TARGET_LDFLAGS"
LIBS=""
# debug flags.
TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
-Wundef -Wstrict-prototypes -g"
# Force no alignment to save space on i386.
if test "x$target_cpu" = xi386; then
AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
CFLAGS="$CFLAGS -falign-loops=1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_cc_falign_loop=yes],
[grub_cv_cc_falign_loop=no])
])
if test "x$grub_cv_cc_falign_loop" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
else
TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
fi
# Some toolchains enable these features by default, but they need
# registers that aren't set up properly in GRUB.
TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
fi
# By default, GCC 4.4 generates .eh_frame sections containing unwind
# information in some cases where it previously did not. GRUB doesn't need
# these and they just use up vital space. Restore the old compiler
# behaviour.
AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_cc_fno_dwarf2_cfi_asm=yes],
[grub_cv_cc_fno_dwarf2_cfi_asm=no])
CFLAGS="$SAVE_CFLAGS"
])
if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
fi
grub_apple_target_cc
if test x$grub_cv_apple_target_cc = xyes ; then
TARGET_CFLAGS="$TARGET_CFLAGS -DAPPLE_CC=1 -fnested-functions"
CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1"
TARGET_APPLE_CC=1
AC_CHECK_PROG([OBJCONV], [objconv], [objconv], [])
if test "x$OBJCONV" = x ; then
AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.])
fi
if test "x$OBJCONV" = x ; then
AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
fi
TARGET_IMG_LDSCRIPT=
TARGET_IMG_CFLAGS="-static"
TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
else
TARGET_APPLE_CC=0
# Use linker script if present, otherwise use builtin -N script.
if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext,"
TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc -Wl,-Ttext,"
else
TARGET_IMG_LDSCRIPT=
TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,'
TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,'
fi
TARGET_IMG_CFLAGS=
fi
AC_SUBST(TARGET_IMG_LDSCRIPT)
AC_SUBST(TARGET_IMG_LDFLAGS)
AC_SUBST(TARGET_IMG_CFLAGS)
# For platforms where ELF is not the default link format.
AC_MSG_CHECKING([for command to convert module to ELF format])
case "${host_os}" in
cygwin) TARGET_OBJ2ELF='grub-pe2elf';
# FIXME: put proper test here
AC_DEFINE([NEED_REGISTER_FRAME_INFO], 1,
[Define to 1 if GCC generates calls to __register_frame_info()])
;;
*) ;;
esac
AC_SUBST(TARGET_OBJ2ELF)
AC_MSG_RESULT([$TARGET_OBJ2ELF])
if test "x$target_m32" = x1; then
# Force 32-bit mode.
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
TARGET_ASFLAGS="$TARGET_CFLAGS -m32"
TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
TARGET_MODULE_FORMAT="elf32"
fi
if test "x$target_m64" = x1; then
# Force 64-bit mode.
TARGET_CFLAGS="$TARGET_CFLAGS -m64"
TARGET_ASFLAGS="$TARGET_ASFLAGS -m64"
TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
TARGET_MODULE_FORMAT="elf64"
fi
if test "$target_cpu"-"$platform" = x86_64-efi; then
# Use large model to support 4G memory
AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
SAVED_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -m64 -mcmodel=large"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_cc_mcmodel=yes],
[grub_cv_cc_mcmodel=no])
])
if test "x$grub_cv_cc_mcmodel" = xno; then
AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
else
TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
fi
# EFI writes to stack below %rsp, we must not use the red zone
AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
CFLAGS="$CFLAGS -m64 -mno-red-zone"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_cc_no_red_zone=yes],
[grub_cv_cc_no_red_zone=no])
])
if test "x$grub_cv_cc_no_red_zone" = xno; then
AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
fi
TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
fi
#
# Compiler features.
#
# Need __enable_execute_stack() for nested function trampolines?
grub_CHECK_ENABLE_EXECUTE_STACK
# Position independent executable.
grub_CHECK_PIE
[# Need that, because some distributions ship compilers that include
# `-fPIE' in the default specs.
if [ x"$pie_possible" = xyes ]; then
TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
fi]
# Smashing stack protector.
grub_CHECK_STACK_PROTECTOR
# Need that, because some distributions ship compilers that include
# `-fstack-protector' in the default specs.
if test "x$ssp_possible" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
fi
grub_CHECK_STACK_ARG_PROBE
# Cygwin's GCC uses alloca() to probe the stackframe on static
# stack allocations above some threshold.
if test x"$sap_possible" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
fi
AC_ARG_ENABLE([werror],
[AS_HELP_STRING([--disable-werror],
[do not use -Werror when building GRUB])])
if test x"$enable_werror" != xno ; then
TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
fi
AC_SUBST(TARGET_CFLAGS)
AC_SUBST(TARGET_MODULE_FORMAT)
AC_SUBST(OBJCONV)
AC_SUBST(TARGET_APPLE_CC)
AC_SUBST(TARGET_ASFLAGS)
AC_SUBST(TARGET_CPPFLAGS)
AC_SUBST(TARGET_LDFLAGS)
# Set them to their new values for the tests below.
CC="$TARGET_CC"
if test "x$TARGET_APPLE_CC" = x1 ; then
CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
else
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
fi
CPPFLAGS="$TARGET_CPPFLAGS"
LDFLAGS="$TARGET_LDFLAGS"
LIBS=-lgcc
grub_ASM_USCORE
if test x$grub_cv_asm_uscore = xyes; then
CFLAGS="$CFLAGS -Wl,--defsym,_abort=_main"
else
CFLAGS="$CFLAGS -Wl,--defsym,abort=main"
fi
# Check for libgcc symbols
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x)
if test "x$TARGET_APPLE_CC" = x1 ; then
CFLAGS="$TARGET_CFLAGS -nostdlib"
else
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
fi
LIBS=""
# Defined in aclocal.m4.
grub_PROG_TARGET_CC
if test "x$TARGET_APPLE_CC" != x1 ; then
grub_PROG_OBJCOPY_ABSOLUTE
fi
grub_PROG_LD_BUILD_ID_NONE
if test "x$target_cpu" = xi386; then
if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
# Check symbols provided by linker script.
CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC}8000 -Wl,--defsym,___main=0x8100"
fi
grub_CHECK_BSS_START_SYMBOL
grub_CHECK_END_SYMBOL
fi
CFLAGS="$TARGET_CFLAGS"
grub_I386_ASM_PREFIX_REQUIREMENT
grub_I386_ASM_ADDR32
grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
else
AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug])
fi
AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL)
#define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1)))
#else
#define NESTED_FUNC_ATTR
#endif])
AC_ARG_ENABLE([efiemu],
[AS_HELP_STRING([--enable-efiemu],
[build and install the efiemu runtimes (default=guessed)])])
if test x"$enable_efiemu" = xno ; then
efiemu_excuse="explicitly disabled"
fi
if test x"$efiemu_excuse" = x ; then
AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_cc_efiemu=yes],
[grub_cv_cc_efiemu=no])
])
if test x$grub_cv_cc_efiemu = xno; then
efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
fi
fi
if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
fi
if test x"$efiemu_excuse" = x ; then
enable_efiemu=yes
else
enable_efiemu=no
fi
AC_SUBST([enable_efiemu])
if test "$platform" != emu; then
AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
SAVED_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
int va_arg_func (int fixed, va_list args);]], [[]])],
[grub_cv_cc_isystem=yes],
[grub_cv_cc_isystem=no])
CPPFLAGS="$SAVED_CPPFLAGS"
])
if test x"$grub_cv_cc_isystem" = xyes ; then
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
fi
fi
# Restore the flags.
CC="$tmp_CC"
CFLAGS="$tmp_CFLAGS"
CPPFLAGS="$tmp_CPPFLAGS"
LDFLAGS="$tmp_LDFLAGS"
LIBS="$tmp_LIBS"
#
# Check for options.
#
# Memory manager debugging.
AC_ARG_ENABLE([mm-debug],
AS_HELP_STRING([--enable-mm-debug],
[include memory manager debugging]),
[AC_DEFINE([MM_DEBUG], [1],
[Define to 1 if you enable memory manager debugging.])])
AC_ARG_ENABLE([grub-emu-usb],
[AS_HELP_STRING([--enable-grub-emu-usb],
[build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
AC_ARG_ENABLE([grub-emu-sdl],
[AS_HELP_STRING([--enable-grub-emu-sdl],
[build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
AC_ARG_ENABLE([grub-emu-pci],
[AS_HELP_STRING([--enable-grub-emu-pci],
[build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
AC_ARG_ENABLE([grub-emu-modules],
[AS_HELP_STRING([--enable-grub-emu-modules],
[Support module loading in `grub-emu' debugging utility (default=no)])])
if test "$platform" = emu; then
missing_ncurses=
[# Check for curses libraries.]
AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
[AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
[missing_ncurses=[true]])])
AC_SUBST([LIBCURSES])
[if [ x"$missing_ncurses" = x ]; then ]
[# Check for headers.]
AC_CHECK_HEADERS([ncurses/curses.h], [],
[AC_CHECK_HEADERS([ncurses.h], [],
[AC_CHECK_HEADERS([curses.h], [],
[missing_ncurses=[true]])])])
[fi]
if test x"$missing_ncurses" = xtrue ; then
AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
fi
if test x"$enable_grub_emu_modules" = xyes ; then
TARGET_NO_MODULES=no
else
TARGET_NO_MODULES=yes
fi
AC_SUBST(TARGET_NO_MODULES)
if test "$TARGET_NO_MODULES" = yes ; then
# Do not convert modules, otherwise linkage may fail (Cygwin only).
# FIXME: Should be checked above before TARGET_OBJ2ELF is set first.
TARGET_OBJ2ELF=
fi
if test x"$enable_grub_emu_usb" = xno ; then
grub_emu_usb_excuse="explicitly disabled"
fi
if test x"$enable_grub_emu_pci" = xyes ; then
grub_emu_usb_excuse="conflicts with PCI support"
fi
[if [ x"$grub_emu_usb_excuse" = x ]; then
# Check for libusb libraries.]
AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
[grub_emu_usb_excuse=["need libusb library"]])
AC_SUBST([LIBUSB])
[fi]
[if [ x"$grub_emu_usb_excuse" = x ]; then
# Check for headers.]
AC_CHECK_HEADERS([usb.h], [],
[grub_emu_usb_excuse=["need libusb headers"]])
[fi]
if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
fi
if test x"$grub_emu_usb_excuse" = x ; then
enable_grub_emu_usb=yes
else
enable_grub_emu_usb=no
fi
if test x"$enable_grub_emu_sdl" = xno ; then
grub_emu_sdl_excuse="explicitely disabled"
fi
[if [ x"$grub_emu_sdl_excuse" = x ]; then
# Check for libSDL libraries.]
AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
[grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
AC_SUBST([LIBSDL])
[fi]
[if [ x"$grub_emu_sdl_excuse" = x ]; then
# Check for headers.]
AC_CHECK_HEADERS([SDL/SDL.h], [],
[grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
[fi]
if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
fi
if test x"$grub_emu_sdl_excuse" = x ; then
enable_grub_emu_sdl=yes
else
enable_grub_emu_sdl=no
fi
if test x"$enable_grub_emu_pci" != xyes ; then
grub_emu_pci_excuse="not enabled"
fi
if test x"$enable_grub_emu_usb" = xyes ; then
grub_emu_pci_excuse="conflicts with USB support"
fi
[if [ x"$grub_emu_pci_excuse" = x ]; then
# Check for libpci libraries.]
AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
[grub_emu_pci_excuse=["need libpciaccess library"]])
AC_SUBST([LIBPCIACCESS])
[fi]
[if [ x"$grub_emu_pci_excuse" = x ]; then
# Check for headers.]
AC_CHECK_HEADERS([pci/pci.h], [],
[grub_emu_pci_excuse=["need libpciaccess headers"]])
[fi]
if test x"$grub_emu_pci_excuse" = x ; then
enable_grub_emu_pci=yes
else
enable_grub_emu_pci=no
fi
AC_SUBST([enable_grub_emu_sdl])
AC_SUBST([enable_grub_emu_usb])
AC_SUBST([enable_grub_emu_pci])
fi
AC_ARG_ENABLE([grub-fstest],
[AS_HELP_STRING([--enable-grub-fstest],
[build and install the `grub-fstest' debugging utility (default=guessed)])])
if test x"$enable_grub_fstest" = xno ; then
grub_fstest_excuse="explicitly disabled"
fi
if test x"$grub_fstest_excuse" = x ; then
enable_grub_fstest=yes
else
enable_grub_fstest=no
fi
AC_SUBST([enable_grub_fstest])
AC_ARG_ENABLE([grub-mkfont],
[AS_HELP_STRING([--enable-grub-mkfont],
[build and install the `grub-mkfont' utility (default=guessed)])])
if test x"$enable_grub_mkfont" = xno ; then
grub_mkfont_excuse="explicitly disabled"
fi
if test x"$grub_mkfont_excuse" = x ; then
# Check for freetype libraries.
AC_CHECK_PROGS([FREETYPE], [freetype-config])
if test "x$FREETYPE" = x ; then
grub_mkfont_excuse=["need freetype2 library"]
fi
freetype_cflags=`freetype-config --cflags`
freetype_libs=`freetype-config --libs`
fi
if test x"$grub_mkfont_excuse" = x ; then
# Check for freetype libraries.
SAVED_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $freetype_cflags"
AC_CHECK_HEADERS([ft2build.h], [],
[grub_mkfont_excuse=["need freetype2 headers"]])
CPPFLAGS="$SAVED_CPPFLAGS"
fi
if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
fi
if test x"$grub_mkfont_excuse" = x ; then
enable_grub_mkfont=yes
else
enable_grub_mkfont=no
fi
AC_SUBST([enable_grub_mkfont])
AC_SUBST([freetype_cflags])
AC_SUBST([freetype_libs])
AC_SUBST(ASFLAGS)
m4_include([configure.common])
# Output files.
grub_CHECK_LINK_DIR
if test x"$link_dir" = xyes ; then
AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu])
AC_CONFIG_LINKS([include/grub/cpu:grub-core/include/grub/$target_cpu])
if test "$platform" != emu ; then
AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform])
AC_CONFIG_LINKS([include/grub/machine:grub-core/include/grub/$target_cpu/$platform])
fi
else
mkdir -p include/grub 2>/dev/null
rm -rf include/grub/cpu
cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
cp -rp $srcdir/grub-core/include/grub/$target_cpu include/grub/cpu 2>/dev/null
if test "$platform" != emu ; then
rm -rf include/grub/machine
cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
cp -rp $srcdir/grub-core/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
fi
fi
AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([po/Makefile])
AC_CONFIG_FILES([docs/Makefile])
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
AC_CONFIG_SUBDIRS([grub-core])
AC_OUTPUT
[
echo "*******************************************************"
@ -820,11 +88,6 @@ echo PCI support for grub-emu: Yes
else
echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
fi
if [ x"$TARGET_NO_MODULES" = xno ]; then
echo Module support for grub-emu: Yes
else
echo Module support for grub-emu: No
fi
fi
if [ x"$enable_mm_debug" = xyes ]; then
echo With memory debugging: Yes

804
configure.common Normal file
View file

@ -0,0 +1,804 @@
# -*- autoconf -*-
# Process this file with autoconf to produce a configure script.
# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
#
# This configure.ac is free software; the author
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# This file is shared between grub-core and util configure scripts.
# Program name transformations
AC_ARG_PROGRAM
# Optimization flag. Allow user to override.
if test "x$CFLAGS" = x; then
CFLAGS="$CFLAGS -Os"
fi
# Default HOST_CPPFLAGS
CPPFLAGS=''
HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W"
HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_srcdir)/grub-core/include"
HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_srcdir)/grub-core/gnulib"
HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1"
HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_LIBDIR=\\\"\$(pkglibdir)\\\""
HOST_CPPFLAGS="$HOST_CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\""
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W"
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include"
case "$target_cpu" in
i[[3456]]86) target_cpu=i386 ;;
amd64) target_cpu=x86_64 ;;
sparc) target_cpu=sparc64 ;;
mipsel|mips64el)
target_cpu=mips;
cpu_CPPFLAGS="-DGRUB_CPU_MIPSEL=1";
;;
mips|mips64)
target_cpu=mips;
cpu_CPPFLAGS="-DGRUB_CPU_MIPS=1";
;;
esac
# Specify the platform (such as firmware).
AC_ARG_WITH([platform],
AS_HELP_STRING([--with-platform=PLATFORM],
[select the host platform [[guessed]]]))
# Guess the platform if not specified.
if test "x$with_platform" = x; then
case "$target_cpu"-"$target_vendor" in
i386-apple) platform=efi ;;
i386-*) platform=pc ;;
x86_64-apple) platform=efi ;;
x86_64-*) platform=pc ;;
powerpc-*) platform=ieee1275 ;;
powerpc64-*) platform=ieee1275 ;;
sparc64-*) platform=ieee1275 ;;
mips-*) platform=yeeloong ;;
*) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
esac
else
platform="$with_platform"
fi
# Adjust CPU unless target was explicitly specified.
if test -z "$target_alias"; then
case "$target_cpu"-"$platform" in
x86_64-efi) ;;
x86_64-emu) ;;
x86_64-*) target_cpu=i386 ;;
powerpc64-ieee1275) target_cpu=powerpc ;;
esac
fi
# Check if the platform is supported, make final adjustments.
case "$target_cpu"-"$platform" in
i386-efi) ;;
x86_64-efi) ;;
i386-pc) ;;
i386-multiboot) ;;
i386-coreboot) ;;
i386-linuxbios) platform=coreboot ;;
i386-ieee1275) ;;
i386-qemu) ;;
powerpc-ieee1275) ;;
sparc64-ieee1275) ;;
mips-qemu-mips) ;;
mips-yeeloong) ;;
*-emu) ;;
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
esac
case "$target_cpu" in
i386 | powerpc) target_m32=1 ;;
x86_64 | sparc64) target_m64=1 ;;
esac
case "$host_os" in
mingw32*) host_os=cygwin ;;
esac
# This normalizes the names, and creates a new variable ("host_kernel")
# while at it, since the mapping is not always 1:1 (e.g. different OSes
# using the same kernel type).
case "$host_os" in
gnu*) host_kernel=hurd ;;
linux*) host_kernel=linux ;;
freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
netbsd*) host_kernel=netbsd ;;
cygwin) host_kernel=windows ;;
esac
case "$platform" in
coreboot) machine_CPPFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;;
multiboot) machine_CFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;;
efi) machine_CPPFLAGS="-DGRUB_MACHINE_EFI=1" ;;
ieee1275) machine_CPPFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;;
qemu) machine_CPPFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
pc) machine_CPPFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;;
emu) machine_CPPFLAGS="-DGRUB_MACHINE_EMU=1" ;;
yeeloong) machine_CPPFLAGS="-DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
qemu-mips) machine_CPPFLAGS="-DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
esac
case "$target_cpu" in
i386) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_I386";;
x86_64) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_X86_64";;
powerpc) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_POWERPC";;
mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;; # cpu_CPPFLAGS handled above
sparc64) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_SPARC64";
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
esac
HOST_CPPFLAGS="$HOST_CPPFLAGS $cpu_CPPFLAGS $machine_CPPFLAGS"
TARGET_CPPFLAGS="$TARGET_CPPFLAGS $cpu_CPPFLAGS $machine_CPPFLAGS"
AC_SUBST(host_cpu)
AC_SUBST(host_os)
AC_SUBST(host_kernel)
AC_SUBST(target_cpu)
AC_SUBST(platform)
#
# Checks for build programs.
#
# Although cmp is listed in the GNU Coding Standards as a command which
# can used directly, OpenBSD lacks cmp in the default installation.
AC_CHECK_PROGS([CMP], [cmp])
if test "x$CMP" = x; then
AC_MSG_ERROR([cmp is not found])
fi
for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz /usr/share/fonts/unifont/unifont.pcf.gz; do
if test -e $file ; then
FONT_SOURCE=$file
HOST_CPPFLAGS="$HOST_CPPFLAGS -DUSE_ASCII_FAILBACK=1"
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DUSE_ASCII_FAILBACK=1"
break
fi
done
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PROG_AWK
AC_PROG_LEX
AC_PROG_YACC
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P
if test "x$LEX" = x; then
AC_MSG_ERROR([flex is not found])
else
version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
if test -n "$version" -a "$version" -ge 20535; then
:
else
AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
fi
fi
# These are not a "must".
AC_PATH_PROG(MAKEINFO, makeinfo)
#
# Checks for host programs.
#
AC_PROG_CC
AM_PROG_CC_C_O
AM_PROG_AS
# Must be GCC.
test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
AC_GNU_SOURCE
AM_GNU_GETTEXT([external])
AC_SYS_LARGEFILE
# Identify characteristics of the host architecture.
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(long)
grub_apple_cc
if test x$grub_cv_apple_cc = xyes ; then
HOST_CPPFLAGS="$HOST_CPPFLAGS -DAPPLE_CC=1"
HOST_CFLAGS="$HOST_CFLAGS -fnested-functions"
fi
if test "x$cross_compiling" = xyes; then
AC_MSG_WARN([cannot generate manual pages while cross compiling])
else
AC_PATH_PROG(HELP2MAN, help2man)
fi
# Check for functions.
AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf)
# For grub-mkisofs
AC_HEADER_MAJOR
AC_HEADER_DIRENT
AC_CHECK_FUNCS(memmove sbrk strdup lstat getuid getgid)
AC_CHECK_HEADERS(sys/mkdev.h sys/sysmacros.h malloc.h termios.h sys/types.h)
AC_CHECK_HEADERS(unistd.h string.h strings.h sys/stat.h sys/fcntl.h limits.h)
# For opendisk() and getrawpartition() on NetBSD.
# Used in util/deviceiter.c and in util/hostdisk.c.
AC_CHECK_HEADER([util.h], [
AC_CHECK_LIB([util], [opendisk], [
LIBUTIL="-lutil"
AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
])
AC_CHECK_LIB([util], [getrawpartition], [
LIBUTIL="-lutil"
AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
])
])
AC_SUBST([LIBUTIL])
#
# Check for host and build compilers.
#
HOST_CC=$CC
AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc],
[AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])])
#
# Check for target programs.
#
# Find tools for the target.
if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
tmp_ac_tool_prefix="$ac_tool_prefix"
ac_tool_prefix=$target_alias-
AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
[AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
AC_CHECK_TOOL(OBJCOPY, objcopy)
AC_CHECK_TOOL(STRIP, strip)
AC_CHECK_TOOL(NM, nm)
ac_tool_prefix="$tmp_ac_tool_prefix"
else
if test "x$TARGET_CC" = x; then
TARGET_CC=$CC
fi
AC_CHECK_TOOL(OBJCOPY, objcopy)
AC_CHECK_TOOL(STRIP, strip)
AC_CHECK_TOOL(NM, nm)
fi
AC_SUBST(HOST_CC)
AC_SUBST(BUILD_CC)
AC_SUBST(TARGET_CC)
# Test the C compiler for the target environment.
tmp_CC="$CC"
tmp_CFLAGS="$CFLAGS"
tmp_LDFLAGS="$LDFLAGS"
tmp_CPPFLAGS="$CPPFLAGS"
tmp_LIBS="$LIBS"
CC="$TARGET_CC"
CFLAGS="$TARGET_CFLAGS"
CPPFLAGS="$TARGET_CPPFLAGS"
LDFLAGS="$TARGET_LDFLAGS"
LIBS=""
# debug flags.
TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g"
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
# Force no alignment to save space on i386.
if test "x$target_cpu" = xi386; then
AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
CFLAGS="$CFLAGS -falign-loops=1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_cc_falign_loop=yes],
[grub_cv_cc_falign_loop=no])
])
if test "x$grub_cv_cc_falign_loop" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
else
TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
fi
# Some toolchains enable these features by default, but they need
# registers that aren't set up properly in GRUB.
TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
fi
# By default, GCC 4.4 generates .eh_frame sections containing unwind
# information in some cases where it previously did not. GRUB doesn't need
# these and they just use up vital space. Restore the old compiler
# behaviour.
AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_cc_fno_dwarf2_cfi_asm=yes],
[grub_cv_cc_fno_dwarf2_cfi_asm=no])
CFLAGS="$SAVE_CFLAGS"
])
if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
fi
grub_apple_target_cc
if test x$grub_cv_apple_target_cc = xyes ; then
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DAPPLE_CC=1"
TARGET_CFLAGS="$TARGET_CFLAGS -fnested-functions"
CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
TARGET_APPLE_CC=1
AC_CHECK_PROG([OBJCONV], [objconv], [objconv], [])
if test "x$OBJCONV" = x ; then
AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.])
fi
if test "x$OBJCONV" = x ; then
AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
fi
TARGET_IMG_LDSCRIPT=
TARGET_IMG_CFLAGS="-static"
TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
else
TARGET_APPLE_CC=0
# Use linker script if present, otherwise use builtin -N script.
if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext,"
TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc -Wl,-Ttext,"
else
TARGET_IMG_LDSCRIPT=
TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,'
TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,'
fi
TARGET_IMG_CFLAGS=
fi
# For platforms where ELF is not the default link format.
AC_MSG_CHECKING([for command to convert module to ELF format])
case "${host_os}" in
cygwin) TARGET_OBJ2ELF='grub-pe2elf';
# FIXME: put proper test here
AC_DEFINE([NEED_REGISTER_FRAME_INFO], 1,
[Define to 1 if GCC generates calls to __register_frame_info()])
;;
*) ;;
esac
AC_MSG_RESULT([$TARGET_OBJ2ELF])
if test "x$target_m32" = x1; then
# Force 32-bit mode.
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
TARGET_MODULE_FORMAT="elf32"
fi
if test "x$target_m64" = x1; then
# Force 64-bit mode.
TARGET_CFLAGS="$TARGET_CFLAGS -m64"
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
TARGET_MODULE_FORMAT="elf64"
fi
if test "$target_cpu"-"$platform" = x86_64-efi; then
# Use large model to support 4G memory
AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
SAVED_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -m64 -mcmodel=large"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_cc_mcmodel=yes],
[grub_cv_cc_mcmodel=no])
])
if test "x$grub_cv_cc_mcmodel" = xno; then
AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
else
TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
fi
# EFI writes to stack below %rsp, we must not use the red zone
AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
CFLAGS="$CFLAGS -m64 -mno-red-zone"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_cc_no_red_zone=yes],
[grub_cv_cc_no_red_zone=no])
])
if test "x$grub_cv_cc_no_red_zone" = xno; then
AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
fi
TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
fi
#
# Compiler features.
#
# Need __enable_execute_stack() for nested function trampolines?
grub_CHECK_ENABLE_EXECUTE_STACK
# Position independent executable.
grub_CHECK_PIE
[# Need that, because some distributions ship compilers that include
# `-fPIE' in the default specs.
if [ x"$pie_possible" = xyes ]; then
TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
fi]
# Smashing stack protector.
grub_CHECK_STACK_PROTECTOR
# Need that, because some distributions ship compilers that include
# `-fstack-protector' in the default specs.
if test "x$ssp_possible" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
fi
grub_CHECK_STACK_ARG_PROBE
# Cygwin's GCC uses alloca() to probe the stackframe on static
# stack allocations above some threshold.
if test x"$sap_possible" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
fi
AC_ARG_ENABLE([werror],
[AS_HELP_STRING([--disable-werror],
[do not use -Werror when building GRUB])])
if test x"$enable_werror" != xno ; then
TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
fi
AC_SUBST(TARGET_MODULE_FORMAT)
AC_SUBST(OBJCONV)
AC_SUBST(TARGET_APPLE_CC)
AC_SUBST(TARGET_CFLAGS)
AC_SUBST(TARGET_LDFLAGS)
AC_SUBST(TARGET_CPPFLAGS)
AC_SUBST(TARGET_CCASFLAGS)
AC_SUBST(HOST_CFLAGS)
AC_SUBST(HOST_LDFLAGS)
AC_SUBST(HOST_CPPFLAGS)
AC_SUBST(HOST_CCASFLAGS)
# Set them to their new values for the tests below.
CC="$TARGET_CC"
if test "x$TARGET_APPLE_CC" = x1 ; then
CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
else
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
fi
CPPFLAGS="$TARGET_CPPFLAGS"
LDFLAGS="$TARGET_LDFLAGS"
LIBS=-lgcc
grub_ASM_USCORE
if test x$grub_cv_asm_uscore = xyes; then
CFLAGS="$CFLAGS -Wl,--defsym,_abort=_main"
else
CFLAGS="$CFLAGS -Wl,--defsym,abort=main"
fi
# Check for libgcc symbols
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x)
if test "x$TARGET_APPLE_CC" = x1 ; then
CFLAGS="$TARGET_CFLAGS -nostdlib"
else
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
fi
LIBS=""
# Defined in aclocal.m4.
grub_PROG_TARGET_CC
if test "x$TARGET_APPLE_CC" != x1 ; then
grub_PROG_OBJCOPY_ABSOLUTE
fi
grub_PROG_LD_BUILD_ID_NONE
if test "x$target_cpu" = xi386; then
if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
# Check symbols provided by linker script.
CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC}8000 -Wl,--defsym,___main=0x8100"
fi
grub_CHECK_BSS_START_SYMBOL
grub_CHECK_END_SYMBOL
fi
CFLAGS="$TARGET_CFLAGS"
grub_I386_ASM_PREFIX_REQUIREMENT
grub_I386_ASM_ADDR32
grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
else
AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug])
fi
AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL)
#define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1)))
#else
#define NESTED_FUNC_ATTR
#endif])
AC_ARG_ENABLE([efiemu],
[AS_HELP_STRING([--enable-efiemu],
[build and install the efiemu runtimes (default=guessed)])])
if test x"$enable_efiemu" = xno ; then
efiemu_excuse="explicitly disabled"
fi
if test x"$efiemu_excuse" = x ; then
AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_cc_efiemu=yes],
[grub_cv_cc_efiemu=no])
])
if test x$grub_cv_cc_efiemu = xno; then
efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
fi
fi
if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
fi
if test x"$efiemu_excuse" = x ; then
enable_efiemu=yes
else
enable_efiemu=no
fi
AC_SUBST([enable_efiemu])
if test "$platform" != emu; then
AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
SAVED_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
int va_arg_func (int fixed, va_list args);]], [[]])],
[grub_cv_cc_isystem=yes],
[grub_cv_cc_isystem=no])
CPPFLAGS="$SAVED_CPPFLAGS"
])
if test x"$grub_cv_cc_isystem" = xyes ; then
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
fi
fi
# Restore the flags.
CC="$tmp_CC"
CFLAGS="$tmp_CFLAGS"
CPPFLAGS="$tmp_CPPFLAGS"
LDFLAGS="$tmp_LDFLAGS"
LIBS="$tmp_LIBS"
#
# Check for options.
#
# Memory manager debugging.
AC_ARG_ENABLE([mm-debug],
AS_HELP_STRING([--enable-mm-debug],
[include memory manager debugging]),
[AC_DEFINE([MM_DEBUG], [1],
[Define to 1 if you enable memory manager debugging.])])
AC_ARG_ENABLE([grub-emu-usb],
[AS_HELP_STRING([--enable-grub-emu-usb],
[build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
AC_ARG_ENABLE([grub-emu-sdl],
[AS_HELP_STRING([--enable-grub-emu-sdl],
[build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
AC_ARG_ENABLE([grub-emu-pci],
[AS_HELP_STRING([--enable-grub-emu-pci],
[build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
if test "$platform" = emu; then
missing_ncurses=
[# Check for curses libraries.]
AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
[AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
[missing_ncurses=[true]])])
AC_SUBST([LIBCURSES])
[if [ x"$missing_ncurses" = x ]; then ]
[# Check for headers.]
AC_CHECK_HEADERS([ncurses/curses.h], [],
[AC_CHECK_HEADERS([ncurses.h], [],
[AC_CHECK_HEADERS([curses.h], [],
[missing_ncurses=[true]])])])
[fi]
if test x"$missing_ncurses" = xtrue ; then
AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
fi
if test x"$enable_grub_emu_usb" = xno ; then
grub_emu_usb_excuse="explicitly disabled"
fi
if test x"$enable_grub_emu_pci" = xyes ; then
grub_emu_usb_excuse="conflicts with PCI support"
fi
[if [ x"$grub_emu_usb_excuse" = x ]; then
# Check for libusb libraries.]
AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
[grub_emu_usb_excuse=["need libusb library"]])
AC_SUBST([LIBUSB])
[fi]
[if [ x"$grub_emu_usb_excuse" = x ]; then
# Check for headers.]
AC_CHECK_HEADERS([usb.h], [],
[grub_emu_usb_excuse=["need libusb headers"]])
[fi]
if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
fi
if test x"$grub_emu_usb_excuse" = x ; then
enable_grub_emu_usb=yes
else
enable_grub_emu_usb=no
fi
if test x"$enable_grub_emu_sdl" = xno ; then
grub_emu_sdl_excuse="explicitely disabled"
fi
[if [ x"$grub_emu_sdl_excuse" = x ]; then
# Check for libSDL libraries.]
AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
[grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
AC_SUBST([LIBSDL])
[fi]
[if [ x"$grub_emu_sdl_excuse" = x ]; then
# Check for headers.]
AC_CHECK_HEADERS([SDL/SDL.h], [],
[grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
[fi]
if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
fi
if test x"$grub_emu_sdl_excuse" = x ; then
enable_grub_emu_sdl=yes
else
enable_grub_emu_sdl=no
fi
if test x"$enable_grub_emu_pci" != xyes ; then
grub_emu_pci_excuse="not enabled"
fi
if test x"$enable_grub_emu_usb" = xyes ; then
grub_emu_pci_excuse="conflicts with USB support"
fi
[if [ x"$grub_emu_pci_excuse" = x ]; then
# Check for libpci libraries.]
AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
[grub_emu_pci_excuse=["need libpciaccess library"]])
AC_SUBST([LIBPCIACCESS])
[fi]
[if [ x"$grub_emu_pci_excuse" = x ]; then
# Check for headers.]
AC_CHECK_HEADERS([pci/pci.h], [],
[grub_emu_pci_excuse=["need libpciaccess headers"]])
[fi]
if test x"$grub_emu_pci_excuse" = x ; then
enable_grub_emu_pci=yes
else
enable_grub_emu_pci=no
fi
AC_SUBST([enable_grub_emu_sdl])
AC_SUBST([enable_grub_emu_usb])
AC_SUBST([enable_grub_emu_pci])
fi
AC_ARG_ENABLE([grub-fstest],
[AS_HELP_STRING([--enable-grub-fstest],
[build and install the `grub-fstest' debugging utility (default=guessed)])])
if test x"$enable_grub_fstest" = xno ; then
grub_fstest_excuse="explicitly disabled"
fi
if test x"$grub_fstest_excuse" = x ; then
enable_grub_fstest=yes
else
enable_grub_fstest=no
fi
AC_SUBST([enable_grub_fstest])
AC_ARG_ENABLE([grub-mkfont],
[AS_HELP_STRING([--enable-grub-mkfont],
[build and install the `grub-mkfont' utility (default=guessed)])])
if test x"$enable_grub_mkfont" = xno ; then
grub_mkfont_excuse="explicitly disabled"
fi
if test x"$grub_mkfont_excuse" = x ; then
# Check for freetype libraries.
AC_CHECK_PROGS([FREETYPE], [freetype-config])
if test "x$FREETYPE" = x ; then
grub_mkfont_excuse=["need freetype2 library"]
fi
freetype_cflags=`freetype-config --cflags`
freetype_libs=`freetype-config --libs`
fi
if test x"$grub_mkfont_excuse" = x ; then
# Check for freetype libraries.
SAVED_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $freetype_cflags"
AC_CHECK_HEADERS([ft2build.h], [],
[grub_mkfont_excuse=["need freetype2 headers"]])
CPPFLAGS="$SAVED_CPPFLAGS"
fi
if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
fi
if test x"$grub_mkfont_excuse" = x ; then
enable_grub_mkfont=yes
else
enable_grub_mkfont=no
fi
AC_SUBST([enable_grub_mkfont])
AC_SUBST([freetype_cflags])
AC_SUBST([freetype_libs])
AC_SUBST([FONT_SOURCE])
AS_IF([test x$target_cpu = xi386 -a x$platform = xpc],
[AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x8200)])
AS_IF([test x$target_cpu = xi386 -a x$platform = xcoreboot],
[AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x8200)])
AS_IF([test x$target_cpu = xmips -a x$platform = xyeeloong],
[AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x80200000)])
AS_IF([test x$target_cpu = xpowerpc -a x$platform = xieee1275],
[AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x200000)])
AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
[AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
AS_IF([test x$target_cpu = xi386 -a x$platform = xieee1275],
[AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x10000)])
AS_IF([test x$TARGET_APPLE_CC = x1],
[AC_SUBST([USE_APPLE_CC_FIXES], yes)])
#
# Automake conditionals
#
AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275])
AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu])
AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
AM_CONDITIONAL([COND_mips_yeeloong], [test x$target_cpu = xmips -a x$platform = xyeeloong])
AM_CONDITIONAL([COND_mips_qemu_mips], [test x$target_cpu = xmips -a x$platform = xqemu_mips])
AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
AM_CONDITIONAL([COND_GRUB_FSTEST], [test x$enable_grub_fstest = xyes])
AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])

6
docs/Makefile.am Normal file
View file

@ -0,0 +1,6 @@
AUTOMAKE_OPTIONS = subdir-objects
AM_MAKEINFOFLAGS = --force --no-split --no-validate
info_TEXINFOS = grub.texi
grub_TEXINFOS = fdl.texi

View file

@ -11,11 +11,6 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
lst="$1"
shift
header=`echo "${lst}" | sed -e "s/\.lst$/.h/g"`
cat <<EOF
/* This file is automatically generated by geninit.sh. DO NOT EDIT! */
/*
@ -36,22 +31,24 @@ cat <<EOF
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <$header>
#include <grub/emu/misc.h>
EOF
for mod in "$@"; do
echo "extern void grub_${mod}_init (void);"
echo "extern void grub_${mod}_fini (void);"
done
cat <<EOF
void
grub_init_all (void)
{
EOF
while read line; do
file=`echo $line | cut -f1 -d:`
if echo $@ | grep $file >/dev/null; then
echo $line | sed -e 's/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/ grub_\1_init ();/'
fi
done < ${lst}
for mod in "$@"; do
echo "grub_${mod}_init ();"
done
cat <<EOF
}
@ -63,12 +60,9 @@ grub_fini_all (void)
{
EOF
while read line; do
file=`echo $line | cut -f1 -d:`
if echo $@ | grep $file >/dev/null; then
echo $line | sed -e 's/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/ grub_\1_fini ();/'
fi
done < ${lst}
for mod in "$@"; do
echo "grub_${mod}_fini ();"
done
cat <<EOF
}

View file

@ -1,45 +0,0 @@
#! /bin/sh
#
# Copyright (C) 2005,2007 Free Software Foundation, Inc.
#
# This gensymlist.sh is free software; the author
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
lst="$1"
shift
cat <<EOF
/* This file is automatically generated by gensymlist.sh. DO NOT EDIT! */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2007 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
EOF
cat <<EOF
void grub_init_all (void);
void grub_fini_all (void);
EOF
grep -v '^#' "${lst}" | sed -n '/GRUB_MOD_INIT *([a-zA-Z0-9_]*)/{s/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/void grub_\1_init (void);/;p;}'
grep -v '^#' "${lst}" | sed -n '/GRUB_MOD_INIT *([a-zA-Z0-9_]*)/{s/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/void grub_\1_fini (void);/;p;}'

View file

@ -1,27 +0,0 @@
#! /bin/sh
#
# Copyright (C) 2002,2006,2008 Free Software Foundation, Inc.
#
# This gensymlist.sh is free software; the author
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
### The configure script will replace these variables.
: ${srcdir=@srcdir@}
: ${CC=@TARGET_CC@}
u=
grep "^#define HAVE_ASM_USCORE" config.h >/dev/null 2>&1 && u="_"
$CC @TARGET_CFLAGS@ -DGRUB_SYMBOL_GENERATOR=1 -E -I. -Iinclude -I"$srcdir/include" $* \
| grep -v '^#' \
| sed -n \
-e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/'"$u"'\1 kernel/;p;}' \
-e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/'"$u"'\1 kernel/;p;}' \
| sort -u

475
genmk.rb
View file

@ -1,475 +0,0 @@
#! /usr/bin/ruby -w
#
# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
#
# This genmk.rb is free software; the author
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
module Enumerable
def collect_with_index
ret = []
self.each_with_index do |item, index|
ret.push(yield(item, index))
end
ret
end
end
class String
def to_var
self.gsub(/[^a-zA-Z0-9_@]/, '_')
end
def suffix(str)
self.sub(/\.[^\.]*$/, '') + '.' + str
end
def to_obj
self.sub(/\.[^\.]*$/, '').to_var + '.o'
end
end
class Image
def initialize(dir, name)
@dir = dir
@name = name
@rule_count = 0
end
attr_reader :dir, :name
def rule(sources)
prefix = @name.to_var
@rule_count += 1
exe = @name.suffix('exec')
objs = sources.collect do |src|
raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src
prefix + '-' + src.to_obj
end
objs_str = objs.join(' ')
deps = objs.collect {|obj| obj.suffix('d')}
deps_str = deps.join(' ')
"
clean-image-#{@name}.#{@rule_count}:
rm -f #{@name} #{exe} #{objs_str}
CLEAN_IMAGE_TARGETS += clean-image-#{@name}.#{@rule_count}
mostlyclean-image-#{@name}.#{@rule_count}:
rm -f #{deps_str}
MOSTLYCLEAN_IMAGE_TARGETS += mostlyclean-image-#{@name}.#{@rule_count}
ifneq ($(TARGET_APPLE_CC),1)
#{@name}: #{exe}
$(OBJCOPY) -O $(#{prefix}_FORMAT) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@
else
ifneq (#{exe},kernel.exec)
#{@name}: #{exe} ./grub-macho2img
./grub-macho2img $< $@
else
#{@name}: #{exe} ./grub-macho2img
./grub-macho2img --bss $< $@
endif
endif
#{exe}: #{objs_str}
$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
" + objs.collect_with_index do |obj, i|
src = sources[i]
fake_obj = File.basename(src).suffix('o')
dep = deps[i]
flag = if /\.c$/ =~ src then 'CFLAGS' else 'ASFLAGS' end
extra_flags = if /\.S$/ =~ src then '-DASM_FILE=1' else '' end
dir = File.dirname(src)
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -DGRUB_FILE=\\\"#{src}\\\" -MD -c -o $@ $<
-include #{dep}
"
end.join('')
end
end
# Use PModule instead Module, to avoid name conflicting.
class PModule
def initialize(dir, name)
@dir = dir
@name = name
@rule_count = 0
end
attr_reader :dir, :name
def rule(sources)
prefix = @name.to_var
@rule_count += 1
objs = sources.collect do |src|
raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src
prefix + '-' + src.to_obj
end
objs_str = objs.join(' ')
deps = objs.collect {|obj| obj.suffix('d')}
deps_str = deps.join(' ')
pre_obj = 'pre-' + @name.suffix('o')
mod_src = 'mod-' + @name.suffix('c')
mod_obj = mod_src.suffix('o')
defsym = 'def-' + @name.suffix('lst')
undsym = 'und-' + @name.suffix('lst')
mod_name = File.basename(@name, '.mod')
symbolic_name = mod_name.sub(/\.[^\.]*$/, '')
"
clean-module-#{@name}.#{@rule_count}:
rm -f #{@name} #{mod_obj} #{mod_src} #{pre_obj} #{objs_str} #{undsym}
CLEAN_MODULE_TARGETS += clean-module-#{@name}.#{@rule_count}
clean-module-#{@name}-symbol.#{@rule_count}:
rm -f #{defsym}
CLEAN_MODULE_TARGETS += clean-module-#{@name}-symbol.#{@rule_count}
DEFSYMFILES += #{defsym}
mostlyclean-module-#{@name}.#{@rule_count}:
rm -f #{deps_str}
MOSTLYCLEAN_MODULE_TARGETS += mostlyclean-module-#{@name}.#{@rule_count}
UNDSYMFILES += #{undsym}
ifeq ($(TARGET_NO_MODULES), yes)
#{@name}: #{pre_obj} $(TARGET_OBJ2ELF)
-rm -f $@
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{pre_obj}
if test ! -z \"$(TARGET_OBJ2ELF)\"; then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@; fi
else
ifneq ($(TARGET_APPLE_CC),1)
#{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF)
-rm -f $@
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{pre_obj} #{mod_obj}
if test ! -z \"$(TARGET_OBJ2ELF)\"; then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@; fi
else
#{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF)
-rm -f $@
-rm -f $@.bin
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@.bin #{pre_obj} #{mod_obj}
$(OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -wd1106 -ew2030 -ew2050 -nu -nd $@.bin $@
-rm -f $@.bin
endif
endif
#{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str}
-rm -f $@
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{objs_str}
#{mod_obj}: #{mod_src}
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(#{prefix}_CFLAGS) -DGRUB_FILE=\\\"#{mod_src}\\\" -c -o $@ $<
#{mod_src}: $(builddir)/moddep.lst $(srcdir)/genmodsrc.sh
sh $(srcdir)/genmodsrc.sh '#{mod_name}' $< > $@ || (rm -f $@; exit 1)
ifneq ($(TARGET_APPLE_CC),1)
#{defsym}: #{pre_obj}
$(NM) -g --defined-only -P -p $< | sed 's/^\\([^ ]*\\).*/\\1 #{mod_name}/' > $@
else
#{defsym}: #{pre_obj}
$(NM) -g -P -p $< | grep -E '^[a-zA-Z0-9_]* [TDS]' | sed 's/^\\([^ ]*\\).*/\\1 #{mod_name}/' > $@
endif
#{undsym}: #{pre_obj}
echo '#{mod_name}' > $@
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
" + objs.collect_with_index do |obj, i|
src = sources[i]
fake_obj = File.basename(src).suffix('o')
extra_target = obj.sub(/\.[^\.]*$/, '') + '-extra'
command = 'cmd-' + obj.suffix('lst')
fs = 'fs-' + obj.suffix('lst')
partmap = 'partmap-' + obj.suffix('lst')
handler = 'handler-' + obj.suffix('lst')
terminal = 'terminal-' + obj.suffix('lst')
parttool = 'parttool-' + obj.suffix('lst')
video = 'video-' + obj.suffix('lst')
dep = deps[i]
flag = if /\.c$/ =~ src then 'CFLAGS' else 'ASFLAGS' end
extra_flags = if /\.S$/ =~ src then '-DASM_FILE=1' else '' end
dir = File.dirname(src)
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -DGRUB_FILE=\\\"#{src}\\\" -MD -c -o $@ $<
-include #{dep}
clean-module-#{extra_target}.#{@rule_count}:
rm -f #{command} #{fs} #{partmap} #{handler} #{parttool} #{video} #{terminal}
CLEAN_MODULE_TARGETS += clean-module-#{extra_target}.#{@rule_count}
COMMANDFILES += #{command}
FSFILES += #{fs}
PARTTOOLFILES += #{parttool}
PARTMAPFILES += #{partmap}
HANDLERFILES += #{handler}
TERMINALFILES += #{terminal}
VIDEOFILES += #{video}
#{command}: #{src} $(#{src}_DEPENDENCIES) gencmdlist.sh
set -e; \
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
| sh $(srcdir)/gencmdlist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
#{fs}: #{src} $(#{src}_DEPENDENCIES) genfslist.sh
set -e; \
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
| sh $(srcdir)/genfslist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
#{parttool}: #{src} $(#{src}_DEPENDENCIES) genparttoollist.sh
set -e; \
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
| sh $(srcdir)/genparttoollist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
#{partmap}: #{src} $(#{src}_DEPENDENCIES) genpartmaplist.sh
set -e; \
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
| sh $(srcdir)/genpartmaplist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
#{handler}: #{src} $(#{src}_DEPENDENCIES) genhandlerlist.sh
set -e; \
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
| sh $(srcdir)/genhandlerlist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
#{terminal}: #{src} $(#{src}_DEPENDENCIES) genterminallist.sh
set -e; \
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
| sh $(srcdir)/genterminallist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
#{video}: #{src} $(#{src}_DEPENDENCIES) genvideolist.sh
set -e; \
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
| sh $(srcdir)/genvideolist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
"
end.join('')
end
end
class Utility
def initialize(dir, name)
@dir = dir
@name = name
@rule_count = 0
end
def print_tail()
prefix = @name.to_var
print "#{@name}: $(#{prefix}_DEPENDENCIES) $(#{prefix}_OBJECTS)
$(CC) -o $@ $(#{prefix}_OBJECTS) $(LDFLAGS) $(#{prefix}_LDFLAGS)
"
end
attr_reader :dir, :name
def rule(sources)
prefix = @name.to_var
@rule_count += 1
objs = sources.collect do |src|
raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src
prefix + '-' + src.to_obj
end
objs_str = objs.join(' ');
deps = objs.collect {|obj| obj.suffix('d')}
deps_str = deps.join(' ');
"
clean-utility-#{@name}.#{@rule_count}:
rm -f #{@name}$(EXEEXT) #{objs_str}
CLEAN_UTILITY_TARGETS += clean-utility-#{@name}.#{@rule_count}
mostlyclean-utility-#{@name}.#{@rule_count}:
rm -f #{deps_str}
MOSTLYCLEAN_UTILITY_TARGETS += mostlyclean-utility-#{@name}.#{@rule_count}
#{prefix}_OBJECTS += #{objs_str}
" + objs.collect_with_index do |obj, i|
src = sources[i]
fake_obj = File.basename(src).suffix('o')
dep = deps[i]
dir = File.dirname(src)
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
$(CC) -I#{dir} -I$(srcdir)/#{dir} $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(#{prefix}_CFLAGS) -DGRUB_FILE=\\\"#{src}\\\" -MD -c -o $@ $<
-include #{dep}
"
end.join('')
end
end
class Program
def initialize(dir, name)
@dir = dir
@name = name
end
attr_reader :dir, :name
def print_tail()
prefix = @name.to_var
print "CLEANFILES += #{@name} $(#{prefix}_OBJECTS)
ifeq ($(#{prefix}_RELOCATABLE),yes)
#{@name}: $(#{prefix}_DEPENDENCIES) $(#{prefix}_OBJECTS)
$(TARGET_CC) -Wl,-r,-d -o $@ $(#{prefix}_OBJECTS) $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) --strip-unneeded -K start -R .note -R .comment $@; fi
else
#{@name}: $(#{prefix}_DEPENDENCIES) $(#{prefix}_OBJECTS)
$(TARGET_CC) -o $@ $(#{prefix}_OBJECTS) $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) -R .rel.dyn -R .reginfo -R .note -R .comment $@; fi
endif
"
end
def rule(sources)
prefix = @name.to_var
objs = sources.collect do |src|
raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src
prefix + '-' + src.to_obj
end
deps = objs.collect {|obj| obj.suffix('d')}
deps_str = deps.join(' ');
"MOSTLYCLEANFILES += #{deps_str}
" + objs.collect_with_index do |obj, i|
src = sources[i]
fake_obj = File.basename(src).suffix('o')
dep = deps[i]
flag = if /\.c$/ =~ src then 'CFLAGS' else 'ASFLAGS' end
extra_flags = if /\.S$/ =~ src then '-DASM_FILE=1' else '' end
dir = File.dirname(src)
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -DGRUB_FILE=\\\"#{src}\\\" -MD -c -o $@ $<
-include #{dep}
#{prefix}_OBJECTS += #{obj}
"
end.join('')
end
end
class Script
def initialize(dir, name)
@dir = dir
@name = name
end
attr_reader :dir, :name
def rule(sources)
if sources.length != 1
raise "only a single source file must be specified for a script"
end
src = sources[0]
if /\.in$/ !~ src
raise "unknown source file `#{src}'"
end
"CLEANFILES += #{@name}
#{@name}: #{src} $(#{src}_DEPENDENCIES) config.status
./config.status --file=-:#{src} | sed -e 's,@pkglib_DATA@,$(pkglib_DATA),g' > $@
chmod +x $@
"
end
end
images = []
utils = []
pmodules = []
programs = []
scripts = []
l = gets
print l
print "# Generated by genmk.rb, please don't edit!\n"
cont = false
str = nil
while l = gets
if cont
str += l
else
str = l
end
print l
cont = (/\\$/ =~ l)
unless cont
str.gsub!(/\\\n/, ' ')
if /^([a-zA-Z0-9_]+)\s*\+?=\s*(.*?)\s*$/ =~ str
var, args = $1, $2
if var =~ /^([a-zA-Z0-9_]+)_([A-Z]+)$/
prefix, type = $1, $2
case type
when 'IMAGES'
images += args.split(/\s+/).collect do |img|
Image.new(prefix, img)
end
when 'MODULES'
pmodules += args.split(/\s+/).collect do |pmod|
PModule.new(prefix, pmod)
end
when 'UTILITIES'
utils += args.split(/\s+/).collect do |util|
Utility.new(prefix, util)
end
when 'PROGRAMS'
programs += args.split(/\s+/).collect do |prog|
Program.new(prefix, prog)
end
when 'SCRIPTS'
scripts += args.split(/\s+/).collect do |script|
Script.new(prefix, script)
end
when 'SOURCES'
if img = images.detect() {|i| i.name.to_var == prefix}
print img.rule(args.split(/\s+/))
elsif pmod = pmodules.detect() {|m| m.name.to_var == prefix}
print pmod.rule(args.split(/\s+/))
elsif util = utils.detect() {|u| u.name.to_var == prefix}
print util.rule(args.split(/\s+/))
elsif program = programs.detect() {|u| u.name.to_var == prefix}
print program.rule(args.split(/\s+/))
elsif script = scripts.detect() {|s| s.name.to_var == prefix}
print script.rule(args.split(/\s+/))
end
end
end
end
end
end
utils.each {|util| util.print_tail()}
programs.each {|program| program.print_tail()}

460
gentpl.py Normal file
View file

@ -0,0 +1,460 @@
#! /usr/bin/python
#
# This is the python script used to generate Makefile.tpl
#
GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot",
"i386_ieee1275", "x86_64_efi", "mips_yeeloong", "sparc64_ieee1275",
"powerpc_ieee1275" ]
GROUPS = {}
GROUPS["i386"] = [ "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_ieee1275" ]
GROUPS["x86_64"] = [ "x86_64_efi" ]
GROUPS["mips"] = [ "mips_yeeloong" ]
GROUPS["sparc64"] = [ "sparc64_ieee1275" ]
GROUPS["powerpc"] = [ "powerpc_ieee1275" ]
GROUPS["x86"] = GROUPS["i386"] + GROUPS["x86_64"]
GROUPS["x86_efi"] = [ "i386_efi", "x86_64_efi" ]
GROUPS["common"] = GRUB_PLATFORMS[:]
GROUPS["nonemu"] = GRUB_PLATFORMS[:]
GROUPS["nonemu"].remove("emu")
#
# Create platform => groups reverse map, where groups covering that
# platform are ordered by their sizes
#
RMAP = {}
for platform in GRUB_PLATFORMS:
# initialize with platform itself as a group
RMAP[platform] = [ platform ]
for k in GROUPS.keys():
v = GROUPS[k]
# skip groups that don't cover this platform
if platform not in v: continue
bigger = []
smaller = []
# partition currently known groups based on their size
for group in RMAP[platform]:
if group in GRUB_PLATFORMS: smaller.append(group)
elif len(GROUPS[group]) < len(v): smaller.append(group)
else: bigger.append(group)
# insert in the middle
RMAP[platform] = smaller + [ k ] + bigger
#
# Global variables
#
GVARS = []
def gvar_add(var, value):
if var not in GVARS:
GVARS.append(var)
return var + " += " + value + "\n"
def global_variable_initializers():
r = ""
for var in GVARS:
r += var + " ?= \n"
return r
#
# Per PROGRAM/SCRIPT variables
#
def var_set(var, value):
return var + " = " + value + "\n"
def var_add(var, value):
return var + " += " + value + "\n"
#
# Autogen constructs
#
def if_tag(tag, closure):
return "[+ IF " + tag + " +]" + closure() + "[+ ENDIF +]"
def if_tag_defined(tag, closure):
return "[+ IF " + tag + " defined +]" + closure() + "[+ ENDIF +]"
def for_tag(tag, closure):
return "[+ FOR ." + tag + " +]" + closure() + "[+ ENDFOR +]"
def collect_values(tag, prefix=""):
return for_tag(tag, lambda: prefix + "[+ ." + tag + " +] ")
def each_group(platform, suffix, closure):
r = None
for group in RMAP[platform]:
if r == None:
r = "[+ IF ." + group + suffix + " +]"
else:
r += "[+ ELIF ." + group + suffix + " +]"
r += closure(group)
if r:
r += "[+ ELSE +]"
r += closure(None)
r += "[+ ENDIF +]"
else:
r = closure(None)
return r
def each_platform(closure):
r = ""
for platform in GRUB_PLATFORMS:
for group in RMAP[platform]:
if group == RMAP[platform][0]:
r += "[+ IF ." + group + " defined +]"
else:
r += "[+ ELIF ." + group + " defined +]"
r += "if COND_" + platform + "\n"
r += closure(platform)
r += "endif\n"
r += "[+ ENDIF +]"
return r
def canonical_name(): return "[+ % name `echo -n %s | sed -e 's/[^0-9A-Za-z@_]/_/g'` +]"
def canonical_module(): return canonical_name() + "_module"
def canonical_kernel(): return canonical_name() + "_exec"
def canonical_image(): return canonical_name() + "_image"
def shared_sources(prefix=""): return collect_values("shared", prefix)
def shared_nodist_sources(prefix=""): return collect_values("nodist_shared", prefix)
def default_sources(prefix=""): return collect_values("source", prefix)
def default_nodist_sources(prefix=""): return collect_values("nodist", prefix)
def default_ldadd(): return collect_values("ldadd")
def default_cflags(): return collect_values("cflags")
def default_ldflags(): return collect_values("ldflags")
def default_cppflags(): return collect_values("cppflags")
def default_ccasflags(): return collect_values("ccasflags")
def group_sources(group, prefix=""): return collect_values(group, prefix) if group else default_sources(prefix)
def group_nodist_sources(group, prefix=""): return collect_values(group + "_nodist", prefix) if group else default_nodist_sources(prefix)
def platform_sources(platform, prefix=""): return each_group(platform, "", lambda g: collect_values(g, prefix) if g else default_sources(prefix))
def platform_nodist_sources(platform, prefix=""): return each_group(platform, "_nodist", lambda g: collect_values(g + "_nodist", prefix) if g else default_nodist_sources(prefix))
def platform_ldadd(platform): return each_group(platform, "_ldadd", lambda g: collect_values(g + "_ldadd") if g else default_ldadd())
def platform_cflags(platform): return each_group(platform, "_cflags", lambda g: collect_values(g + "_cflags") if g else default_cflags())
def platform_ldflags(platform): return each_group(platform, "_ldflags", lambda g: collect_values(g + "_ldflags") if g else default_ldflags())
def platform_cppflags(platform): return each_group(platform, "_cppflags", lambda g: collect_values(g + "_cppflags") if g else default_cppflags())
def platform_ccasflags(platform): return each_group(platform, "_ccasflags", lambda g: collect_values(g + "_ccasflags") if g else default_ccasflags())
def platform_format(platform): return each_group(platform, "_format", lambda g: collect_values(g + "_format") if g else "binary")
def module(platform):
r = gvar_add("noinst_PROGRAMS", "[+ name +].module")
r += gvar_add("MODULE_FILES", "[+ name +].module")
r += var_set(canonical_module() + "_SOURCES", platform_sources(platform) + "## platform sources")
r += var_add(canonical_module() + "_SOURCES", shared_sources() + "## shared sources")
r += var_set("nodist_" + canonical_module() + "_SOURCES", platform_nodist_sources(platform) + "## platform nodist sources")
r += var_add("nodist_" + canonical_module() + "_SOURCES", shared_nodist_sources() + "## shared nodist sources")
r += var_set(canonical_module() + "_LDADD", platform_ldadd(platform))
r += var_set(canonical_module() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_MODULE) " + platform_cflags(platform))
r += var_set(canonical_module() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_MODULE) " + platform_ldflags(platform))
r += var_set(canonical_module() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_MODULE) " + platform_cppflags(platform))
r += var_set(canonical_module() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_MODULE) " + platform_ccasflags(platform))
r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_module() + "_SOURCES)")
r += gvar_add("CLEANFILES", "$(nodist_" + canonical_module() + "_SOURCES)")
r += gvar_add("DEF_FILES", "def-[+ name +].lst")
r += gvar_add("UND_FILES", "und-[+ name +].lst")
r += gvar_add("MOD_FILES", "[+ name +].mod")
r += gvar_add("platform_DATA", "[+ name +].mod")
r += gvar_add("CLEANFILES", "def-[+ name +].lst und-[+ name +].lst mod-[+ name +].c mod-[+ name +].o [+ name +].mod")
r += gvar_add("COMMAND_FILES", "command-[+ name +].lst")
r += gvar_add("FS_FILES", "fs-[+ name +].lst")
r += gvar_add("VIDEO_FILES", "video-[+ name +].lst")
r += gvar_add("PARTMAP_FILES", "partmap-[+ name +].lst")
r += gvar_add("HANDLER_FILES", "handler-[+ name +].lst")
r += gvar_add("PARTTOOL_FILES", "parttool-[+ name +].lst")
r += gvar_add("TERMINAL_FILES", "terminal-[+ name +].lst")
r += gvar_add("CLEANFILES", "command-[+ name +].lst fs-[+ name +].lst")
r += gvar_add("CLEANFILES", "handler-[+ name +].lst terminal-[+ name +].lst")
r += gvar_add("CLEANFILES", "video-[+ name +].lst partmap-[+ name +].lst parttool-[+ name +].lst")
r += """
[+ name +].pp: $(""" + canonical_module() + """_SOURCES) $(nodist_""" + canonical_module() + """_SOURCES)
$(TARGET_CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(""" + canonical_module() + """_CPPFLAGS) $(CPPFLAGS) $^ > $@ || (rm -f $@; exit 1)
def-[+ name +].lst: [+ name +].module
if test x$(USE_APPLE_CC_FIXES) = xyes; then \
$(NM) -g -P -p $< | grep -E '^[a-zA-Z0-9_]* [TDS]' | sed "s/^\\([^ ]*\\).*/\\1 [+ name +]/" >> $@; \
else \
$(NM) -g --defined-only -P -p $< | sed "s/^\\([^ ]*\\).*/\\1 [+ name +]/" >> $@; \
fi
und-[+ name +].lst: [+ name +].module
$(NM) -u -P -p $< | sed "s/^\\([^ ]*\\).*/\\1 [+ name +]/" >> $@
mod-[+ name +].c: [+ name +].module $(top_builddir)/moddep.lst $(top_srcdir)/genmodsrc.sh
sh $(top_srcdir)/genmodsrc.sh [+ name +] $(top_builddir)/moddep.lst > $@ || (rm -f $@; exit 1)
mod-[+ name +].o: mod-[+ name +].c
$(TARGET_CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS_MODULE) $(CPPFLAGS) $(CFLAGS_MODULE) $(CFLAGS) -c -o $@ $<
[+ name +].mod: [+ name +].module mod-[+ name +].o
if test x$(USE_APPLE_CC_FIXES) = xyes; then \
$(CCLD) $(LDFLAGS_MODULE) $(LDFLAGS) -o $@.bin $^; \
$(OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -wd1106 -nu -nd $@.bin $@; \
rm -f $@.bin; \
else \
$(CCLD) -o $@ $(LDFLAGS_MODULE) $(LDFLAGS) $^; \
if test ! -z '$(TARGET_OBJ2ELF)'; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@; \
fi
command-[+ name +].lst: [+ name +].pp $(top_srcdir)/gencmdlist.sh
cat $< | sh $(top_srcdir)/gencmdlist.sh [+ name +] > $@ || (rm -f $@; exit 1)
fs-[+ name +].lst: [+ name +].pp $(top_srcdir)/genfslist.sh
cat $< | sh $(top_srcdir)/genfslist.sh [+ name +] > $@ || (rm -f $@; exit 1)
video-[+ name +].lst: [+ name +].pp $(top_srcdir)/genvideolist.sh
cat $< | sh $(top_srcdir)/genvideolist.sh [+ name +] > $@ || (rm -f $@; exit 1)
partmap-[+ name +].lst: [+ name +].pp $(top_srcdir)/genpartmaplist.sh
cat $< | sh $(top_srcdir)/genpartmaplist.sh [+ name +] > $@ || (rm -f $@; exit 1)
parttool-[+ name +].lst: [+ name +].pp $(top_srcdir)/genparttoollist.sh
cat $< | sh $(top_srcdir)/genparttoollist.sh [+ name +] > $@ || (rm -f $@; exit 1)
handler-[+ name +].lst: [+ name +].pp $(top_srcdir)/genhandlerlist.sh
cat $< | sh $(top_srcdir)/genhandlerlist.sh [+ name +] > $@ || (rm -f $@; exit 1)
terminal-[+ name +].lst: [+ name +].pp $(top_srcdir)/genterminallist.sh
cat $< | sh $(top_srcdir)/genterminallist.sh [+ name +] > $@ || (rm -f $@; exit 1)
"""
return r
def rule(target, source, cmd):
if cmd[0] == "\n":
return "\n" + target + ": " + source + cmd.replace("\n", "\n\t") + "\n"
else:
return "\n" + target + ": " + source + "\n\t" + cmd.replace("\n", "\n\t") + "\n"
def image_nostrip(platform):
return if_tag_defined("image_nostrip." + platform, lambda: rule("[+ name +].img", "[+ name +].exec", "cp $< $@"))
def image_strip(platform):
return if_tag_defined("image_strip." + platform, lambda: rule("[+ name +].img", "[+ name +].exec", "$(STRIP) -o $@ -R .rel.dyn -R .reginfo -R .note -R .comment $<"))
def image_strip_keep_kernel(platform):
return if_tag_defined("image_strip_keep_kernel." + platform, lambda: rule("[+ name +].img", "[+ name +].exec", "$(STRIP) -o $@ --strip-unneeded -K start -R .note -R .comment $<"))
def image_strip_macho2img(platform):
return if_tag_defined("image_strip_macho2img." + platform, lambda: rule("[+ name +].img", "[+ name +].exec", """
if test "x$(TARGET_APPLE_CC)" = x1; then \
$(MACHO2IMG) --bss $< $@ || exit 1; \
else \
$(STRIP) -o $@ -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< || exit 1; \
fi
"""))
def kernel(platform):
r = gvar_add("noinst_PROGRAMS", "[+ name +].exec")
r += var_set(canonical_kernel() + "_SOURCES", platform_sources(platform))
r += var_add(canonical_kernel() + "_SOURCES", shared_sources())
r += var_set("nodist_" + canonical_kernel() + "_SOURCES", platform_nodist_sources(platform) + "## platform nodist sources")
r += var_add("nodist_" + canonical_kernel() + "_SOURCES", shared_nodist_sources() + "## shared nodist sources")
r += var_set(canonical_kernel() + "_LDADD", platform_ldadd(platform))
r += var_set(canonical_kernel() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_KERNEL) " + platform_cflags(platform))
r += var_set(canonical_kernel() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_KERNEL) " + platform_ldflags(platform))
r += var_set(canonical_kernel() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) " + platform_cppflags(platform))
r += var_set(canonical_kernel() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_KERNEL) " + platform_ccasflags(platform))
r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_kernel() + "_SOURCES)")
r += gvar_add("CLEANFILES", "$(nodist_" + canonical_kernel() + "_SOURCES)")
r += gvar_add("platform_DATA", "[+ name +].img")
r += image_nostrip(platform)
r += image_strip(platform)
r += image_strip_keep_kernel(platform)
r += image_strip_macho2img(platform)
return r
def image(platform):
r = gvar_add("noinst_PROGRAMS", "[+ name +].image")
r += var_set(canonical_image() + "_SOURCES", platform_sources(platform))
r += var_add(canonical_image() + "_SOURCES", shared_sources())
r += var_set("nodist_" + canonical_image() + "_SOURCES", platform_nodist_sources(platform) + "## platform nodist sources")
r += var_add("nodist_" + canonical_image() + "_SOURCES", shared_nodist_sources() + "## shared nodist sources")
r += var_set(canonical_image() + "_LDADD", platform_ldadd(platform))
r += var_set(canonical_image() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_IMAGE) " + platform_cflags(platform))
r += var_set(canonical_image() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_IMAGE) " + platform_ldflags(platform))
r += var_set(canonical_image() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_IMAGE) " + platform_cppflags(platform))
r += var_set(canonical_image() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_IMAGE) " + platform_ccasflags(platform))
r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_image() + "_SOURCES)")
r += gvar_add("CLEANFILES", "$(nodist_" + canonical_image() + "_SOURCES)")
r += gvar_add("platform_DATA", "[+ name +].img")
r += rule("[+ name +].img", "[+ name +].image", """
if test x$(USE_APPLE_CC_FIXES) = xyes; then \
$(MACHO2IMG) $< $@; \
else \
$(OBJCOPY) -O """ + platform_format(platform) + """ --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@; \
fi
""")
return r
def library(platform):
r = gvar_add("noinst_LIBRARIES", "[+ name +]")
r += var_set(canonical_name() + "_SOURCES", platform_sources(platform))
r += var_add(canonical_name() + "_SOURCES", shared_sources())
r += var_set("nodist_" + canonical_name() + "_SOURCES", platform_nodist_sources(platform))
r += var_add("nodist_" + canonical_name() + "_SOURCES", shared_nodist_sources())
r += var_set(canonical_name() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_LIBRARY) " + platform_cflags(platform))
r += var_set(canonical_name() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_LIBRARY) " + platform_cppflags(platform))
r += var_set(canonical_name() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_LIBRARY) " + platform_ccasflags(platform))
r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_name() + "_SOURCES)")
r += gvar_add("CLEANFILES", "$(nodist_" + canonical_name() + "_SOURCES)")
return r
def installdir(default="bin"):
return "[+ IF installdir +][+ installdir +][+ ELSE +]" + default + "[+ ENDIF +]"
def manpage():
r = "if COND_MAN_PAGES\n"
r += "man_MANS += [+ name +].[+ mansection +]\n"
r += rule("[+ name +].[+ mansection +]", "", """
$(MAKE) $(AM_MAKEFLAGS) [+ name +]
chmod a+x [+ name +]
$(HELP2MAN) --section=[+ mansection +] -o $@ ./[+ name +]
""")
r += gvar_add("CLEANFILES", "[+ name +].[+ mansection +]")
r += "endif\n"
return r
def program(platform, test=False):
if test:
r = gvar_add("check_PROGRAMS", "[+ name +]")
else:
r = gvar_add(installdir() + "_PROGRAMS", "[+ name +]")
r += var_set(canonical_name() + "_SOURCES", platform_sources(platform))
r += var_add(canonical_name() + "_SOURCES", shared_sources())
r += var_set("nodist_" + canonical_name() + "_SOURCES", platform_nodist_sources(platform))
r += var_add("nodist_" + canonical_name() + "_SOURCES", shared_nodist_sources())
r += var_set(canonical_name() + "_LDADD", platform_ldadd(platform))
r += var_set(canonical_name() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_PROGRAM) " + platform_cflags(platform))
r += var_set(canonical_name() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_PROGRAM) " + platform_ldflags(platform))
r += var_set(canonical_name() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_PROGRAM) " + platform_cppflags(platform))
r += var_set(canonical_name() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_PROGRAM) " + platform_ccasflags(platform))
r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_name() + "_SOURCES)")
r += gvar_add("CLEANFILES", "$(nodist_" + canonical_name() + "_SOURCES)")
if test:
r += if_tag_defined("enable", lambda: gvar_add("TESTS", "[+ name +]"))
else:
r += if_tag("mansection", lambda: manpage())
return r
def test_program(platform):
return program(platform, True)
def data(platform):
return gvar_add(installdir() + "_DATA", platform_sources(platform))
def script(platform, test=False):
if test:
r = gvar_add("check_SCRIPTS", "[+ name +]")
else:
r = gvar_add(installdir() + "_SCRIPTS", "[+ name +]")
r += rule("[+ name +]", "$(top_builddir)/config.status " + platform_sources(platform), """
$(top_builddir)/config.status --file=-:""" + platform_sources(platform) + """ \
| sed -e 's,@pkglib_DATA@,$(pkglib_DATA),g' > $@
chmod a+x [+ name +]
""")
r += gvar_add("CLEANFILES", "[+ name +]")
r += gvar_add("EXTRA_DIST", platform_sources(platform))
if test:
r += if_tag_defined("enable", lambda: gvar_add("TESTS", "[+ name +]"))
else:
r += if_tag("mansection", lambda: manpage())
return r
def test_script(platform):
return script(platform, True)
def with_enable_condition(x):
return "[+ IF enable +]if [+ enable +]\n" + x + "endif\n[+ ELSE +]" + x + "[+ ENDIF +]"
def module_rules():
return for_tag("module", lambda: with_enable_condition(each_platform(lambda p: module(p))))
def kernel_rules():
return for_tag("kernel", lambda: with_enable_condition(each_platform(lambda p: kernel(p))))
def image_rules():
return for_tag("image", lambda: with_enable_condition(each_platform(lambda p: image(p))))
def library_rules():
return for_tag("library", lambda: with_enable_condition(each_platform(lambda p: library(p))))
def program_rules():
return for_tag("program", lambda: with_enable_condition(each_platform(lambda p: program(p))))
def script_rules():
return for_tag("script", lambda: with_enable_condition(each_platform(lambda p: script(p))))
def data_rules():
return for_tag("data", lambda: with_enable_condition(each_platform(lambda p: data(p))))
def test_program_rules():
return for_tag("test_program", lambda: with_enable_condition(each_platform(lambda p: test_program(p))))
def test_script_rules():
return for_tag("test_script", lambda: with_enable_condition(each_platform(lambda p: test_script(p))))
print "[+ AutoGen5 template +]\n"
a = module_rules()
b = kernel_rules()
c = image_rules()
d = library_rules()
e = program_rules()
f = script_rules()
g = data_rules()
h = test_program_rules()
i = test_script_rules()
z = global_variable_initializers()
print z # initializer for all vars
print a
print b
print c
print d
print e
print f
print g
print h
print i
print """.PRECIOUS: modules.am
$(srcdir)/modules.am: $(srcdir)/modules.def $(top_srcdir)/Makefile.tpl
autogen -T $(top_srcdir)/Makefile.tpl $(srcdir)/modules.def | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
mv $@.new $@
.PRECIOUS: $(top_srcdir)/Makefile.tpl
$(top_srcdir)/Makefile.tpl: $(top_srcdir)/gentpl.py
python $(top_srcdir)/gentpl.py | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
mv $@.new $@
"""

155
grub-core/Makefile.am Normal file
View file

@ -0,0 +1,155 @@
AUTOMAKE_OPTIONS = subdir-objects
SUBDIRS = po
DEPDIR = .deps-core
include $(top_srcdir)/Makefile.extra-dist
include $(top_srcdir)/Makefile.vars
LDADD_KERNEL = -lgcc
CFLAGS_KERNEL = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
LDFLAGS_KERNEL = $(TARGET_LDFLAGS) $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N -static-libgcc
CPPFLAGS_KERNEL = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
CCASFLAGS_KERNEL = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
CFLAGS_MODULE = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
LDFLAGS_MODULE = $(TARGET_LDFLAGS) $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N,-r,-d
CPPFLAGS_MODULE = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
CCASFLAGS_MODULE = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
CFLAGS_IMAGE = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -fno-builtin
LDFLAGS_IMAGE = $(TARGET_LDFLAGS) $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N,-S
CPPFLAGS_IMAGE = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
CCASFLAGS_IMAGE = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
CFLAGS_LIBRARY = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -fno-builtin
CPPFLAGS_LIBRARY = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
CCASFLAGS_LIBRARY = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
CFLAGS_PROGRAM = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM)
LDFLAGS_PROGRAM = $(TARGET_LDFLAGS) $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM)
CPPFLAGS_PROGRAM = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
CCASFLAGS_PROGRAM = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
AM_CFLAGS =
AM_LDFLAGS =
AM_CPPFLAGS = $(CPPFLAGS_GRUB) -DGRUB_FILE=\"$(subst $(top_srcdir)/,,$<)\"
AM_CCASFLAGS = -DASM_FILE=1
# gentrigtables
gentrigtables: $(top_srcdir)/gentrigtables.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(CPPFLAGS) -lm $<
CLEANFILES += gentrigtables
# trigtables.c
trigtables.c: gentrigtables.c configure.ac
$(MAKE) $(AM_MAKEFLAGS) gentrigtables
$(top_builddir)/gentrigtables > $@
CLEANFILES += trigtables.c
# XXX Use Automake's LEX & YACC support
# See Recording Dependencies Manually in automake doc for below rules
script/sh_module-lexer.$(OBJEXT):grub_script.tab.h
grub_script.tab.c grub_script.tab.h: $(top_srcdir)/script/parser.y
$(YACC) -d -p grub_script_yy -b grub_script $(top_srcdir)/script/parser.y
CLEANFILES += grub_script.tab.c grub_script.tab.h
# For the lexer.
# See Recording Dependencies Manually in automake doc for below rules
script/sh_module-lexer.$(OBJEXT):grub_script.yy.h
grub_script.yy.c grub_script.yy.h: $(top_srcdir)/script/yylex.l
$(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $(top_srcdir)/script/yylex.l
CLEANFILES += grub_script.yy.c grub_script.yy.h
include $(srcdir)/modules.am
include $(srcdir)/Makefile.kernel
# .lst files
platform_DATA += moddep.lst
platform_DATA += fs.lst
platform_DATA += command.lst
platform_DATA += partmap.lst
platform_DATA += handler.lst
platform_DATA += terminal.lst
platform_DATA += parttool.lst
platform_DATA += video.lst
platform_DATA += crypto.lst
CLEANFILES += moddep.lst
CLEANFILES += fs.lst
CLEANFILES += command.lst
CLEANFILES += partmap.lst
CLEANFILES += handler.lst
CLEANFILES += terminal.lst
CLEANFILES += parttool.lst
CLEANFILES += video.lst
CLEANFILES += crypto.lst
fs.lst: $(FS_FILES)
cat $^ /dev/null | sort | uniq > $@
command.lst: $(COMMAND_FILES)
cat $^ /dev/null | sort | uniq > $@
partmap.lst: $(PARTMAP_FILES)
cat $^ /dev/null | sort | uniq > $@
handler.lst: $(HANDLER_FILES)
cat $^ /dev/null | sort | uniq > $@
terminal.lst: $(TERMINAL_FILES)
cat $^ /dev/null | sort | uniq > $@
parttool.lst: $(PARTTOOL_FILES)
cat $^ /dev/null | sort | uniq > $@
video.lst: $(VIDEO_FILES)
cat $^ /dev/null | sort | uniq > $@
# but, crypto.lst is simply copied
crypto.lst: $(top_srcdir)/lib/libgcrypt-grub/cipher/crypto.lst
cp $^ $@
# generate global module dependencies list
moddep.lst: kernel_syms.lst genmoddep.awk $(DEF_FILES) $(UND_FILES)
cat $(DEF_FILES) kernel_syms.lst /dev/null \
| $(AWK) -f $(top_srcdir)/genmoddep.awk $(UND_FILES) > $@ \
|| (rm -f $@; exit 1)
if COND_i386_pc
if COND_ENABLE_EFIEMU
efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
-rm -f $@; \
if test "x$(TARGET_APPLE_CC)" = x1; then \
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF32 -DAPPLE_CC -m32 -Wall -Werror -nostdlib -O2 -c -o $@.bin $< || exit 1; \
$(OBJCONV) -felf32 -nu -nd $@.bin $@ || exit 1; \
rm -f $@.bin; \
else \
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF32 -m32 -Wall -Werror -nostdlib -O2 -c -o $@ $< || exit 1; \
if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
fi
efiemu64_c.o: efiemu/runtime/efiemu.c
if test "x$(TARGET_APPLE_CC)" = x1; then \
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF64 -DAPPLE_CC=1 -m64 -nostdlib -Wall -Werror -mno-red-zone -c -o $@ $< || exit 1; \
else \
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF64 -m64 -nostdlib -Wall -Werror -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \
fi
efiemu64_s.o: efiemu/runtime/efiemu.S
-rm -f $@
if test "x$(TARGET_APPLE_CC)" = x1; then \
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF64 -DAPPLE_CC=1 -m64 -Wall -Werror -nostdlib -O2 -mno-red-zone -c -o $@ $< || exit 1; \
else \
$(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF64 -m64 -Wall -Werror -nostdlib -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \
fi
efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELEF)
-rm -f $@; \
if test "x$(TARGET_APPLE_CC)" = x1; then \
rm -f $@.bin; \
$(TARGET_CC) -m64 -Wl,-r -nostdlib -o $@.bin $^ || exit 1; \
$(OBJCONV) -felf64 -nu -nd $@.bin $@ || exit 1; \
rm -f $@.bin; \
else \
$(TARGET_CC) -m64 -nostdlib -Wl,-r -o $@ $^ || exit 1; \
if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
fi
platform_DATA += efiemu32.o efiemu64.o
CLEANFILES += efiemu32.o efiemu64.o efiemu64_c.o efiemu64_s.o
endif
endif

View file

@ -0,0 +1,53 @@
#
# Extra files that need to be distributed (in .tar.gz) to build
# successfully on user site.
#
# XXX Remove wildcards; See 27.3 in automake.info
#
EXTRA_DIST =
EXTRA_DIST += gentpl.py
EXTRA_DIST += Makefile.tpl
EXTRA_DIST += modules.def
EXTRA_DIST += gentrigtables.c
EXTRA_DIST += genmoddep.awk
EXTRA_DIST += genmodsrc.sh
EXTRA_DIST += gensymlist.sh
EXTRA_DIST += genemuinit.sh
EXTRA_DIST += genemuinitheader.sh
EXTRA_DIST += genfslist.sh
EXTRA_DIST += gencmdlist.sh
EXTRA_DIST += genvideolist.sh
EXTRA_DIST += genhandlerlist.sh
EXTRA_DIST += genpartmaplist.sh
EXTRA_DIST += genparttoollist.sh
EXTRA_DIST += genterminallist.sh
EXTRA_DIST += lib/libgcrypt-grub/cipher/crypto.lst
EXTRA_DIST += script/yylex.l
EXTRA_DIST += script/parser.y
EXTRA_DIST += lib/relocator.c
EXTRA_DIST += efiemu/loadcore.c
EXTRA_DIST += efiemu/prepare.c
EXTRA_DIST += loader/machoXX.c
EXTRA_DIST += kern/i386/loader.S
EXTRA_DIST += kern/i386/realmode.S
EXTRA_DIST += loader/i386/bsdXX.c
EXTRA_DIST += loader/i386/bsd_pagetable.c
EXTRA_DIST += loader/i386/multiboot_elfxx.c
EXTRA_DIST += commands/search.c
EXTRA_DIST += kern/i386/pc/lzma_decode.S
EXTRA_DIST += $(shell find $(top_srcdir) -name '*.h')

192
grub-core/Makefile.kernel Normal file
View file

@ -0,0 +1,192 @@
# -*- makefile -*-
KERNEL_HEADER_FILES =
KERNEL_HEADER_FILES += include/grub/cache.h
KERNEL_HEADER_FILES += include/grub/command.h
KERNEL_HEADER_FILES += include/grub/device.h
KERNEL_HEADER_FILES += include/grub/disk.h
KERNEL_HEADER_FILES += include/grub/dl.h
KERNEL_HEADER_FILES += include/grub/elf.h
KERNEL_HEADER_FILES += include/grub/elfload.h
KERNEL_HEADER_FILES += include/grub/env.h
KERNEL_HEADER_FILES += include/grub/env_private.h
KERNEL_HEADER_FILES += include/grub/err.h
KERNEL_HEADER_FILES += include/grub/file.h
KERNEL_HEADER_FILES += include/grub/fs.h
KERNEL_HEADER_FILES += include/grub/handler.h
KERNEL_HEADER_FILES += include/grub/i18n.h
KERNEL_HEADER_FILES += include/grub/kernel.h
KERNEL_HEADER_FILES += include/grub/list.h
KERNEL_HEADER_FILES += include/grub/misc.h
KERNEL_HEADER_FILES += include/grub/mm.h
KERNEL_HEADER_FILES += include/grub/net.h
KERNEL_HEADER_FILES += include/grub/parser.h
KERNEL_HEADER_FILES += include/grub/partition.h
KERNEL_HEADER_FILES += include/grub/reader.h
KERNEL_HEADER_FILES += include/grub/symbol.h
KERNEL_HEADER_FILES += include/grub/term.h
KERNEL_HEADER_FILES += include/grub/time.h
KERNEL_HEADER_FILES += include/grub/types.h
if COND_i386_pc
KERNEL_HEADER_FILES += include/grub/boot.h
KERNEL_HEADER_FILES += include/grub/loader.h
KERNEL_HEADER_FILES += include/grub/msdos_partition.h
KERNEL_HEADER_FILES += include/grub/machine/biosdisk.h
KERNEL_HEADER_FILES += include/grub/machine/boot.h
KERNEL_HEADER_FILES += include/grub/machine/console.h
KERNEL_HEADER_FILES += include/grub/machine/memory.h
KERNEL_HEADER_FILES += include/grub/machine/loader.h
KERNEL_HEADER_FILES += include/grub/machine/vga.h
KERNEL_HEADER_FILES += include/grub/machine/vbe.h
KERNEL_HEADER_FILES += include/grub/machine/kernel.h
KERNEL_HEADER_FILES += include/grub/machine/pxe.h
KERNEL_HEADER_FILES += include/grub/i386/pit.h
endif
if COND_i386_efi
KERNEL_HEADER_FILES += include/grub/boot.h
KERNEL_HEADER_FILES += include/grub/loader.h
KERNEL_HEADER_FILES += include/grub/msdos_partition.h
KERNEL_HEADER_FILES += include/grub/efi/efi.h
KERNEL_HEADER_FILES += include/grub/efi/time.h
KERNEL_HEADER_FILES += include/grub/efi/disk.h
KERNEL_HEADER_FILES += include/grub/i386/pit.h
endif
if COND_i386_coreboot
KERNEL_HEADER_FILES += include/grub/boot.h
KERNEL_HEADER_FILES += include/grub/loader.h
KERNEL_HEADER_FILES += include/grub/msdos_partition.h
KERNEL_HEADER_FILES += include/grub/machine/boot.h
KERNEL_HEADER_FILES += include/grub/machine/console.h
KERNEL_HEADER_FILES += include/grub/machine/init.h
KERNEL_HEADER_FILES += include/grub/machine/memory.h
KERNEL_HEADER_FILES += include/grub/machine/loader.h
endif
if COND_i386_qemu
KERNEL_HEADER_FILES += include/grub/boot.h
KERNEL_HEADER_FILES += include/grub/loader.h
KERNEL_HEADER_FILES += include/grub/msdos_partition.h
KERNEL_HEADER_FILES += include/grub/machine/boot.h
KERNEL_HEADER_FILES += include/grub/machine/console.h
KERNEL_HEADER_FILES += include/grub/machine/init.h
KERNEL_HEADER_FILES += include/grub/machine/memory.h
KERNEL_HEADER_FILES += include/grub/machine/loader.h
endif
if COND_i386_ieee1275
KERNEL_HEADER_FILES += include/grub/loader.h
KERNEL_HEADER_FILES += include/grub/msdos_partition.h
KERNEL_HEADER_FILES += include/grub/ieee1275/ieee1275.h
KERNEL_HEADER_FILES += include/grub/machine/kernel.h
KERNEL_HEADER_FILES += include/grub/machine/loader.h
KERNEL_HEADER_FILES += include/grub/machine/memory.h
endif
if COND_x86_64_efi
KERNEL_HEADER_FILES += include/grub/boot.h
KERNEL_HEADER_FILES += include/grub/loader.h
KERNEL_HEADER_FILES += include/grub/msdos_partition.h
KERNEL_HEADER_FILES += include/grub/efi/efi.h
KERNEL_HEADER_FILES += include/grub/efi/time.h
KERNEL_HEADER_FILES += include/grub/efi/disk.h
KERNEL_HEADER_FILES += include/grub/machine/loader.h
KERNEL_HEADER_FILES += include/grub/i386/pit.h
endif
if COND_mips_yeeloong
KERNEL_HEADER_FILES += include/grub/boot.h
KERNEL_HEADER_FILES += include/grub/loader.h
KERNEL_HEADER_FILES += include/grub/msdos_partition.h
KERNEL_HEADER_FILES += include/grub/machine/kernel.h
KERNEL_HEADER_FILES += include/grub/machine/memory.h
KERNEL_HEADER_FILES += include/grub/cpu/cache.h
KERNEL_HEADER_FILES += include/grub/bitmap.h
KERNEL_HEADER_FILES += include/grub/video.h
KERNEL_HEADER_FILES += include/grub/gfxterm.h
KERNEL_HEADER_FILES += include/grub/font.h
KERNEL_HEADER_FILES += include/grub/bitmap_scale.h
KERNEL_HEADER_FILES += include/grub/bufio.h
KERNEL_HEADER_FILES += include/grub/pci.h
KERNEL_HEADER_FILES += include/grub/libgcc.h
endif
if COND_powerpc_ieee1275
KERNEL_HEADER_FILES += include/grub/boot.h
KERNEL_HEADER_FILES += include/grub/loader.h
KERNEL_HEADER_FILES += include/grub/msdos_partition.h
KERNEL_HEADER_FILES += include/grub/ieee1275/ieee1275.h
KERNEL_HEADER_FILES += include/grub/machine/kernel.h
KERNEL_HEADER_FILES += include/grub/libgcc.h
endif
if COND_sparc64_ieee1275
KERNEL_HEADER_FILES += include/grub/boot.h
KERNEL_HEADER_FILES += include/grub/loader.h
KERNEL_HEADER_FILES += include/grub/msdos_partition.h
KERNEL_HEADER_FILES += include/grub/libgcc.h
KERNEL_HEADER_FILES += include/grub/ieee1275/ieee1275.h
KERNEL_HEADER_FILES += include/grub/machine/kernel.h
KERNEL_HEADER_FILES += include/grub/sparc64/ieee1275/ieee1275.h
endif
if COND_emu
KERNEL_HEADER_FILES += include/grub/cpu/time.h
KERNEL_HEADER_FILES += include/grub/cpu/types.h
KERNEL_HEADER_FILES += include/grub/gzio.h
KERNEL_HEADER_FILES += include/grub/menu.h
KERNEL_HEADER_FILES += include/grub/datetime.h
KERNEL_HEADER_FILES += include/grub/emu/misc.h
if COND_GRUB_EMU_SDL
KERNEL_HEADER_FILES += include/grub/sdl.h
endif
if COND_GRUB_EMU_USB
KERNEL_HEADER_FILES += include/grub/libusb.h
endif
if COND_GRUB_EMU_PCI
KERNEL_HEADER_FILES += include/grub/libpciaccess.h
endif
endif
symlist.h: config.h $(KERNEL_HEADER_FILES)
@list='$^'; \
for p in $$list; do \
echo "#include <$$p>" >> $@ || (rm -f $@; exit 1); \
done
CLEANFILES += symlist.h
BUILT_SOURCES += symlist.h
symlist.c: symlist.h gensymlist.sh
$(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) -DGRUB_SYMBOL_GENERATOR=1 symlist.h > symlist.p || (rm -f symlist.p; exit 1)
cat symlist.p | /bin/sh $(srcdir)/gensymlist.sh config.h $(KERNEL_HEADER_FILES) >$@ || (rm -f $@; exit 1)
rm -f symlist.p
CLEANFILES += symlist.c
BUILT_SOURCES += symlist.c
noinst_DATA += kernel_syms.lst
kernel_syms.lst: $(KERNEL_HEADER_FILES) config.h
if grep "^#define HAVE_ASM_USCORE" config.h; then u="_"; else u=""; fi
$(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) $(CFLAGS) -DGRUB_SYMBOL_GENERATOR=1 $^ >kernel_syms.input
cat kernel_syms.input | grep -v '^#' | sed -n \
-e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/'"$$u"'\1 kernel/;p;}' \
-e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/'"$$u"'\1 kernel/;p;}' \
| sort -u >$@
rm -f kernel_syms.input
CLEANFILES += kernel_syms.lst
if COND_emu
kern/emu/grub_emu-main.$(OBJEXT):grub_emu_init.h
grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h
kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h
grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h
grub_emu_init.h: genemuinitheader.sh $(MOD_FILES)
rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinitheader.sh $(NM) > $@
CLEANFILES += grub_emu_init.h
grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES)
rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinit.sh $(NM) > $@
CLEANFILES += grub_emu_init.c
endif

80
grub-core/Makefile.vars Normal file
View file

@ -0,0 +1,80 @@
# -*- makefile -*-
# Platform specific options
if COND_i386_pc
CFLAGS_PLATFORM = -mrtd -mregparm=3
endif
if COND_i386_efi
LDFLAGS_PLATFORM = -melf_i386
endif
if COND_x86_64_efi
LDFLAGS_PLATFORM = -melf_x86_64
endif
if COND_i386_qemu
CFLAGS_PLATFORM = -mrtd -mregparm=3
endif
if COND_i386_coreboot
CFLAGS_PLATFORM = -mrtd -mregparm=3
endif
if COND_i386_ieee1275
CFLAGS_PLATFORM = -mrtd -mregparm=3
endif
if COND_mips_yeeloong
CFLAGS_PLATFORM = -march=mips3 -mexplicit-relocs -mflush-func=grub_cpu_flush_cache
CCASFLAGS_PLATFORM = -march=mips3
endif
if COND_sparc64_ieee1275
CFLAGS_PLATFORM = -mno-app-regs
LDFLAGS_PLATFORM = -melf64_sparc -mno-relax
endif
CPPFLAGS_GRUB = -I$(builddir) -I$(srcdir) -I$(top_builddir) -I$(top_srcdir)
CPPFLAGS_GRUB += -I$(top_srcdir)/include -I$(top_builddir)/include
CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers
CPPFLAGS_GCRY = -I$(top_srcdir)/lib/libgcrypt_wrap
CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -D_GL_UNUSED="__attribute__ ((unused))"
CPPFLAGS_GNULIB = -I$(top_srcdir)/gnulib
CFLAGS_MKISOFS = -Wno-all -Werror
CPPFLAGS_MKISOFS = -D_FILE_OFFSET_BITS=64 -I$(top_srcdir)/util/mkisofs/include
CFLAGS_POSIX = -fno-builtin
CPPFLAGS_POSIX = -I$(top_srcdir)/lib/posix_wrap
CPPFLAGS_EFIEMU = -I$(top_srcdir)/efiemu/runtime
grubconfdir = $(sysconfdir)/grub.d
platformdir = $(pkglibdir)/$(target_cpu)-$(platform)
# to calm down automake
BUILT_SOURCES =
CLEANFILES =
COMMAND_FILES =
DEF_FILES =
FS_FILES =
HANDLER_FILES =
IMG_FILES =
MOD_FILES =
MODULE_FILES =
PARTMAP_FILES =
PARTTOOL_FILES =
TERMINAL_FILES =
TESTS =
UND_FILES =
VIDEO_FILES =
bin_PROGRAMS =
bin_SCRIPTS =
check_PROGRAMS =
check_SCRIPTS =
grubconf_DATA =
grubconf_SCRIPTS =
man_MANS =
noinst_DATA =
noinst_LIBRARIES =
noinst_PROGRAMS =
pkglib_SCRIPTS =
platform_DATA =
sbin_PROGRAMS =
sbin_SCRIPTS =

View file

@ -19,6 +19,7 @@
#include <grub/pci.h>
#include <grub/dl.h>
#include <grub/emu/misc.h>
#include <grub/util/misc.h>
grub_pci_address_t

View file

@ -175,7 +175,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
}
/* Load modules. */
#if !GRUB_NO_MODULES
#if defined(GRUB_MACHINE_EMU)
{
const char *prefix;
prefix = grub_env_get ("prefix");

Some files were not shown because too many files have changed in this diff Show more