diff mbox

xfsprogs: Add BUILD_CFLAGS for cross compilation

Message ID 1454361909-36538-1-git-send-email-gwendal@chromium.org (mailing list archive)
State New, archived
Headers show

Commit Message

Gwendal Grignou Feb. 1, 2016, 9:25 p.m. UTC
When cross compiling, CFLAGS may contains option for the cros-compiler the
host compiler can not handle.
Add BUILD_CFLAGS variable that does not include $OPTIMIZER options.

Signed-off by: Gwendal Grignou <gwendal@chromium.org>

 [ --enable-shared=[yes/no] Enable use of shared libraries [default=yes]],,
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Christoph Hellwig Feb. 2, 2016, 6:08 p.m. UTC | #1
On Mon, Feb 01, 2016 at 01:25:09PM -0800, Gwendal Grignou wrote:
> When cross compiling, CFLAGS may contains option for the cros-compiler the
> host compiler can not handle.
> Add BUILD_CFLAGS variable that does not include $OPTIMIZER options.

I would have expected this to be HOST_CFLAGS, but it seems the
BUILD_ convention already exists in xfsprogs, so sticking to it
looks fine to me.

Reviewed-by: Christoph Hellwig <hch@lst.de>
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christoph Hellwig May 31, 2016, 12:51 p.m. UTC | #2
On Fri, May 27, 2016 at 09:34:50AM -0700, Gwendal Grignou wrote:
> Looking at xfsprogs-4.5.0, that patch has not been applied. Did it not work?
> It still applies cleanly on 4.5.

It probably just got missed by Dave between all the patches on the list.
Can you just resend it with my Reviewed-by tag added?
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gwendal Grignou May 31, 2016, 4:19 p.m. UTC | #3
[+Mike]
Sure. Mike suggested improvements (ability to specify the host
compiler), and found I did not properly regenerate ./configure. I will
resubmit a better patch.
Gwendal.

On Tue, May 31, 2016 at 5:51 AM, Christoph Hellwig <hch@infradead.org> wrote:
> On Fri, May 27, 2016 at 09:34:50AM -0700, Gwendal Grignou wrote:
>> Looking at xfsprogs-4.5.0, that patch has not been applied. Did it not work?
>> It still applies cleanly on 4.5.
>
> It probably just got missed by Dave between all the patches on the list.
> Can you just resend it with my Reviewed-by tag added?
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- a/include/builddefs.in	2016-02-01 09:44:14.636018753 -0800
+++ b/include/builddefs.in	2016-02-01 09:37:29.000000000 -0800
@@ -27,6 +27,7 @@ 
 LOADERFLAGS = @LDFLAGS@
 LTLDFLAGS = @LDFLAGS@
 CFLAGS = @CFLAGS@
+BUILD_CFLAGS = @BUILD_CFLAGS@
 
 LIBRT = @librt@
 LIBUUID = @libuuid@
@@ -151,7 +151,7 @@ 
 endif
 
 
-GCFLAGS = $(OPTIMIZER) $(DEBUG) \
+GCFLAGS = $(DEBUG) \
 	  -DVERSION=\"$(PKG_VERSION)\" -DLOCALEDIR=\"$(PKG_LOCALE_DIR)\"  \
 	  -DPACKAGE=\"$(PKG_NAME)\" -I$(TOPDIR)/include -I$(TOPDIR)/libxfs
 
@@ -160,7 +160,8 @@ 
 endif
 
 # First, Global, Platform, Local CFLAGS
-CFLAGS += $(FCFLAGS) $(GCFLAGS) $(PCFLAGS) $(LCFLAGS)
+BUILD_CFLAGS += $(FCFLAGS) $(GCFLAGS) $(PCFLAGS) $(LCFLAGS)
+CFLAGS += $(FCFLAGS) $(OPTIMIZER) $(GCFLAGS) $(PCFLAGS) $(LCFLAGS)
 
 include $(TOPDIR)/include/buildmacros
 
--- a/libxfs/Makefile	2016-02-01 09:44:14.644018849 -0800
+++ b/libxfs/Makefile	2016-02-01 09:37:55.000000000 -0800
@@ -111,7 +111,7 @@ 
 
 crc32table.h: gen_crc32table.c
 	@echo "    [CC]     gen_crc32table"
-	$(Q) $(BUILD_CC) $(CFLAGS) -o gen_crc32table $<
+	$(Q) $(BUILD_CC) $(BUILD_CFLAGS) -o gen_crc32table $<
 	@echo "    [GENERATE] $@"
 	$(Q) ./gen_crc32table > crc32table.h
 
@@ -122,7 +122,7 @@ 
 # disk.
 crc32selftest: gen_crc32table.c crc32table.h crc32.c
 	@echo "    [TEST]    CRC32"
-	$(Q) $(BUILD_CC) $(CFLAGS) -D CRC32_SELFTEST=1 crc32.c -o $@
+	$(Q) $(BUILD_CC) $(BUILD_CFLAGS) -D CRC32_SELFTEST=1 crc32.c -o $@
 	$(Q) ./$@
 
 # set up include/xfs header directory
--- a/configure.ac	2016-02-01 09:56:42.873010767 -0800
+++ b/configure.ac	2016-02-01 09:56:45.885047014 -0800
@@ -11,9 +11,12 @@ 
 AC_PROG_CC
 if test $cross_compiling = no; then
   BUILD_CC="$CC"
+  BUILD_CFLAGS="$CFLAGS"
   AC_SUBST(BUILD_CC)
 else
   AC_CHECK_PROGS(BUILD_CC, gcc cc)
+  BUILD_CFLAGS="-g"
 fi
+AC_SUBST(BUILD_CFLAGS)
 
 AC_ARG_ENABLE(shared,