gen-libc-modules.awk 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  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. # Skip over comments.
  12. $1 == "#" {
  13. next
  14. }
  15. # We have only one special case in soversions.i parsing, which is to replace ld
  16. # with rtld since that's what we call it throughout the sources.
  17. match (FILENAME, ".*soversions.i") {
  18. name = $2
  19. if (name == "ld")
  20. name = "rtld"
  21. # Library names are not duplicated in soversions.i.
  22. libs[++num] = name
  23. }
  24. # Finally, print out the header file.
  25. END {
  26. printf ("/* AUTOGENERATED BY gen-libc-modules.awk, DO NOT EDIT. */\n\n")
  27. for (l in libs) {
  28. printf ("#define MODULE_%s %d\n", libs[l], l)
  29. }
  30. }