nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0026-add-BUILD_EXEEXT-support-to-fix-make-clean-on-Window.patch

0dc71c
From 5ac7afd762d11b4c91d5756222c3abf5862203de Mon Sep 17 00:00:00 2001
0dc71c
From: Andrey Borzenkov <arvidjaar@gmail.com>
0dc71c
Date: Sat, 18 Jan 2014 20:41:24 +0400
0dc71c
Subject: [PATCH 026/143] add BUILD_EXEEXT support to fix make clean on Windows
0dc71c
0dc71c
Add $(BUILD_EXEEXT) to ensure files are removed. Also add CLEANFILES where
0dc71c
appropriate.
0dc71c
---
0dc71c
 ChangeLog             |  7 +++++++
0dc71c
 Makefile.am           | 16 ++++++++--------
0dc71c
 Makefile.util.def     |  2 +-
0dc71c
 configure.ac          | 21 ++++++++++++++++-----
0dc71c
 grub-core/Makefile.am | 14 ++++++++------
0dc71c
 5 files changed, 40 insertions(+), 20 deletions(-)
0dc71c
0dc71c
diff --git a/ChangeLog b/ChangeLog
0dc71c
index 5aac7c1..dad2da2 100644
0dc71c
--- a/ChangeLog
0dc71c
+++ b/ChangeLog
0dc71c
@@ -1,5 +1,12 @@
0dc71c
 2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
0dc71c
 
0dc71c
+	* configure.ac: Add support for BUILD_EXEEXT and use it ...
0dc71c
+	* Makefile.am: ... here.
0dc71c
+	* Makefile.util.def: ... and here.
0dc71c
+	* grub-core/Makefile.am: ... and here.
0dc71c
+
0dc71c
+2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
0dc71c
+
0dc71c
 	* include/grub/osdep/hostfile_windows.h: Use _W64 instead of
0dc71c
 	FILE_OFFSET_BITS to differentiate between native MinGW and Mingw W64.
0dc71c
 
0dc71c
diff --git a/Makefile.am b/Makefile.am
0dc71c
index 1bbec0e..aa526f5 100644
0dc71c
--- a/Makefile.am
0dc71c
+++ b/Makefile.am
0dc71c
@@ -66,22 +66,22 @@ endif
0dc71c
 
0dc71c
 starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png $(srcdir)/themes/starfield/boot_menu_c.png $(srcdir)/themes/starfield/boot_menu_e.png $(srcdir)/themes/starfield/boot_menu_ne.png $(srcdir)/themes/starfield/boot_menu_n.png $(srcdir)/themes/starfield/boot_menu_nw.png $(srcdir)/themes/starfield/boot_menu_se.png $(srcdir)/themes/starfield/boot_menu_s.png $(srcdir)/themes/starfield/boot_menu_sw.png $(srcdir)/themes/starfield/boot_menu_w.png $(srcdir)/themes/starfield/slider_c.png $(srcdir)/themes/starfield/slider_n.png $(srcdir)/themes/starfield/slider_s.png $(srcdir)/themes/starfield/starfield.png $(srcdir)/themes/starfield/terminal_box_c.png $(srcdir)/themes/starfield/terminal_box_e.png $(srcdir)/themes/starfield/terminal_box_ne.png $(srcdir)/themes/starfield/terminal_box_n.png $(srcdir)/themes/starfield/terminal_box_nw.png $(srcdir)/themes/starfield/terminal_box_se.png $(srcdir)/themes/starfield/terminal_box_s.png $(srcdir)/themes/starfield/terminal_box_sw.png $(srcdir)/themes/starfield/terminal_box_w.png $(srcdir)/themes/starfield/theme.txt $(srcdir)/themes/starfield/README $(srcdir)/themes/starfield/COPYING.CC-BY-SA-3.0
0dc71c
 
0dc71c
-build-grub-mkfont: util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c
0dc71c
+build-grub-mkfont$(BUILD_EXEEXT): util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c
0dc71c
 	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs)
0dc71c
-CLEANFILES += build-grub-mkfont
0dc71c
+CLEANFILES += build-grub-mkfont$(BUILD_EXEEXT)
0dc71c
 
0dc71c
-garbage-gen: util/garbage-gen.c
0dc71c
+garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c
0dc71c
 	$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS)  $^
0dc71c
-CLEANFILES += garbage-gen
0dc71c
+CLEANFILES += garbage-gen$(BUILD_EXEEXT)
0dc71c
 EXTRA_DIST += util/garbage-gen.c
0dc71c
 
0dc71c
-build-grub-gen-asciih: util/grub-gen-asciih.c
0dc71c
+build-grub-gen-asciih$(BUILD_EXEEXT): util/grub-gen-asciih.c
0dc71c
 	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
0dc71c
-CLEANFILES += build-grub-gen-asciih
0dc71c
+CLEANFILES += build-grub-gen-asciih$(BUILD_EXEEXT)
0dc71c
 
0dc71c
-build-grub-gen-widthspec: util/grub-gen-widthspec.c
0dc71c
+build-grub-gen-widthspec$(BUILD_EXEEXT): util/grub-gen-widthspec.c
0dc71c
 	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
0dc71c
-CLEANFILES += build-grub-gen-widthspec
0dc71c
+CLEANFILES += build-grub-gen-widthspec$(BUILD_EXEEXT)
0dc71c
 
0dc71c
 if COND_STARFIELD
0dc71c
 starfield_DATA = dejavu_10.pf2 dejavu_12.pf2 dejavu_bold_14.pf2 dejavu_14.pf2 dejavu_16.pf2 $(starfield_theme_files)
0dc71c
diff --git a/Makefile.util.def b/Makefile.util.def
0dc71c
index 3c99be2..83df212 100644
0dc71c
--- a/Makefile.util.def
0dc71c
+++ b/Makefile.util.def
0dc71c
@@ -708,7 +708,7 @@ script = {
0dc71c
   name = grub-fs-tester;
0dc71c
   common = tests/util/grub-fs-tester.in;
0dc71c
   installdir = noinst;
0dc71c
-  dependencies = garbage-gen;
0dc71c
+  dependencies = 'garbage-gen$(BUILD_EXEEXT)';
0dc71c
 };
0dc71c
 
0dc71c
 script = {
0dc71c
diff --git a/configure.ac b/configure.ac
0dc71c
index 2e4cf3c..cf3de3b 100644
0dc71c
--- a/configure.ac
0dc71c
+++ b/configure.ac
0dc71c
@@ -38,7 +38,8 @@ AC_CONFIG_AUX_DIR([build-aux])
0dc71c
 # We don't want -g -O2 by default in CFLAGS
0dc71c
 : ${CFLAGS=""}
0dc71c
 
0dc71c
-# Checks for host and target systems.
0dc71c
+# Checks for build, host and target systems.
0dc71c
+AC_CANONICAL_BUILD
0dc71c
 AC_CANONICAL_HOST
0dc71c
 save_program_prefix="${program_prefix}"
0dc71c
 AC_CANONICAL_TARGET
0dc71c
@@ -422,6 +423,16 @@ case "$build_os" in
0dc71c
   haiku*)				BUILD_LIBM= ;;
0dc71c
   *) 					BUILD_LIBM=-lm ;;
0dc71c
 esac
0dc71c
+
0dc71c
+dnl FIXME proper test seems to require too deep dive into Autoconf internals.
0dc71c
+dnl For now just list known platforms that we support.
0dc71c
+
0dc71c
+case "$build_os" in
0dc71c
+  cygwin*|mingw32*|mingw64*)		BUILD_EXEEXT=.exe ;;
0dc71c
+  *)					BUILD_EXEEXT= ;;
0dc71c
+esac
0dc71c
+AC_SUBST(BUILD_EXEEXT)
0dc71c
+
0dc71c
 # For gnulib.
0dc71c
 gl_INIT
0dc71c
 
0dc71c
@@ -765,11 +776,11 @@ if test x"$platform" = xemu ; then
0dc71c
     *windows* | *cygwin* | *mingw*)
0dc71c
       if test x${target_cpu} = xi386 ; then
0dc71c
         grub_cv_target_cc_link_format=-mi386pe;
0dc71c
-	TARGET_OBJ2ELF='./build-grub-pe2elf';
0dc71c
+	TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)';
0dc71c
       fi
0dc71c
       if test x${target_cpu} = xx86_64 ; then
0dc71c
         grub_cv_target_cc_link_format=-mi386pep;
0dc71c
-	TARGET_OBJ2ELF='./build-grub-pep2elf';
0dc71c
+	TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)';
0dc71c
       fi
0dc71c
       TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
0dc71c
       ;;
0dc71c
@@ -803,10 +814,10 @@ elif test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
0dc71c
   fi
0dc71c
   TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
0dc71c
   if test x"$grub_cv_target_cc_link_format" = x-mi386pe ; then
0dc71c
-    TARGET_OBJ2ELF='./build-grub-pe2elf';
0dc71c
+    TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)';
0dc71c
   fi
0dc71c
   if test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then
0dc71c
-    TARGET_OBJ2ELF='./build-grub-pep2elf';
0dc71c
+    TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)';
0dc71c
   fi
0dc71c
 fi
0dc71c
 
0dc71c
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
0dc71c
index 13b7979..826b3dd 100644
0dc71c
--- a/grub-core/Makefile.am
0dc71c
+++ b/grub-core/Makefile.am
0dc71c
@@ -26,20 +26,22 @@ CFLAGS_LIBRARY += $(CFLAGS_PLATFORM) -fno-builtin
0dc71c
 CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM)
0dc71c
 CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM)
0dc71c
 
0dc71c
-build-grub-pep2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
0dc71c
+build-grub-pep2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
0dc71c
 	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=64 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pep2elf\" $^
0dc71c
+CLEANFILES += build-grub-pep2elf$(BUILD_EXEEXT)
0dc71c
 
0dc71c
-build-grub-pe2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
0dc71c
+build-grub-pe2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
0dc71c
 	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=32 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pe2elf\" $^
0dc71c
+CLEANFILES += build-grub-pe2elf$(BUILD_EXEEXT)
0dc71c
 
0dc71c
 # gentrigtables
0dc71c
-gentrigtables: gentrigtables.c
0dc71c
+gentrigtables$(BUILD_EXEEXT): gentrigtables.c
0dc71c
 	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $< $(BUILD_LIBM)
0dc71c
-CLEANFILES += gentrigtables
0dc71c
+CLEANFILES += gentrigtables$(BUILD_EXEEXT)
0dc71c
 
0dc71c
 # trigtables.c
0dc71c
-trigtables.c: gentrigtables gentrigtables.c $(top_srcdir)/configure.ac
0dc71c
-	./gentrigtables > $@
0dc71c
+trigtables.c: gentrigtables$(BUILD_EXEEXT) gentrigtables.c $(top_srcdir)/configure.ac
0dc71c
+	./gentrigtables$(BUILD_EXEEXT) > $@
0dc71c
 CLEANFILES += trigtables.c
0dc71c
 
0dc71c
 # XXX Use Automake's LEX & YACC support
0dc71c
-- 
0dc71c
1.9.3
0dc71c