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

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