Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/sets Move make variable extraction & conversion logi...



details:   https://anonhg.NetBSD.org/src/rev/de118b8a284a
branches:  trunk
changeset: 749833:de118b8a284a
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Thu Dec 10 15:51:24 2009 +0000

description:
Move make variable extraction & conversion logic from here-documented make
-f- command to an isolated makefile.  The list of non-_MKVARS.* variables
are concentrated there.

No functional changes.

diffstat:

 distrib/sets/mkvars.mk |  61 +++++++++++++++++++++++++++++++++++++++++++
 distrib/sets/sets.subr |  70 +++++---------------------------------------------
 2 files changed, 68 insertions(+), 63 deletions(-)

diffs (171 lines):

diff -r 8dd46b128ba0 -r de118b8a284a distrib/sets/mkvars.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/sets/mkvars.mk    Thu Dec 10 15:51:24 2009 +0000
@@ -0,0 +1,61 @@
+# $NetBSD: mkvars.mk,v 1.1 2009/12/10 15:51:24 uebayasi Exp $
+
+MKEXTRAVARS= \
+       MACHINE \
+       MACHINE_ARCH \
+       MACHINE_CPU \
+       HAVE_BINUTILS \
+       HAVE_GCC \
+       HAVE_GDB \
+       OBJECT_FMT \
+       TOOLCHAIN_MISSING \
+       EXTSRCS \
+       MKMANZ \
+       MKBFD \
+       MKCOMPAT \
+       MKDYNAMICROOT \
+       MKMANPAGES \
+       MKXORG \
+       X11FLAVOR \
+       USE_INET6 \
+       USE_KERBEROS \
+       USE_LDAP \
+       USE_YP \
+       NETBSDSRCDIR \
+       MAKEVERBOSE
+
+#####
+
+.include <bsd.own.mk>
+
+.if (${MKMAN} == "no" || empty(MANINSTALL:Mmaninstall))
+MKMANPAGES=no
+.else
+MKMANPAGES=yes
+.endif
+
+.if ${MKX11} != "no"
+. if ${X11FLAVOUR} == "Xorg"
+MKXORG:=yes
+MKX11:=no
+. else
+MKXORG:=no
+. endif
+.endif
+
+#####
+
+mkvars: mkvarsyesno mkextravars .PHONY
+
+mkvarsyesno: .PHONY
+.for i in ${_MKVARS.yes}
+       @echo $i="${$i}"
+.endfor
+.for i in ${_MKVARS.no}
+       @echo $i="${$i}"
+.endfor
+
+mkextravars: .PHONY
+.for i in ${MKEXTRAVARS}
+       @echo $i="${$i}"
+.endfor
diff -r 8dd46b128ba0 -r de118b8a284a distrib/sets/sets.subr
--- a/distrib/sets/sets.subr    Thu Dec 10 15:47:23 2009 +0000
+++ b/distrib/sets/sets.subr    Thu Dec 10 15:51:24 2009 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: sets.subr,v 1.107 2009/12/10 13:25:19 uebayasi Exp $
+#      $NetBSD: sets.subr,v 1.108 2009/12/10 15:51:24 uebayasi Exp $
 #
 
 #
@@ -24,30 +24,6 @@
 # as well as:
 #
 
-# XXX don't hardcode
-MKEXTRAVARS="\
-       MACHINE         \
-       MACHINE_ARCH    \
-       MACHINE_CPU     \
-       HAVE_BINUTILS   \
-       HAVE_GCC        \
-       HAVE_GDB        \
-       OBJECT_FMT      \
-       TOOLCHAIN_MISSING \
-       EXTSRCS         \
-       MKMANZ          \
-       MKBFD           \
-       MKCOMPAT        \
-       MKDYNAMICROOT   \
-       MKMANPAGES      \
-       MKXORG          \
-       USE_INET6       \
-       USE_KERBEROS    \
-       USE_LDAP        \
-       USE_YP          \
-       NETBSDSRCDIR    \
-       MAKEVERBOSE     \
-"
 #
 # The following variables refer to tools that are used when building sets:
 #
@@ -136,51 +112,19 @@
        ;;
 esac
 
+#####
+
 oIFS=$IFS
 IFS="
 "
 
-for x in $(
-       ${MAKE} -B -f- all <<EOMAKE
-.include <bsd.own.mk>
-all:
-       @echo "export _MKVARS_yes=\"\${_MKVARS.yes}\""
-       @echo "export _MKVARS_no=\"\${_MKVARS.no}\""
-
-EOMAKE
-); do
-       eval $x
-done
-
-for x in $(
-${MAKE} -B -f- all <<EOMAKE
-.include <bsd.own.mk>
-.if (\${MKMAN} == "no" || empty(MANINSTALL:Mmaninstall))
-MKMANPAGES=no
-.else
-MKMANPAGES=yes
-.endif
-.if \${MKX11} != "no"
-. if \${X11FLAVOUR} == "Xorg"
-MKXORG:=yes
-MKX11:=no
-. else
-MKXORG:=no
-. endif
-.endif
-all:
-.for i in ${MKEXTRAVARS} ${_MKVARS_yes} ${_MKVARS_no}
-       @echo "export \$i=\"\${\$i}\""
-.endfor
-
-EOMAKE
-); do
-       eval $x
+for x in $( ${MAKE} -B -f mkvars.mk mkvars ); do
+       eval export $x
 done
 
 IFS=$oIFS
 
-MKVARS="$MKEXTRAVARS $_MKVARS_yes $_MKVARS_no"
+MKVARS="$( ${MAKE} -B -f mkvars.mk mkvars | sed -e 's,=.*,,' | xargs )"
 
 if [ "$SETS_SUBR_DEBUG" = "dumpmkvars" ]; then
        for v in $MKVARS; do
@@ -234,7 +178,7 @@
 # In each file, a record consists of a path and a System Package name,
 # separated by whitespace. E.g.,
 #
-#      # $NetBSD: sets.subr,v 1.107 2009/12/10 13:25:19 uebayasi Exp $
+#      # $NetBSD: sets.subr,v 1.108 2009/12/10 15:51:24 uebayasi Exp $
 #      .                       base-sys-root   [keyword[,...]]
 #      ./altroot               base-sys-root
 #      ./bin                   base-sys-root



Home | Main Index | Thread Index | Old Index