[v3,0/7] Fix some libm static issues
[platform/upstream/glibc.git] / scripts / gen-libc-modules.awk
1 # Generate a header file that defines the MODULE_* macros for each library and
2 # module we build in glibc.  The library names are pulled in from soversions.i
3 # and the additional modules are passed in the BUILDLIST variable.
4 BEGIN {
5   # BUILDLIST is set from the build-list variable in Makeconfig and is a space
6   # separated list of non-library modules that we build in glibc.
7   num = split (buildlist, libs, " ")
8   # Separate the built modules from the libraries.
9   libs[++num] = "LIBS_BEGIN"
10 }
11
12 # Skip over comments.
13 $1 == "#" {
14   next
15 }
16
17 # We have only one special case in soversions.i parsing, which is to replace ld
18 # with rtld since that's what we call it throughout the sources.
19 match (FILENAME, ".*soversions.i") {
20   name = $2
21   if (name == "ld")
22     name = "rtld"
23
24   # Library names are not duplicated in soversions.i.
25   libs[++num] = name
26 }
27
28 # Finally, print out the header file.
29 END {
30   printf ("/* AUTOGENERATED BY gen-libc-modules.awk, DO NOT EDIT.  */\n\n")
31   for (l in libs) {
32     printf ("#define MODULE_%s %d\n", libs[l], l)
33   }
34 }