]> git.puffer.fish Git - matthieu/frr.git/commitdiff
build: add Makefile variable easy access
authorDavid Lamparter <equinox@opensourcerouting.org>
Sat, 25 Aug 2018 05:35:31 +0000 (07:35 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Thu, 30 Aug 2018 06:06:44 +0000 (08:06 +0200)
This adds 2 helper targets for use in scripts to easily get at Makefile
variables without parsing the Makefile or config.status.

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

index 0ecab8b1f93a639784c9edcbaf5636fdda2385f2..b9003b8358474f23b14a9f01336fe5cf2c9227ed 100644 (file)
@@ -8,6 +8,20 @@ AM_CPPFLAGS += -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_srcdir)/lib \
 DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" -DCONFDATE=$(CONFDATE)
 LIBCAP = @LIBCAP@
 
+# these two targets are provided to easily grab autoconf/Makefile variables
+# you can use either:
+#   eval `make VARFD=3 shvar-CFLAGS 3>&1 1>&2`
+#   CFLAGS="`make VARFD=3 var-CFLAGS 3>&1 1>&2`"
+# where the former can be used to set several variables at once.  Note the
+# fd redirections -- this is to prevent garbage from make rebuilding other
+# targets from causing issues.
+.PHONY: shvar-% var-%
+VARFD ?= 1
+shvar-%:
+       @echo "$*=\"$($*)\"" >&$(VARFD)
+var-%:
+       @echo "$($*)" >&$(VARFD)
+
 # overwriting these vars breaks cross-compilation.  let's be helpful and warn.
 #
 # note: "#AUTODERP# " will be removed from Makefile by configure.  These are