[Midnightbsd-cvs] src: share/mk: Let's get dangerous
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Tue Sep 2 22:23:05 EDT 2008
Log Message:
-----------
Let's get dangerous
Modified Files:
--------------
src/share/mk:
Makefile (r1.2 -> r1.3)
bsd.own.mk (r1.2 -> r1.3)
Added Files:
-----------
src/share/mk:
bsd.symver.mk (r1.1)
version_gen.awk (r1.1)
-------------- next part --------------
--- /dev/null
+++ share/mk/version_gen.awk
@@ -0,0 +1,186 @@
+#
+# Copyright (C) 2006 Daniel M. Eischen. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $MidnightBSD: src/share/mk/version_gen.awk,v 1.1 2008/09/03 02:23:05 laffer1 Exp $
+# $FreeBSD: src/share/mk/version_gen.awk,v 1.3 2007/07/21 20:52:32 kan Exp $
+#
+
+#
+# Make a list of all the library versions listed in the master file.
+#
+# versions[] - array indexed by version name, contains number
+# of symbols (+ 1) found for each version.
+# successors[] - array index by version name, contains successor
+# version name.
+# symbols[][] - array index by [version name, symbol index], contains
+# names of symbols defined for each version.
+#
+BEGIN {
+ brackets = 0;
+ errors = 0;
+ version_count = 0;
+ current_version = "";
+ stderr = "/dev/stderr";
+ while (getline < vfile) {
+ # Strip comments.
+ sub("#.*$", "", $0);
+
+ # Strip trailing spaces.
+ sub(" *$", "", $0);
+
+ if (/^[ \t]*[a-zA-Z0-9._]+ *{/) {
+ brackets++;
+ symver = $1;
+ versions[symver] = 1;
+ successors[symver] = "";
+ generated[symver] = 0;
+ version_count++;
+ }
+ else if (/^[ \t]*} *[a-zA-Z0-9._]+ *;/) {
+ # Strip semicolon.
+ gsub(";", "", $2);
+ if (symver == "")
+ printf("Unmatched bracket.\n");
+ else if (versions[$2] != 1)
+ printf("File %s: %s has unknown " \
+ "successor %s\n", vfile, symver, $2);
+ else
+ successors[symver] = $2;
+ brackets--;
+ }
+ else if (/^[ \t]*};/) {
+ if (symver == "")
+ printf("File %s: Unmatched bracket.\n",
+ vfile) > stderr;
+ # No successor
+ brackets--;
+ }
+ else if (/^[ \t]*}/) {
+ printf("File %s: Missing ending semi-colon.\n",
+ vfile) > stderr;
+ }
+ else if (/^$/)
+ ; # Ignore blank lines.
+ else
+ printf("File %s: Unknown directive: %s\n",
+ vfile, $0) > stderr;
+ }
+ brackets = 0;
+}
+
+/.*/ {
+ # Delete comments, preceding and trailing whitespace, then
+ # consume blank lines.
+ sub("#.*$", "", $0);
+ sub("^[ \t]+", "", $0);
+ sub("[ \t]+$", "", $0);
+ if ($0 == "")
+ next;
+}
+
+/^[a-zA-Z0-9._]+ +{$/ {
+ # Strip bracket from version name.
+ sub("{", "", $1);
+ if (current_version != "")
+ printf("File %s, line %d: Illegal nesting detected.\n",
+ FILENAME, FNR) > stderr;
+ else if (versions[$1] == 0) {
+ printf("File %s, line %d: Undefined " \
+ "library version %s\n", FILENAME, FNR, $1) > stderr;
+ # Remove this entry from the versions.
+ delete versions[$1];
+ }
+ else
+ current_version = $1;
+ brackets++;
+ next;
+}
+
+/^[a-zA-Z0-9._]+ *;$/ {
+ if (current_version != "") {
+ count = versions[current_version];
+ versions[current_version]++;
+ symbols[current_version, count] = $1;
+ }
+ next;
+}
+
+/^} *;$/ {
+ brackets--;
+ if (brackets < 0) {
+ printf("File %s, line %d: Unmatched bracket.\n",
+ FILENAME, FNR, $1) > stderr;
+ brackets = 0; # Reset
+ }
+ current_version = "";
+ next;
+}
+
+
+/.*/ {
+ printf("File %s, line %d: Unknown directive: '%s'\n",
+ FILENAME, FNR, $0) > stderr;
+}
+
+function print_version(v)
+{
+ # This function is recursive, so return if this version
+ # has already been printed. Otherwise, if there is an
+ # ancestral version, recursively print its symbols before
+ # printing the symbols for this version.
+ #
+ if (generated[v] == 1)
+ return;
+ if (successors[v] != "")
+ print_version(successors[v]);
+
+ printf("%s {\n", v);
+
+ # The version count is always one more that actual,
+ # so the loop ranges from 1 to n-1.
+ #
+ for (i = 1; i < versions[v]; i++) {
+ if (i == 1)
+ printf("global:\n");
+ printf("\t%s\n", symbols[v, i]);
+ }
+
+ version_count--;
+ if (version_count == 0) {
+ printf("local:\n");
+ printf("\t*;\n");
+ }
+ if (successors[v] == "")
+ printf("};\n");
+ else
+ printf("} %s;\n", successors[v]);
+ printf("\n");
+
+ generated[v] = 1;
+ }
+END {
+ for (v in versions) {
+ print_version(v);
+ }
+}
Index: bsd.own.mk
===================================================================
RCS file: /home/cvs/src/share/mk/bsd.own.mk,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/mk/bsd.own.mk -L share/mk/bsd.own.mk -u -r1.2 -r1.3
--- share/mk/bsd.own.mk
+++ share/mk/bsd.own.mk
@@ -1,5 +1,5 @@
-# $FreeBSD: src/share/mk/bsd.own.mk,v 1.43 2005/04/11 07:13:29 harti Exp $
# $MidnightBSD$
+# $FreeBSD: src/share/mk/bsd.own.mk,v 1.67.2.2.2.2 2008/01/28 08:57:11 dougb Exp $
#
# The include file <bsd.own.mk> set common variables for owner,
# group, mode, and directories. Defaults are in brackets.
@@ -105,6 +105,13 @@
.if !target(__<bsd.own.mk>__)
__<bsd.own.mk>__:
+.if !defined(_WITHOUT_SRCCONF)
+SRCCONF?= /etc/src.conf
+.if exists(${SRCCONF})
+.include "${SRCCONF}"
+.endif
+.endif
+
# Binaries
BINOWN?= root
BINGRP?= wheel
@@ -156,6 +163,8 @@
NLSGRP?= ${SHAREGRP}
NLSMODE?= ${NOBINMODE}
+DEFAULT_THREAD_LIB?= libthr
+
INCLUDEDIR?= /usr/include
# Common variables
@@ -166,4 +175,329 @@
COMPRESS_CMD?= gzip -cn
COMPRESS_EXT?= .gz
+.if !defined(_WITHOUT_SRCCONF)
+#
+# Define MK_* variables (which are either "yes" or "no") for users
+# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
+# make(1) environment.
+# These should be tested with `== "no"' or `!= "no"' in makefiles.
+# The NO_* variables should only be set by makefiles.
+#
+
+#
+# Supported NO_* options (if defined, MK_* will be forced to "no",
+# regardless of user's setting).
+#
+.for var in \
+ INSTALLLIB \
+ MAN \
+ PROFILE
+.if defined(NO_${var})
+WITHOUT_${var}=
+.endif
+.endfor
+
+#
+# Compat NO_* options (same as above, except their use is deprecated).
+#
+.if !defined(BURN_BRIDGES)
+.for var in \
+ ACPI \
+ ATM \
+ AUDIT \
+ AUTHPF \
+ BIND \
+ BIND_DNSSEC \
+ BIND_ETC \
+ BIND_LIBS_LWRES \
+ BIND_MTREE \
+ BIND_NAMED \
+ BIND_UTILS \
+ BLUETOOTH \
+ BOOT \
+ CALENDAR \
+ CPP \
+ CRYPT \
+ CVS \
+ CXX \
+ DICT \
+ DYNAMICROOT \
+ EXAMPLES \
+ FORTH \
+ FP_LIBC \
+ GAMES \
+ GCOV \
+ GDB \
+ GNU \
+ GPIB \
+ GROFF \
+ HTML \
+ I4B \
+ INET6 \
+ INFO \
+ IPFILTER \
+ IPX \
+ KERBEROS \
+ LIB32 \
+ LIBPTHREAD \
+ LIBTHR \
+ LOCALES \
+ LPR \
+ MAILWRAPPER \
+ NETCAT \
+ NIS \
+ NLS \
+ NLS_CATALOGS \
+ NS_CACHING \
+ OBJC \
+ OPENSSH \
+ OPENSSL \
+ PAM \
+ PF \
+ RCMDS \
+ RCS \
+ RESCUE \
+ SENDMAIL \
+ SETUID_LOGIN \
+ SHAREDOCS \
+ SYSCONS \
+ TCSH \
+ TOOLCHAIN \
+ USB \
+ WPA_SUPPLICANT_EAPOL
+.if defined(NO_${var})
+#.warning NO_${var} is deprecated in favour of WITHOUT_${var}=
+WITHOUT_${var}=
+.endif
+.endfor
+.endif # !defined(BURN_BRIDGES)
+
+#
+# Older-style variables that enabled behaviour when set.
+#
+.if defined(YES_HESIOD)
+WITH_HESIOD=
+.endif
+.if defined(MAKE_IDEA)
+WITH_IDEA=
+.endif
+
+#
+# MK_* options which default to "yes".
+#
+.for var in \
+ ACPI \
+ ASSERT_DEBUG \
+ ATM \
+ AUDIT \
+ AUTHPF \
+ BIND \
+ BIND_DNSSEC \
+ BIND_ETC \
+ BIND_LIBS_LWRES \
+ BIND_MTREE \
+ BIND_NAMED \
+ BIND_UTILS \
+ BLUETOOTH \
+ BOOT \
+ BZIP2 \
+ CALENDAR \
+ CDDL \
+ CPP \
+ CRYPT \
+ CVS \
+ CXX \
+ DICT \
+ DYNAMICROOT \
+ EXAMPLES \
+ FORTH \
+ FP_LIBC \
+ GAMES \
+ GCOV \
+ GDB \
+ GNU \
+ GPIB \
+ GROFF \
+ HTML \
+ I4B \
+ INET6 \
+ INFO \
+ INSTALLLIB \
+ IPFILTER \
+ IPX \
+ KERBEROS \
+ KVM \
+ LIB32 \
+ LIBPTHREAD \
+ LIBKSE \
+ LIBTHR \
+ LOCALES \
+ LPR \
+ MAILWRAPPER \
+ MAN \
+ NCP \
+ NETCAT \
+ NIS \
+ NLS \
+ NLS_CATALOGS \
+ NS_CACHING \
+ OBJC \
+ OPENSSH \
+ OPENSSL \
+ PAM \
+ PF \
+ PROFILE \
+ RCMDS \
+ RCS \
+ RESCUE \
+ SENDMAIL \
+ SETUID_LOGIN \
+ SHAREDOCS \
+ SSP \
+ SYMVER \
+ SYSCONS \
+ TCSH \
+ TOOLCHAIN \
+ USB \
+ WPA_SUPPLICANT_EAPOL \
+ ZONEINFO \
+ ZFS
+.if defined(WITH_${var}) && defined(WITHOUT_${var})
+.error WITH_${var} and WITHOUT_${var} can't both be set.
+.endif
+.if defined(MK_${var})
+.error MK_${var} can't be set by a user.
+.endif
+.if defined(WITHOUT_${var})
+MK_${var}:= no
+.else
+MK_${var}:= yes
+.endif
+.endfor
+
+#
+# MK_* options which default to "no".
+#
+.for var in \
+ BIND_LIBS \
+ HESIOD \
+ IDEA
+.if defined(WITH_${var}) && defined(WITHOUT_${var})
+.error WITH_${var} and WITHOUT_${var} can't both be set.
+.endif
+.if defined(MK_${var})
+.error MK_${var} can't be set by a user.
+.endif
+.if defined(WITH_${var})
+MK_${var}:= yes
+.else
+MK_${var}:= no
+.endif
+.endfor
+
+#
+# Force some options off if their dependencies are off.
+# Order is somewhat important.
+#
+.if ${MK_LIBPTHREAD} == "no"
+MK_LIBKSE:= no
+MK_LIBTHR:= no
+.endif
+
+.if ${MK_LIBKSE} == "no" && ${MK_LIBTHR} == "no"
+MK_BIND:= no
+.endif
+
+.if ${MK_BIND} == "no"
+MK_BIND_DNSSEC:= no
+MK_BIND_ETC:= no
+MK_BIND_LIBS:= no
+MK_BIND_LIBS_LWRES:= no
+MK_BIND_MTREE:= no
+MK_BIND_NAMED:= no
+MK_BIND_UTILS:= no
+.endif
+
+.if ${MK_BIND_MTREE} == "no"
+MK_BIND_ETC:= no
+.endif
+
+.if ${MK_CDDL} == "no"
+MK_ZFS:= no
+.endif
+
+.if ${MK_CRYPT} == "no"
+MK_OPENSSL:= no
+MK_OPENSSH:= no
+MK_KERBEROS:= no
+.endif
+
+.if ${MK_IPX} == "no"
+MK_NCP:= no
+.endif
+
+.if ${MK_OPENSSL} == "no"
+MK_OPENSSH:= no
+MK_KERBEROS:= no
+.endif
+
+.if ${MK_PF} == "no"
+MK_AUTHPF:= no
+.endif
+
+.if ${MK_TOOLCHAIN} == "no"
+MK_GDB:= no
+.endif
+
+#
+# Set defaults for the MK_*_SUPPORT variables.
+#
+
+#
+# MK_*_SUPPORT options which default to "yes" unless their corresponding
+# MK_* variable is set to "no".
+#
+.for var in \
+ BZIP2 \
+ GNU \
+ INET6 \
+ IPX \
+ KERBEROS \
+ KVM \
+ PAM
+.if defined(WITH_${var}_SUPPORT) && defined(WITHOUT_${var}_SUPPORT)
+.error WITH_${var}_SUPPORT and WITHOUT_${var}_SUPPORT can't both be set.
+.endif
+.if defined(MK_${var}_SUPPORT)
+.error MK_${var}_SUPPORT can't be set by a user.
+.endif
+.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
+MK_${var}_SUPPORT:= no
+.else
+MK_${var}_SUPPORT:= yes
+.endif
+.endfor
+
+#
+# MK_* options whose default value depends on another option.
+#
+.for vv in \
+ GSSAPI/KERBEROS
+.if defined(WITH_${vv:H}) && defined(WITHOUT_${vv:H})
+.error WITH_${vv:H} and WITHOUT_${vv:H} can't both be set.
+.endif
+.if defined(MK_${vv:H})
+.error MK_${vv:H} can't be set by a user.
+.endif
+.if defined(WITH_${vv:H})
+MK_${vv:H}:= yes
+.elif defined(WITHOUT_${vv:H})
+MK_${vv:H}:= no
+.else
+MK_${vv:H}:= ${MK_${vv:T}}
+.endif
+.endfor
+
+.endif # !_WITHOUT_SRCCONF
+
.endif # !target(__<bsd.own.mk>__)
Index: Makefile
===================================================================
RCS file: /home/cvs/src/share/mk/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/mk/Makefile -L share/mk/Makefile -u -r1.2 -r1.3
--- share/mk/Makefile
+++ share/mk/Makefile
@@ -9,8 +9,8 @@
FILES+= bsd.lib.mk bsd.libnames.mk bsd.links.mk bsd.man.mk bsd.nls.mk
FILES+= bsd.obj.mk bsd.own.mk
FILES+= bsd.port.mk bsd.port.post.mk bsd.port.pre.mk bsd.port.subdir.mk
-FILES+= bsd.prog.mk bsd.snmpmod.mk bsd.subdir.mk bsd.sys.mk
-FILES+= sys.mk
+FILES+= bsd.prog.mk bsd.snmpmod.mk bsd.subdir.mk bsd.sys.mk bsd.symver.mk
+FILES+= sys.mk version_gen.awk
NO_OBJ=
FILESDIR= ${BINDIR}/mk
--- /dev/null
+++ share/mk/bsd.symver.mk
@@ -0,0 +1,45 @@
+# $MidnightBSD: src/share/mk/bsd.symver.mk,v 1.1 2008/09/03 02:23:05 laffer1 Exp $
+# $FreeBSD: src/share/mk/bsd.symver.mk,v 1.4 2007/05/21 09:01:23 ru Exp $
+
+.if !target(__<bsd.symver.mk>__)
+__<bsd.symver.mk>__:
+
+.include <bsd.init.mk>
+
+# Generate the version map given the version definitions
+# and symbol maps.
+.if ${MK_SYMVER} == "yes" && !empty(VERSION_DEF) && !empty(SYMBOL_MAPS)
+# Find the awk script that generates the version map.
+VERSION_GEN?= version_gen.awk
+VERSION_MAP?= Version.map
+
+CLEANFILES+= ${VERSION_MAP}
+
+# Compute the make's -m path.
+_mpath=
+_oarg=
+.for _arg in ${.MAKEFLAGS}
+.if ${_oarg} == "-m"
+_mpath+= ${_arg}
+.endif
+_oarg= ${_arg}
+.endfor
+_mpath+= /usr/share/mk
+
+# Look up ${VERSION_GEN} in ${_mpath}.
+_vgen=
+.for path in ${_mpath}
+.if empty(_vgen)
+.if exists(${path}/${VERSION_GEN})
+_vgen= ${path}/${VERSION_GEN}
+.endif
+.endif
+.endfor
+
+# Run the symbol maps through the C preprocessor before passing
+# them to the symbol version generator.
+${VERSION_MAP}: ${VERSION_DEF} ${_vgen} ${SYMBOL_MAPS}
+ cat ${SYMBOL_MAPS} | ${CPP} - - \
+ | awk -v vfile=${VERSION_DEF} -f ${_vgen} > ${.TARGET}
+.endif # !empty(VERSION_DEF) && !empty(SYMBOL_MAPS)
+.endif # !target(__<bsd.symver.mk>__)
More information about the Midnightbsd-cvs
mailing list