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

6b3c76
From 6ae39452bb18fc5004f9d2bd8041a706e2532916 Mon Sep 17 00:00:00 2001
a85e8e
From: Andrey Borzenkov <arvidjaar@gmail.com>
a85e8e
Date: Sat, 18 Jan 2014 20:41:24 +0400
6b3c76
Subject: [PATCH 026/261] add BUILD_EXEEXT support to fix make clean on Windows
a85e8e
a85e8e
Add $(BUILD_EXEEXT) to ensure files are removed. Also add CLEANFILES where
a85e8e
appropriate.
a85e8e
---
d41074
 ChangeLog             |  7 +++++++
6b3c76
 Makefile.am           | 16 ++++++++--------
6b3c76
 Makefile.util.def     |  2 +-
6b3c76
 configure.ac          | 21 ++++++++++++++++-----
a85e8e
 grub-core/Makefile.am | 14 ++++++++------
a85e8e
 5 files changed, 40 insertions(+), 20 deletions(-)
a85e8e
6b3c76
diff --git a/ChangeLog b/ChangeLog
6b3c76
index 5aac7c1d8..dad2da2fa 100644
6b3c76
--- a/ChangeLog
6b3c76
+++ b/ChangeLog
6b3c76
@@ -1,5 +1,12 @@
6b3c76
 2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
6b3c76
 
6b3c76
+	* configure.ac: Add support for BUILD_EXEEXT and use it ...
6b3c76
+	* Makefile.am: ... here.
6b3c76
+	* Makefile.util.def: ... and here.
6b3c76
+	* grub-core/Makefile.am: ... and here.
6b3c76
+
6b3c76
+2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
6b3c76
+
6b3c76
 	* include/grub/osdep/hostfile_windows.h: Use _W64 instead of
6b3c76
 	FILE_OFFSET_BITS to differentiate between native MinGW and Mingw W64.
6b3c76
 
6b3c76
diff --git a/Makefile.am b/Makefile.am
6b3c76
index 1bbec0e79..aa526f573 100644
6b3c76
--- a/Makefile.am
6b3c76
+++ b/Makefile.am
6b3c76
@@ -66,22 +66,22 @@ endif
6b3c76
 
6b3c76
 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
6b3c76
 
6b3c76
-build-grub-mkfont: util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c
6b3c76
+build-grub-mkfont$(BUILD_EXEEXT): util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c
6b3c76
 	$(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)
6b3c76
-CLEANFILES += build-grub-mkfont
6b3c76
+CLEANFILES += build-grub-mkfont$(BUILD_EXEEXT)
6b3c76
 
6b3c76
-garbage-gen: util/garbage-gen.c
6b3c76
+garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c
6b3c76
 	$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS)  $^
6b3c76
-CLEANFILES += garbage-gen
6b3c76
+CLEANFILES += garbage-gen$(BUILD_EXEEXT)
6b3c76
 EXTRA_DIST += util/garbage-gen.c
6b3c76
 
6b3c76
-build-grub-gen-asciih: util/grub-gen-asciih.c
6b3c76
+build-grub-gen-asciih$(BUILD_EXEEXT): util/grub-gen-asciih.c
6b3c76
 	$(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
6b3c76
-CLEANFILES += build-grub-gen-asciih
6b3c76
+CLEANFILES += build-grub-gen-asciih$(BUILD_EXEEXT)
6b3c76
 
6b3c76
-build-grub-gen-widthspec: util/grub-gen-widthspec.c
6b3c76
+build-grub-gen-widthspec$(BUILD_EXEEXT): util/grub-gen-widthspec.c
6b3c76
 	$(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
6b3c76
-CLEANFILES += build-grub-gen-widthspec
6b3c76
+CLEANFILES += build-grub-gen-widthspec$(BUILD_EXEEXT)
6b3c76
 
6b3c76
 if COND_STARFIELD
6b3c76
 starfield_DATA = dejavu_10.pf2 dejavu_12.pf2 dejavu_bold_14.pf2 dejavu_14.pf2 dejavu_16.pf2 $(starfield_theme_files)
6b3c76
diff --git a/Makefile.util.def b/Makefile.util.def
6b3c76
index 3c99be2b0..83df212f4 100644
6b3c76
--- a/Makefile.util.def
6b3c76
+++ b/Makefile.util.def
6b3c76
@@ -708,7 +708,7 @@ script = {
6b3c76
   name = grub-fs-tester;
6b3c76
   common = tests/util/grub-fs-tester.in;
6b3c76
   installdir = noinst;
6b3c76
-  dependencies = garbage-gen;
6b3c76
+  dependencies = 'garbage-gen$(BUILD_EXEEXT)';
6b3c76
 };
6b3c76
 
6b3c76
 script = {
a85e8e
diff --git a/configure.ac b/configure.ac
6b3c76
index 2e4cf3c2e..cf3de3be1 100644
a85e8e
--- a/configure.ac
a85e8e
+++ b/configure.ac
a85e8e
@@ -38,7 +38,8 @@ AC_CONFIG_AUX_DIR([build-aux])
a85e8e
 # We don't want -g -O2 by default in CFLAGS
a85e8e
 : ${CFLAGS=""}
a85e8e
 
a85e8e
-# Checks for host and target systems.
a85e8e
+# Checks for build, host and target systems.
a85e8e
+AC_CANONICAL_BUILD
a85e8e
 AC_CANONICAL_HOST
a85e8e
 save_program_prefix="${program_prefix}"
a85e8e
 AC_CANONICAL_TARGET
a85e8e
@@ -422,6 +423,16 @@ case "$build_os" in
a85e8e
   haiku*)				BUILD_LIBM= ;;
a85e8e
   *) 					BUILD_LIBM=-lm ;;
a85e8e
 esac
a85e8e
+
a85e8e
+dnl FIXME proper test seems to require too deep dive into Autoconf internals.
a85e8e
+dnl For now just list known platforms that we support.
a85e8e
+
a85e8e
+case "$build_os" in
a85e8e
+  cygwin*|mingw32*|mingw64*)		BUILD_EXEEXT=.exe ;;
a85e8e
+  *)					BUILD_EXEEXT= ;;
a85e8e
+esac
a85e8e
+AC_SUBST(BUILD_EXEEXT)
a85e8e
+
a85e8e
 # For gnulib.
a85e8e
 gl_INIT
a85e8e
 
a85e8e
@@ -765,11 +776,11 @@ if test x"$platform" = xemu ; then
a85e8e
     *windows* | *cygwin* | *mingw*)
a85e8e
       if test x${target_cpu} = xi386 ; then
a85e8e
         grub_cv_target_cc_link_format=-mi386pe;
a85e8e
-	TARGET_OBJ2ELF='./build-grub-pe2elf';
a85e8e
+	TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)';
a85e8e
       fi
a85e8e
       if test x${target_cpu} = xx86_64 ; then
a85e8e
         grub_cv_target_cc_link_format=-mi386pep;
a85e8e
-	TARGET_OBJ2ELF='./build-grub-pep2elf';
a85e8e
+	TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)';
a85e8e
       fi
a85e8e
       TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
a85e8e
       ;;
a85e8e
@@ -803,10 +814,10 @@ elif test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
a85e8e
   fi
a85e8e
   TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
a85e8e
   if test x"$grub_cv_target_cc_link_format" = x-mi386pe ; then
a85e8e
-    TARGET_OBJ2ELF='./build-grub-pe2elf';
a85e8e
+    TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)';
a85e8e
   fi
a85e8e
   if test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then
a85e8e
-    TARGET_OBJ2ELF='./build-grub-pep2elf';
a85e8e
+    TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)';
a85e8e
   fi
a85e8e
 fi
a85e8e
 
a85e8e
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
6b3c76
index 13b797910..826b3dd7c 100644
a85e8e
--- a/grub-core/Makefile.am
a85e8e
+++ b/grub-core/Makefile.am
a85e8e
@@ -26,20 +26,22 @@ CFLAGS_LIBRARY += $(CFLAGS_PLATFORM) -fno-builtin
a85e8e
 CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM)
a85e8e
 CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM)
a85e8e
 
a85e8e
-build-grub-pep2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
a85e8e
+build-grub-pep2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
a85e8e
 	$(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\" $^
a85e8e
+CLEANFILES += build-grub-pep2elf$(BUILD_EXEEXT)
a85e8e
 
a85e8e
-build-grub-pe2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
a85e8e
+build-grub-pe2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
a85e8e
 	$(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\" $^
a85e8e
+CLEANFILES += build-grub-pe2elf$(BUILD_EXEEXT)
a85e8e
 
a85e8e
 # gentrigtables
a85e8e
-gentrigtables: gentrigtables.c
a85e8e
+gentrigtables$(BUILD_EXEEXT): gentrigtables.c
a85e8e
 	$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $< $(BUILD_LIBM)
a85e8e
-CLEANFILES += gentrigtables
a85e8e
+CLEANFILES += gentrigtables$(BUILD_EXEEXT)
a85e8e
 
a85e8e
 # trigtables.c
a85e8e
-trigtables.c: gentrigtables gentrigtables.c $(top_srcdir)/configure.ac
a85e8e
-	./gentrigtables > $@
a85e8e
+trigtables.c: gentrigtables$(BUILD_EXEEXT) gentrigtables.c $(top_srcdir)/configure.ac
a85e8e
+	./gentrigtables$(BUILD_EXEEXT) > $@
a85e8e
 CLEANFILES += trigtables.c
a85e8e
 
a85e8e
 # XXX Use Automake's LEX & YACC support
6b3c76
-- 
6b3c76
2.13.5
6b3c76