logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

modules.awk (814B)


  1. BEGIN {
  2. while (getline < sources) {
  3. if ($0 ~ /^(#|$)/)
  4. continue
  5. all_modules[++n] = $1
  6. }
  7. enabled["core"] = 1
  8. enabled["errlog"] = 1
  9. enabled["conf"] = 1
  10. enabled["events"] = 1
  11. enabled["event_core"] = 1
  12. enabled["epoll"] = 1
  13. }
  14. /^(#|$)/ { next }
  15. {
  16. enabled[$0] = 1
  17. }
  18. END {
  19. for (i = 1; i <= n; ++i) {
  20. module = all_modules[i]
  21. if (enabled[module])
  22. modules[++m] = module
  23. }
  24. print "#include <ngx_config.h>"
  25. print "#include <ngx_core.h>"
  26. for (i = 1; i <= m; ++i)
  27. print "extern ngx_module_t ngx_" modules[i] "_module;"
  28. print "ngx_module_t *ngx_modules[] = {"
  29. for (i = 1; i <= m; ++i)
  30. print "\t&ngx_" modules[i] "_module,"
  31. print "\tNULL"
  32. print "};"
  33. print "char *ngx_module_names[] = {"
  34. for (i = 1; i <= m; ++i)
  35. print "\t\"ngx_" modules[i] "_module\","
  36. print "\tNULL"
  37. print "};"
  38. }