grub/Makefile.in
bean 2a8a80e4f4 2008-07-24 Bean <bean123ch@gmail.com>
* common.rmk (bin_UTILITIES): Add grub-pe2elf.
	(grub_pe2elf_SOURCES): New macro.
	(CLEANFILES): Add grub-pe2elf.

	* include/grub/efi/pe32.h (GRUB_PE32_SCN_ALIGN_1BYTES): New constant.
	(GRUB_PE32_SCN_ALIGN_2BYTES): Likewise.
	(GRUB_PE32_SCN_ALIGN_4BYTES): Likewise.
	(GRUB_PE32_SCN_ALIGN_8BYTES): Likewise.
	(GRUB_PE32_SCN_ALIGN_16BYTES): Likewise.
	(GRUB_PE32_SCN_ALIGN_32BYTES): Likewise.
	(GRUB_PE32_SCN_ALIGN_64BYTES): Likewise.
	(GRUB_PE32_SCN_ALIGN_SHIFT): Likewise.
	(GRUB_PE32_SCN_ALIGN_MASK): Likewise.
	(GRUB_PE32_SYM_CLASS_EXTERNAL): Likewise.
	(GRUB_PE32_SYM_CLASS_STATIC): Likewise.
	(GRUB_PE32_SYM_CLASS_FILE): Likewise.
	(GRUB_PE32_DT_FUNCTION): Likewise.
	(GRUB_PE32_REL_I386_DIR32): Likewise.
	(GRUB_PE32_REL_I386_REL32): Likewise.
	(grub_pe32_symbol): New structure.
	(grub_pe32_reloc): Likewise.

	* util/grub-pe2elf.c: New file.

	* configure.ac: Set TARGET_OBJ2ELF if host os is cygwin. Don't test for
	start symbol in non pc platform.

	* genmk.rb: Use TARGET_OBJ2ELF to convert native object format to elf.

	The following patches are from Christian Franke.

	* include/grub/dl.h: Remove .previous, gas supports this only
	for ELF format.

	* include/grub/symbol.h [__CYGWIN__] (#define FUNCTION/VARIABLE):
	Remove .type, gas supports this only for ELF format.

	* kern/dl.c (grub_dl_resolve_dependencies): Add check for trailing
	nullbytes in symbol table. This fixes an infinite loop if table is
	zero filled.

	* Makefile.in: Add autoconf replacements TARGET_IMG_LDSCRIPT,
	TARGET_IMG_LDFLAGS and EXEEXT.

	* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): Replace -Wl,-N by
	TARGET_IMG_LDFLAGS_AC.
	(grub_CHECK_STACK_ARG_PROBE): New function.

	* conf/i386-pc.rmk: Replace -Wl,-N by TARGET_IMG_LDFLAGS.

	* conf/i386-pc-cygwin-ld-img.sc: New linker script.

	* configure.ac: Add check for linker script "conf/${target}-img-ld.c"
	to set TARGET_IMG_LD* accordingly.
	Add check for Cygwin to set TARGET_MOD_OBJCOPY accordingly.
	Add call to grub_CHECK_STACK_ARG_PROBE.
	Use TARGET_IMG_LDFLAGS to check start, bss_start, end symbols.

	* genkernsyms.sh.in: Handle HAVE_ASM_USCORE case.

	* genmk.rb: Add EXEEXT to CLEANFILES.
2008-07-24 14:56:30 +00:00

353 lines
11 KiB
Makefile

# -*- makefile -*-
#
# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007 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@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
pkgdatadir = $(datadir)/`echo @PACKAGE_TARNAME@ | sed '$(transform)'`
pkglibdir = $(libdir)/`echo @PACKAGE_TARNAME@/$(target_cpu)-$(platform) | sed '$(transform)'`
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
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@
mkinstalldirs = $(srcdir)/mkinstalldirs
CC = @CC@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
CPPFLAGS = @CPPFLAGS@ -I. -Iinclude -I$(srcdir)/include -Wall -W \
-DGRUB_LIBDIR=\"$(pkglibdir)\"
TARGET_CC = @TARGET_CC@
TARGET_CFLAGS = @TARGET_CFLAGS@
TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I. -Iinclude -I$(srcdir)/include \
-Wall -W
TARGET_LDFLAGS = @TARGET_LDFLAGS@
TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@
TARGET_IMG_LDFLAGS = @TARGET_IMG_LDFLAGS@
TARGET_OBJ2ELF = @TARGET_OBJ2ELF@
MODULE_LDFLAGS = @MODULE_LDFLAGS@
EXEEXT = @EXEEXT@
OBJCOPY = @OBJCOPY@
STRIP = @STRIP@
NM = @NM@
RUBY = @RUBY@
HELP2MAN = @HELP2MAN@
ifeq (, $(HELP2MAN))
HELP2MAN = true
else
HELP2MAN := LANG=C $(HELP2MAN) --no-info --source=FSF
endif
AWK = @AWK@
LIBCURSES = @LIBCURSES@
LIBLZO = @LIBLZO@
YACC = @YACC@
UNIFONT_HEX = @UNIFONT_HEX@
# Options.
enable_grub_emu = @enable_grub_emu@
enable_grub_fstest = @enable_grub_fstest@
enable_lzo = @enable_lzo@
### General variables.
RMKFILES = $(addprefix conf/,common.rmk i386-pc.rmk powerpc-ieee1275.rmk \
sparc64-ieee1275.rmk i386-efi.rmk i386-ieee1275.rmk i386-coreboot.rmk)
MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES))
PKGLIB = $(pkglib_IMAGES) $(pkglib_MODULES) $(pkglib_PROGRAMS) \
$(pkglib_DATA) $(lib_DATA)
PKGDATA = $(pkgdata_DATA)
PROGRAMS = $(bin_UTILITIES) $(sbin_UTILITIES)
SCRIPTS = $(bin_SCRIPTS) $(sbin_SCRIPTS) $(update-grub_SCRIPTS)
CLEANFILES =
MOSTLYCLEANFILES =
DISTCLEANFILES = config.status config.cache config.log config.h \
Makefile stamp-h include/grub/cpu include/grub/machine \
gensymlist.sh genkernsyms.sh
MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix $(srcdir)/,$(MKFILES))
# 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
include $(srcdir)/conf/$(target_cpu)-$(platform).mk
### General targets.
CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA)
pkglib_DATA += moddep.lst command.lst fs.lst partmap.lst
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 > $@
ifeq (, $(UNIFONT_HEX))
else
pkgdata_DATA += unicode.pff ascii.pff
# Arrows and lines are needed to draw the menu, so we always include them
UNICODE_ARROWS=0x2190-0x2193
UNICODE_LINES=0x2501-0x251B
unicode.pff: $(UNIFONT_HEX)
ruby $(srcdir)/util/unifont2pff.rb $(UNIFONT_HEX) > $@
ascii.pff: $(UNIFONT_HEX)
ruby $(srcdir)/util/unifont2pff.rb 0x0-0x7f $(UNICODE_ARROWS) $(UNICODE_LINES) $(UNIFONT_HEX) > $@
endif
all-local: $(PROGRAMS) $(PKGLIB) $(PKGDATA) $(SCRIPTS) $(MKFILES)
install: install-local
install-local: all
$(mkinstalldirs) $(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
$(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
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
@list='$(bin_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)$(bindir)/$$dest; \
$(HELP2MAN) --section=1 $(builddir)/$$file > $(DESTDIR)$(mandir)/man1/$$dest.1; \
done
$(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 $(builddir)/$$file > $(DESTDIR)$(mandir)/man8/$$dest.8; \
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 $(builddir)/$$file > $(DESTDIR)$(mandir)/man1/$$dest.1; \
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 $(builddir)/$$file > $(DESTDIR)$(mandir)/man8/$$dest.8; \
done
$(mkinstalldirs) $(DESTDIR)$(sysconfdir)/grub.d
@list='$(update-grub_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='$(update-grub_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
$(mkinstalldirs) $(DESTDIR)$(libdir)/grub
@list='$(lib_DATA)'; \
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
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)'; for file in $$list; do \
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
rm -f $(DESTDIR)$(bindir)/$$dest; \
done
@list='$(sbin_UTILITIES) $(sbin_SCRIPTS)'; for file in $$list; do \
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
rm -f $(DESTDIR)$(sbindir)/$$dest; \
done
@list='$(update-grub_SCRIPTS) $(update-grub_DATA)'; for file in $$list; do \
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
rm -f $(DESTDIR)$(sysconfdir)/grub.d/$$dest; \
done
clean:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
mostlyclean: clean
-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)
info:
dvi:
distdir=$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
DISTLIST: gendistlist.sh
sh $(srcdir)/gendistlist.sh > $(srcdir)/DISTLIST
distdir: DISTLIST
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
$(mkinstalldirs) $(distdir)
for i in `cat $(srcdir)/DISTLIST`; do \
dir=`echo "$$i" | sed 's:/[^/]*$$::'`; \
if test -d $(srcdir)/$$dir; then \
$(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 \
&& ../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:
.SUFFIX:
.SUFFIX: .c .o .S .d
# Regenerate configure and Makefile automatically.
$(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
./config.status
Makefile: Makefile.in config.status
./config.status
config.status: configure
./config.status --recheck
gensymlist.sh: gensymlist.sh.in config.status
./config.status
genkernsyms.sh: genkernsyms.sh.in config.status
./config.status
.PHONY: all install install-strip uninstall clean mostlyclean distclean
.PHONY: maintainer-clean info dvi dist check
# Prevent an overflow.
.NOEXPORT:
.DELETE_ON_ERROR: