File: gen-libc-modules.awk

package info (click to toggle)
glibc 2.31-13%2Bdeb11u3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 278,368 kB
  • sloc: ansic: 1,025,361; asm: 256,790; makefile: 12,097; sh: 10,548; python: 9,618; cpp: 5,233; awk: 1,956; perl: 514; yacc: 290; pascal: 182; sed: 73
file content (34 lines) | stat: -rw-r--r-- 1,049 bytes parent folder | download | duplicates (28)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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)
  }
}