[coreboot-gerrit] New patch to review for coreboot: cbfstool: compile successfully on Cygwin
Stefan Reinauer (stefan.reinauer@coreboot.org)
gerrit at coreboot.org
Wed Sep 16 00:47:33 CET 2015
Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11667
-gerrit
commit 6bd73d2fb74ef30b3259039d71f55cb3c9541a3b
Author: Stefan Reinauer <reinauer at chromium.org>
Date: Tue Sep 15 17:41:07 2015 -0700
cbfstool: compile successfully on Cygwin
As reported in http://review.coreboot.org/#/c/10027
cbfstool on Cygwin likes to be compiled with -D_GNU_SOURCE.
That patch was abandoned because it would unwantedly turn on
more GNU extensions. Instead of doing that, only enable the
define on Cygwin, switch to -std=gnu99 instead of -std=c99 to
make fileno and strdup actually available.
A MINGW32 check that was forgotten in Makefile was copied over
from Makefile.inc to keep the two files in sync.
This patch has no impact on non-Windows builds.
Change-Id: I068b181d67daf9c7280110e64aefb634aa20c69b
Signed-off-by: Stefan Reinauer <stefan.reinauer at coreboot.org>
---
util/cbfstool/Makefile | 11 ++++++++++-
util/cbfstool/Makefile.inc | 7 ++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/util/cbfstool/Makefile b/util/cbfstool/Makefile
index 65d5710..0b47541 100644
--- a/util/cbfstool/Makefile
+++ b/util/cbfstool/Makefile
@@ -3,7 +3,7 @@ obj ?= .
HOSTCC ?= $(CC)
CFLAGS += -g3
-CFLAGS += -std=c99 -Werror -Wall -Wextra
+CFLAGS += -Werror -Wall -Wextra
CFLAGS += -Wcast-qual -Wmissing-prototypes -Wredundant-decls -Wshadow
CFLAGS += -Wstrict-prototypes -Wwrite-strings
CPPFLAGS += -D_DEFAULT_SOURCE # memccpy() from string.h
@@ -11,6 +11,15 @@ CPPFLAGS += -D_POSIX_C_SOURCE=200809L # strdup() from string.h
CPPFLAGS += -Iflashmap
LDFLAGS += -g3
+ifeq ($(shell uname -s | cut -c-7 2>/dev/null), MINGW32)
+CFLAGS+=-mno-ms-bitfields
+endif
+ifeq ($(shell uname -o), Cygwin)
+CFLAGS+=-std=gnu99 -D_GNU_SOURCE
+else
+CFLAGS+=-std=c99
+endif
+
CBFSTOOL_BINARY:=$(obj)/cbfstool
CBFSTOOL_COMMON:=common.o cbfs_image.o compress.o fit.o
CBFSTOOL_COMMON+=elfheaders.o cbfs-mkstage.o cbfs-mkpayload.o xdr.o
diff --git a/util/cbfstool/Makefile.inc b/util/cbfstool/Makefile.inc
index 976f0c2..ef03cc4 100644
--- a/util/cbfstool/Makefile.inc
+++ b/util/cbfstool/Makefile.inc
@@ -41,7 +41,7 @@ rmodobj += common.o
rmodobj += elfheaders.o
rmodobj += xdr.o
-TOOLCFLAGS ?= -std=c99 -Werror -Wall -Wextra
+TOOLCFLAGS ?= -Werror -Wall -Wextra
TOOLCFLAGS += -Wcast-qual -Wmissing-prototypes -Wredundant-decls -Wshadow
TOOLCFLAGS += -Wstrict-prototypes -Wwrite-strings
TOOLCPPFLAGS ?= -D_DEFAULT_SOURCE # memccpy() from string.h
@@ -54,6 +54,11 @@ TOOLLDFLAGS ?=
ifeq ($(shell uname -s | cut -c-7 2>/dev/null), MINGW32)
TOOLFLAGS+=-mno-ms-bitfields
endif
+ifeq ($(shell uname -o), Cygwin)
+TOOLFLAGS+=-std=gnu99 -D_GNU_SOURCE
+else
+TOOLFLAGS+=-std=c99
+endif
$(objutil)/cbfstool/%.o: $(objutil)/cbfstool/%.c
printf " HOSTCC $(subst $(objutil)/,,$(@))\n"
More information about the coreboot-gerrit
mailing list