about summary refs log tree commit diff
path: root/REORG.TODO/scripts/gen-libc-modules.awk
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2017-06-08 15:39:03 -0400
committerZack Weinberg <zackw@panix.com>2017-06-08 15:39:03 -0400
commit5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 (patch)
tree4470480d904b65cf14ca524f96f79eca818c3eaf /REORG.TODO/scripts/gen-libc-modules.awk
parent199fc19d3aaaf57944ef036e15904febe877fc93 (diff)
downloadglibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.tar.gz
glibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.tar.xz
glibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.zip
Prepare for radical source tree reorganization. zack/build-layout-experiment
All top-level files and directories are moved into a temporary storage
directory, REORG.TODO, except for files that will certainly still
exist in their current form at top level when we're done (COPYING,
COPYING.LIB, LICENSES, NEWS, README), all old ChangeLog files (which
are moved to the new directory OldChangeLogs, instead), and the
generated file INSTALL (which is just deleted; in the new order, there
will be no generated files checked into version control).
Diffstat (limited to 'REORG.TODO/scripts/gen-libc-modules.awk')
-rw-r--r--REORG.TODO/scripts/gen-libc-modules.awk34
1 files changed, 34 insertions, 0 deletions
diff --git a/REORG.TODO/scripts/gen-libc-modules.awk b/REORG.TODO/scripts/gen-libc-modules.awk
new file mode 100644
index 0000000000..2f92cd41b2
--- /dev/null
+++ b/REORG.TODO/scripts/gen-libc-modules.awk
@@ -0,0 +1,34 @@
+# Generate a header file that defines the MODULE_* macros for each library and
+# module we build in glibc.  The library names are pulled in from soversions.i
+# and the additional modules are passed in the BUILDLIST variable.
+BEGIN {
+  # BUILDLIST is set from the build-list variable in Makeconfig and is a space
+  # separated list of non-library modules that we build in glibc.
+  num = split (buildlist, libs, " ")
+  # Separate the built modules from the libraries.
+  libs[++num] = "LIBS_BEGIN"
+}
+
+# Skip over comments.
+$1 == "#" {
+  next
+}
+
+# We have only one special case in soversions.i parsing, which is to replace ld
+# with rtld since that's what we call it throughout the sources.
+match (FILENAME, ".*soversions.i") {
+  name = $2
+  if (name == "ld")
+    name = "rtld"
+
+  # Library names are not duplicated in soversions.i.
+  libs[++num] = name
+}
+
+# Finally, print out the header file.
+END {
+  printf ("/* AUTOGENERATED BY gen-libc-modules.awk, DO NOT EDIT.  */\n\n")
+  for (l in libs) {
+    printf ("#define MODULE_%s %d\n", libs[l], l)
+  }
+}