add BUILD_EXEEXT support to fix make clean on Windows

Add $(BUILD_EXEEXT) to ensure files are removed. Also add CLEANFILES where
appropriate.
This commit is contained in:
Andrey Borzenkov 2014-01-18 20:41:24 +04:00
parent 5ef569df5b
commit 1ecf96fcc4
5 changed files with 40 additions and 20 deletions

View file

@ -1,3 +1,10 @@
2014-01-18 Andrey Borzenkov <arvidjaar@gmail.com>
* configure.ac: Add support for BUILD_EXEEXT and use it ...
* Makefile.am: ... here.
* Makefile.util.def: ... and here.
* grub-core/Makefile.am: ... and here.
2014-01-18 Andrey Borzenkov <arvidjaar@gmail.com> 2014-01-18 Andrey Borzenkov <arvidjaar@gmail.com>
* include/grub/osdep/hostfile_windows.h: Use _W64 instead of * include/grub/osdep/hostfile_windows.h: Use _W64 instead of

View file

@ -66,22 +66,22 @@ endif
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 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
build-grub-mkfont: util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c build-grub-mkfont$(BUILD_EXEEXT): util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c
$(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) $(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)
CLEANFILES += build-grub-mkfont CLEANFILES += build-grub-mkfont$(BUILD_EXEEXT)
garbage-gen: util/garbage-gen.c garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c
$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $^ $(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $^
CLEANFILES += garbage-gen CLEANFILES += garbage-gen$(BUILD_EXEEXT)
EXTRA_DIST += util/garbage-gen.c EXTRA_DIST += util/garbage-gen.c
build-grub-gen-asciih: util/grub-gen-asciih.c build-grub-gen-asciih$(BUILD_EXEEXT): util/grub-gen-asciih.c
$(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 $(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
CLEANFILES += build-grub-gen-asciih CLEANFILES += build-grub-gen-asciih$(BUILD_EXEEXT)
build-grub-gen-widthspec: util/grub-gen-widthspec.c build-grub-gen-widthspec$(BUILD_EXEEXT): util/grub-gen-widthspec.c
$(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 $(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
CLEANFILES += build-grub-gen-widthspec CLEANFILES += build-grub-gen-widthspec$(BUILD_EXEEXT)
if COND_STARFIELD if COND_STARFIELD
starfield_DATA = dejavu_10.pf2 dejavu_12.pf2 dejavu_bold_14.pf2 dejavu_14.pf2 dejavu_16.pf2 $(starfield_theme_files) starfield_DATA = dejavu_10.pf2 dejavu_12.pf2 dejavu_bold_14.pf2 dejavu_14.pf2 dejavu_16.pf2 $(starfield_theme_files)

View file

@ -708,7 +708,7 @@ script = {
name = grub-fs-tester; name = grub-fs-tester;
common = tests/util/grub-fs-tester.in; common = tests/util/grub-fs-tester.in;
installdir = noinst; installdir = noinst;
dependencies = garbage-gen; dependencies = 'garbage-gen$(BUILD_EXEEXT)';
}; };
script = { script = {

View file

@ -38,7 +38,8 @@ AC_CONFIG_AUX_DIR([build-aux])
# We don't want -g -O2 by default in CFLAGS # We don't want -g -O2 by default in CFLAGS
: ${CFLAGS=""} : ${CFLAGS=""}
# Checks for host and target systems. # Checks for build, host and target systems.
AC_CANONICAL_BUILD
AC_CANONICAL_HOST AC_CANONICAL_HOST
save_program_prefix="${program_prefix}" save_program_prefix="${program_prefix}"
AC_CANONICAL_TARGET AC_CANONICAL_TARGET
@ -422,6 +423,16 @@ case "$build_os" in
haiku*) BUILD_LIBM= ;; haiku*) BUILD_LIBM= ;;
*) BUILD_LIBM=-lm ;; *) BUILD_LIBM=-lm ;;
esac esac
dnl FIXME proper test seems to require too deep dive into Autoconf internals.
dnl For now just list known platforms that we support.
case "$build_os" in
cygwin*|mingw32*|mingw64*) BUILD_EXEEXT=.exe ;;
*) BUILD_EXEEXT= ;;
esac
AC_SUBST(BUILD_EXEEXT)
# For gnulib. # For gnulib.
gl_INIT gl_INIT
@ -765,11 +776,11 @@ if test x"$platform" = xemu ; then
*windows* | *cygwin* | *mingw*) *windows* | *cygwin* | *mingw*)
if test x${target_cpu} = xi386 ; then if test x${target_cpu} = xi386 ; then
grub_cv_target_cc_link_format=-mi386pe; grub_cv_target_cc_link_format=-mi386pe;
TARGET_OBJ2ELF='./build-grub-pe2elf'; TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)';
fi fi
if test x${target_cpu} = xx86_64 ; then if test x${target_cpu} = xx86_64 ; then
grub_cv_target_cc_link_format=-mi386pep; grub_cv_target_cc_link_format=-mi386pep;
TARGET_OBJ2ELF='./build-grub-pep2elf'; TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)';
fi fi
TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format" TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
;; ;;
@ -803,10 +814,10 @@ elif test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
fi fi
TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format" TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
if test x"$grub_cv_target_cc_link_format" = x-mi386pe ; then if test x"$grub_cv_target_cc_link_format" = x-mi386pe ; then
TARGET_OBJ2ELF='./build-grub-pe2elf'; TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)';
fi fi
if test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then if test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then
TARGET_OBJ2ELF='./build-grub-pep2elf'; TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)';
fi fi
fi fi

View file

@ -26,20 +26,22 @@ CFLAGS_LIBRARY += $(CFLAGS_PLATFORM) -fno-builtin
CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM) CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM)
CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM) CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM)
build-grub-pep2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c build-grub-pep2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
$(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\" $^ $(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\" $^
CLEANFILES += build-grub-pep2elf$(BUILD_EXEEXT)
build-grub-pe2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c build-grub-pe2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
$(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\" $^ $(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\" $^
CLEANFILES += build-grub-pe2elf$(BUILD_EXEEXT)
# gentrigtables # gentrigtables
gentrigtables: gentrigtables.c gentrigtables$(BUILD_EXEEXT): gentrigtables.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $< $(BUILD_LIBM) $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $< $(BUILD_LIBM)
CLEANFILES += gentrigtables CLEANFILES += gentrigtables$(BUILD_EXEEXT)
# trigtables.c # trigtables.c
trigtables.c: gentrigtables gentrigtables.c $(top_srcdir)/configure.ac trigtables.c: gentrigtables$(BUILD_EXEEXT) gentrigtables.c $(top_srcdir)/configure.ac
./gentrigtables > $@ ./gentrigtables$(BUILD_EXEEXT) > $@
CLEANFILES += trigtables.c CLEANFILES += trigtables.c
# XXX Use Automake's LEX & YACC support # XXX Use Automake's LEX & YACC support