[U-Boot] [PATCH 1/2] kbuild: remove unnecessary adjustment for Cygwin

Masahiro Yamada yamada.m at jp.panasonic.com
Fri Jun 6 13:46:44 CEST 2014


"SFX = .exe" was originally added for Cygwin environment.

It is true that GCC on Cygwin spits executables with .exe extention.

For example,

  gcc -o foo foo.c

will generate "foo.exe", not "foo".

But GNU make is also nicely adjusted for Cygwin.

For example,

  foo: foo.c
          gcc -o $@ $<

will compare the timestamp between "foo.exe" and "foo.c".

You do not have to tweak Makefiles like this:

  foo$(SFX): foo.c
          gcc -o $@ $<

And "make clean" works as well without adjustment for Cygwin because
the command "rm foo" on Cygwin will delete both "foo" and "foo.exe".

In conclusion, makefiles do not need special care for Cygwin.

Signed-off-by: Masahiro Yamada <yamada.m at jp.panasonic.com>
---

I tested this patch on the following environment.

$ uname -a
CYGWIN_NT-6.1 yamada-win7 1.7.30(0.272/5/3) 2014-05-23 10:36 i686 Cygwin

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-cygwin/4.8.3/lto-wrapper.exe
Target: i686-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc4/gcc-4.8.3-1/src/gcc-4.8.3/configure
 --srcdir=/cygdrive/i/szsz/tmpp/gcc4/gcc-4.8.3-1/src/gcc-4.8.3
 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
 --libexecdir=/usr/libexec --datadir=/usr/share --localstatedir=/var
 --sysconfdir=/etc --libdir=/usr/lib --datarootdir=/usr/share
 --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C
 --build=i686-pc-cygwin --host=i686-pc-cygwin --target=i686-pc-cygwin
 --without-libiconv-prefix --without-libintl-prefix --enable-shared
 --enable-shared-libgcc --enable-static
 --enable-version-specific-runtime-libs --enable-bootstrap
 --disable-__cxa_atexit --with-dwarf2 --with-arch=i686
 --with-tune=generic --disable-sjlj-exceptions
 --enable-languages=ada,c,c++,fortran,java,lto,objc,obj-c++
 --enable-graphite --enable-threads=posix --enable-libatomic
 --enable-libgomp --disable-libitm --enable-libquadmath
 --enable-libquadmath-support --enable-libssp --enable-libada
 --enable-libjava --enable-libgcj-sublibs --disable-java-awt
 --disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar
 --with-gnu-ld --with-gnu-as
 --with-cloog-include=/usr/include/cloog-isl
 --without-libiconv-prefix --without-libintl-prefix
 --with-system-zlib --libexecdir=/usr/lib
Thread model: posix
gcc version 4.8.3 (GCC)

$ make -v
GNU Make 4.0
Built for i686-pc-cygwin
Copyright (C) 1988-2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


 tools/Makefile | 89 ++++++++++++++++++++++++++--------------------------------
 1 file changed, 40 insertions(+), 49 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
index 09ac3bb..5235539 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -5,15 +5,6 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-#
-# toolchains targeting win32 generate .exe files
-#
-ifneq (,$(findstring WIN32 ,$(shell $(HOSTCC) -E -dM -xc /dev/null)))
-SFX = .exe
-else
-SFX =
-endif
-
 # Enable all the config-independent tools
 ifneq ($(HOST_TOOLS_ALL),)
 CONFIG_LCD_LOGO = y
@@ -38,31 +29,31 @@ ENVCRC-$(CONFIG_ENV_IS_IN_NVRAM) = y
 ENVCRC-$(CONFIG_ENV_IS_IN_SPI_FLASH) = y
 CONFIG_BUILD_ENVCRC ?= $(ENVCRC-y)
 
-hostprogs-$(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER) += atmel_pmecc_params$(SFX)
+hostprogs-$(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER) += atmel_pmecc_params
 
 # TODO: CONFIG_CMD_LICENSE does not work
-hostprogs-$(CONFIG_CMD_LICENSE) += bin2header$(SFX)
-hostprogs-$(CONFIG_LCD_LOGO) += bmp_logo$(SFX)
-hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo$(SFX)
-HOSTCFLAGS_bmp_logo$(SFX).o := -pedantic
+hostprogs-$(CONFIG_CMD_LICENSE) += bin2header
+hostprogs-$(CONFIG_LCD_LOGO) += bmp_logo
+hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo
+HOSTCFLAGS_bmp_logo.o := -pedantic
 
-hostprogs-$(CONFIG_BUILD_ENVCRC) += envcrc$(SFX)
-envcrc$(SFX)-objs := envcrc.o lib/crc32.o common/env_embedded.o lib/sha1.o
+hostprogs-$(CONFIG_BUILD_ENVCRC) += envcrc
+envcrc-objs := envcrc.o lib/crc32.o common/env_embedded.o lib/sha1.o
 
-hostprogs-$(CONFIG_CMD_NET) += gen_eth_addr$(SFX)
-HOSTCFLAGS_gen_eth_addr$(SFX).o := -pedantic
+hostprogs-$(CONFIG_CMD_NET) += gen_eth_addr
+HOSTCFLAGS_gen_eth_addr.o := -pedantic
 
-hostprogs-$(CONFIG_CMD_LOADS) += img2srec$(SFX)
-HOSTCFLAGS_img2srec$(SFX).o := -pedantic
+hostprogs-$(CONFIG_CMD_LOADS) += img2srec
+HOSTCFLAGS_img2srec.o := -pedantic
 
-hostprogs-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes$(SFX)
-HOSTCFLAGS_xway-swap-bytes$(SFX).o := -pedantic
+hostprogs-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes
+HOSTCFLAGS_xway-swap-bytes.o := -pedantic
 
-hostprogs-y += mkenvimage$(SFX)
-mkenvimage$(SFX)-objs := mkenvimage.o os_support.o lib/crc32.o
+hostprogs-y += mkenvimage
+mkenvimage-objs := mkenvimage.o os_support.o lib/crc32.o
 
-hostprogs-y += dumpimage$(SFX) mkimage$(SFX)
-hostprogs-$(CONFIG_FIT_SIGNATURE) += fit_info$(SFX) fit_check_sign$(SFX)
+hostprogs-y += dumpimage mkimage
+hostprogs-$(CONFIG_FIT_SIGNATURE) += fit_info fit_check_sign
 
 FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig.o
 # Flattened device tree objects
@@ -100,10 +91,10 @@ dumpimage-mkimage-objs := aisimage.o \
 			$(LIBFDT_OBJS) \
 			$(RSA_OBJS-y)
 
-dumpimage$(SFX)-objs := $(dumpimage-mkimage-objs) dumpimage.o
-mkimage$(SFX)-objs   := $(dumpimage-mkimage-objs) mkimage.o
-fit_info$(SFX)-objs   := $(dumpimage-mkimage-objs) fit_info.o
-fit_check_sign$(SFX)-objs   := $(dumpimage-mkimage-objs) fit_check_sign.o
+dumpimage-objs := $(dumpimage-mkimage-objs) dumpimage.o
+mkimage-objs   := $(dumpimage-mkimage-objs) mkimage.o
+fit_info-objs   := $(dumpimage-mkimage-objs) fit_info.o
+fit_check_sign-objs   := $(dumpimage-mkimage-objs) fit_check_sign.o
 
 # TODO(sjg at chromium.org): Is this correct on Mac OS?
 
@@ -121,33 +112,33 @@ endif
 
 # MXSImage needs LibSSL
 ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_FIT_SIGNATURE),)
-HOSTLOADLIBES_mkimage$(SFX) += -lssl -lcrypto
+HOSTLOADLIBES_mkimage += -lssl -lcrypto
 endif
 
-HOSTLOADLIBES_dumpimage$(SFX) := $(HOSTLOADLIBES_mkimage$(SFX))
-HOSTLOADLIBES_fit_info$(SFX) := $(HOSTLOADLIBES_mkimage$(SFX))
-HOSTLOADLIBES_fit_check_sign$(SFX) := $(HOSTLOADLIBES_mkimage$(SFX))
+HOSTLOADLIBES_dumpimage := $(HOSTLOADLIBES_mkimage)
+HOSTLOADLIBES_fit_info := $(HOSTLOADLIBES_mkimage)
+HOSTLOADLIBES_fit_check_sign := $(HOSTLOADLIBES_mkimage)
 
-hostprogs-$(CONFIG_EXYNOS5250) += mkexynosspl$(SFX)
-hostprogs-$(CONFIG_EXYNOS5420) += mkexynosspl$(SFX)
-HOSTCFLAGS_mkexynosspl$(SFX).o := -pedantic
+hostprogs-$(CONFIG_EXYNOS5250) += mkexynosspl
+hostprogs-$(CONFIG_EXYNOS5420) += mkexynosspl
+HOSTCFLAGS_mkexynosspl.o := -pedantic
 
-hostprogs-$(CONFIG_MX23) += mxsboot$(SFX)
-hostprogs-$(CONFIG_MX28) += mxsboot$(SFX)
-HOSTCFLAGS_mxsboot$(SFX).o := -pedantic
+hostprogs-$(CONFIG_MX23) += mxsboot
+hostprogs-$(CONFIG_MX28) += mxsboot
+HOSTCFLAGS_mxsboot.o := -pedantic
 
-hostprogs-$(CONFIG_SUNXI) += mksunxiboot$(SFX)
+hostprogs-$(CONFIG_SUNXI) += mksunxiboot
 
-hostprogs-$(CONFIG_NETCONSOLE) += ncb$(SFX)
-hostprogs-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX)
+hostprogs-$(CONFIG_NETCONSOLE) += ncb
+hostprogs-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1
 
-ubsha1$(SFX)-objs := os_support.o ubsha1.o lib/sha1.o
+ubsha1-objs := os_support.o ubsha1.o lib/sha1.o
 
 HOSTCFLAGS_ubsha1.o := -pedantic
 
-hostprogs-$(CONFIG_KIRKWOOD) += kwboot$(SFX)
-hostprogs-y += proftool$(SFX)
-hostprogs-$(CONFIG_STATIC_RELA) += relocate-rela$(SFX)
+hostprogs-$(CONFIG_KIRKWOOD) += kwboot
+hostprogs-y += proftool
+hostprogs-$(CONFIG_STATIC_RELA) += relocate-rela
 
 # We build some files with extra pedantic flags to try to minimize things
 # that won't build on some weird host compiler -- though there are lots of
@@ -158,8 +149,8 @@ HOSTCFLAGS_sha1.o := -pedantic
 HOSTCFLAGS_sha256.o := -pedantic
 
 # Don't build by default
-#hostprogs-$(CONFIG_PPC) += mpc86x_clk$(SFX)
-#HOSTCFLAGS_mpc86x_clk$(SFX).o := -pedantic
+#hostprogs-$(CONFIG_PPC) += mpc86x_clk
+#HOSTCFLAGS_mpc86x_clk.o := -pedantic
 
 quiet_cmd_wrap = WRAP    $@
 cmd_wrap = echo "\#include <$(srctree)/$(patsubst $(obj)/%,%,$@)>" >$@
-- 
1.9.1



More information about the U-Boot mailing list