Blame scripts/gen-libc-modules.awk

Packit 6c4009
# Generate a header file that defines the MODULE_* macros for each library and
Packit 6c4009
# module we build in glibc.  The library names are pulled in from soversions.i
Packit 6c4009
# and the additional modules are passed in the BUILDLIST variable.
Packit 6c4009
BEGIN {
Packit 6c4009
  # BUILDLIST is set from the build-list variable in Makeconfig and is a space
Packit 6c4009
  # separated list of non-library modules that we build in glibc.
Packit 6c4009
  num = split (buildlist, libs, " ")
Packit 6c4009
  # Separate the built modules from the libraries.
Packit 6c4009
  libs[++num] = "LIBS_BEGIN"
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
# Skip over comments.
Packit 6c4009
$1 == "#" {
Packit 6c4009
  next
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
# We have only one special case in soversions.i parsing, which is to replace ld
Packit 6c4009
# with rtld since that's what we call it throughout the sources.
Packit 6c4009
match (FILENAME, ".*soversions.i") {
Packit 6c4009
  name = $2
Packit 6c4009
  if (name == "ld")
Packit 6c4009
    name = "rtld"
Packit 6c4009
Packit 6c4009
  # Library names are not duplicated in soversions.i.
Packit 6c4009
  libs[++num] = name
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
# Finally, print out the header file.
Packit 6c4009
END {
Packit 6c4009
  printf ("/* AUTOGENERATED BY gen-libc-modules.awk, DO NOT EDIT.  */\n\n")
Packit 6c4009
  for (l in libs) {
Packit 6c4009
    printf ("#define MODULE_%s %d\n", libs[l], l)
Packit 6c4009
  }
Packit 6c4009
}