]> git.puffer.fish Git - mirror/frr.git/commitdiff
build: add warning when overwriting vars on "make"
authorDavid Lamparter <equinox@opensourcerouting.org>
Tue, 21 Aug 2018 18:33:13 +0000 (20:33 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Thu, 30 Aug 2018 06:06:44 +0000 (08:06 +0200)
doing things like `make CC="mmix-linux-musl-gcc"` breaks the hosttools/
cross-compilation setup pretty hard and just straight up should not be
done.  These vars belong on `configure`, not `make`.

Signed-off-by: David Lamparter <equinox@diac24.net>
Makefile.am
configure.ac

index ec186b3fc1e92cb62624d6fdd1315ea0dcf9b0fc..0ecab8b1f93a639784c9edcbaf5636fdda2385f2 100644 (file)
@@ -8,6 +8,48 @@ AM_CPPFLAGS += -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_srcdir)/lib \
 DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" -DCONFDATE=$(CONFDATE)
 LIBCAP = @LIBCAP@
 
+# overwriting these vars breaks cross-compilation.  let's be helpful and warn.
+#
+# note: "#AUTODERP# " will be removed from Makefile by configure.  These are
+# GNU make directives & automake will f*ck them up by trying to process them
+# as automake directives.
+#
+#AUTODERP# null=
+#AUTODERP# SPACE=$(null) $(null)
+#AUTODERP# mkcheck_CC =       $(findstring $(SPACE)CC=,      $(SPACE)$(MAKEOVERRIDES))
+#AUTODERP# mkcheck_CFLAGS =   $(findstring $(SPACE)CFLAGS=,  $(SPACE)$(MAKEOVERRIDES))
+#AUTODERP# mkcheck_CPPFLAGS = $(findstring $(SPACE)CPPFLAGS=,$(SPACE)$(MAKEOVERRIDES))
+#AUTODERP# mkcheck_CCLD =     $(findstring $(SPACE)CCLD=,    $(SPACE)$(MAKEOVERRIDES))
+#AUTODERP# mkcheck_LD =       $(findstring $(SPACE)LD=,      $(SPACE)$(MAKEOVERRIDES))
+#AUTODERP# mkcheck_LDFLAGS =  $(findstring $(SPACE)LDFLAGS=, $(SPACE)$(MAKEOVERRIDES))
+#AUTODERP# #
+#AUTODERP# ifneq ($(mkcheck_CC),)
+#AUTODERP#   $(warning WARNING: you have overwritten the "CC" variable on the make command line.)
+#AUTODERP# endif
+#AUTODERP# ifneq ($(mkcheck_CFLAGS),)
+#AUTODERP#   $(warning WARNING: you have overwritten the "CFLAGS" variable on the make command line.)
+#AUTODERP# endif
+#AUTODERP# ifneq ($(mkcheck_CPPFLAGS),)
+#AUTODERP#   $(warning WARNING: you have overwritten the "CPPFLAGS" variable on the make command line.)
+#AUTODERP# endif
+#AUTODERP# ifneq ($(mkcheck_CCLD),)
+#AUTODERP#   $(warning WARNING: you have overwritten the "CCLD" variable on the make command line.)
+#AUTODERP# endif
+#AUTODERP# ifneq ($(mkcheck_LD),)
+#AUTODERP#   $(warning WARNING: you have overwritten the "LD" variable on the make command line.)
+#AUTODERP# endif
+#AUTODERP# ifneq ($(mkcheck_LDFLAGS),)
+#AUTODERP#   $(warning WARNING: you have overwritten the "LDFLAGS" variable on the make command line.)
+#AUTODERP# endif
+#AUTODERP# #
+#AUTODERP# ifneq ($(mkcheck_CC)$(mkcheck_CFLAGS)$(mkcheck_CPPFLAGS)$(mkcheck_CCLD)$(mkcheck_LD)$(mkcheck_LDFLAGS),)
+#AUTODERP#   $(warning ------)
+#AUTODERP#   $(warning While overwriting these variables works most of the time, it is not recommended and can cause confusing build errors.)
+#AUTODERP#   $(warning This is especially problematic when cross-compiling, since tools that run on the build system during the build process will not be compiled correctly.)
+#AUTODERP#   $(warning All of these variables should be supplied to 'configure', and they will be remembered and correctly applied during 'make'.)
+#AUTODERP#   $(warning ------)
+#AUTODERP# endif
+
 EXTRA_DIST =
 BUILT_SOURCES =
 CLEANFILES =
index 2d8723d5cffb924ee61f97ec4e22aefae2e488c0..12c1857758c73d6d0b822345a60a3d160199239f 100755 (executable)
@@ -1993,7 +1993,9 @@ AC_CACHE_VAL(ac_cv_htonl_works,
 )
 AC_MSG_RESULT($ac_cv_htonl_works)
 
-AC_CONFIG_FILES([Makefile
+AC_CONFIG_FILES([Makefile],[sed -e 's/^#AUTODERP# //' -i Makefile])
+
+AC_CONFIG_FILES([
          bgpd/Makefile
          vtysh/Makefile
          tests/Makefile