]> granicus.if.org Git - neomutt/commitdiff
Expose EXTRA_CFLAGS_FOR_BUILD and EXTRA_LDFLAGS_FOR_BUIlD (#1098)
authorPietro Cerutti <gahr@gahr.ch>
Thu, 15 Mar 2018 14:48:09 +0000 (14:48 +0000)
committerGitHub <noreply@github.com>
Thu, 15 Mar 2018 14:48:09 +0000 (14:48 +0000)
This allows distros to set flags that must be used both for building target and host executables.

Issue #980

Makefile.autosetup
auto.def
doc/Makefile.autosetup

index c02c40f8f7f6682879961825b7517d3df6ce58f7..1f86c9f3dee5a35ec77c2b8d40626d475b620dcc 100644 (file)
@@ -4,10 +4,16 @@
 PACKAGE=       @PACKAGE@
 PACKAGE_VERSION=@PACKAGE_VERSION@
 
+# Build-time compiler and flags. These are used for building executables that
+# are only used at build-time, e.g., doc/makedoc. These are different from CC /
+# CFLAGS / LDFLAGS because the host and target systems might be different.
+CC_FOR_BUILD=          @CC_FOR_BUILD@
+CFLAGS_FOR_BUILD=      @CFLAGS_FOR_BUILD@ $(EXTRA_CFLAGS_FOR_BUILD)
+LDFLAGS_FOR_BUILD=     @LDFLAGS_FOR_BUILD@ $(EXTRA_LDFLAGS_FOR_BUILD)
+
 PWD=           @PWD@
 AR=            @AR@
 CC=            @CC@
-CC_FOR_BUILD=  @CC_FOR_BUILD@ @CFLAGS_FOR_BUILD@
 CPP=           @CPP@
 CFLAGS=                @CPPFLAGS@ @CFLAGS@ -I. -I@top_srcdir@ -Wall $(EXTRA_CFLAGS)
 LDFLAGS=       @LDFLAGS@ $(EXTRA_LDFLAGS)
index 77c6dda60e3380d658e3c8a749a72e0ee68edbdf..d922490d7dc0309cea3d38bec04560ba81986e1d 100644 (file)
--- a/auto.def
+++ b/auto.def
@@ -186,6 +186,7 @@ if {1} {
     user-error "C99 is required"
   }
   define-append CFLAGS_FOR_BUILD -std=c99
+  define LDFLAGS_FOR_BUILD {}
 
   # Check for tools and programs
   cc-check-tools ar ranlib strip
index b34cae0e588d7d80914d231f5b711eb5698e7dc8..9b0b58e3c54e97352bdc496504ec7f1c3fb54452 100644 (file)
@@ -1,7 +1,8 @@
-MAKEDOC_CPP = $(CC_FOR_BUILD) -D_MAKEDOC -E -C -I.
+MAKEDOC_CPP = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -D_MAKEDOC -E -C -I.
 
 doc/makedoc$(EXEEXT): $(SRCDIR)/doc/makedoc.c
-       $(CC_FOR_BUILD) -I. -o $@ $(SRCDIR)/doc/makedoc.c
+       $(CC_FOR_BUILD) -I. $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) \
+           -o $@ $(SRCDIR)/doc/makedoc.c
 
 doc/neomuttrc: $(SRCDIR)/init.h doc/makedoc$(EXEEXT) $(SRCDIR)/doc/neomuttrc.head
        sed -e 's,@docdir@,$(docdir),' $(SRCDIR)/doc/neomuttrc.head \