modules.sh 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #!/bin/sh
  2. #
  3. # BEGIN COPYRIGHT BLOCK
  4. # This Program is free software; you can redistribute it and/or modify it under
  5. # the terms of the GNU General Public License as published by the Free Software
  6. # Foundation; version 2 of the License.
  7. #
  8. # This Program is distributed in the hope that it will be useful, but WITHOUT
  9. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  10. # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License along with
  13. # this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
  14. # Place, Suite 330, Boston, MA 02111-1307 USA.
  15. #
  16. # In addition, as a special exception, Red Hat, Inc. gives You the additional
  17. # right to link the code of this Program with code not covered under the GNU
  18. # General Public License ("Non-GPL Code") and to distribute linked combinations
  19. # including the two, subject to the limitations in this paragraph. Non-GPL Code
  20. # permitted under this exception must only link to the code of this Program
  21. # through those well defined interfaces identified in the file named EXCEPTION
  22. # found in the source code files (the "Approved Interfaces"). The files of
  23. # Non-GPL Code may instantiate templates or use macros or inline functions from
  24. # the Approved Interfaces without causing the resulting work to be covered by
  25. # the GNU General Public License. Only Red Hat, Inc. may make changes or
  26. # additions to the list of Approved Interfaces. You must obey the GNU General
  27. # Public License in all respects for all of the Program code and other code used
  28. # in conjunction with the Program except the Non-GPL Code covered by this
  29. # exception. If you modify this file, you may extend this exception to your
  30. # version of the file, but you are not obligated to do so. If you do not wish to
  31. # provide this exception without modification, you must delete this exception
  32. # statement from your version and license this file solely under the GPL without
  33. # exception.
  34. #
  35. #
  36. # Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  37. # Copyright (C) 2005 Red Hat, Inc.
  38. # All rights reserved.
  39. # END COPYRIGHT BLOCK
  40. #
  41. #
  42. # This is extracted from the 2.0 config shell script to decouple the module
  43. # extraction functionality.
  44. #
  45. # Input: modules.awk
  46. # Output: modules.mk (this will be included in nsconfig.mk)
  47. #
  48. awk '
  49. /^LIBRARY.*/ {
  50. printf "%s:", $2
  51. for (i = 4; i <= NF; i++) printf " %s", $i
  52. printf "\n\tcd %s; $(MAKE) $(MFLAGS)\n", $3
  53. printf "clean_%s:", $2
  54. for (i = 4; i <= NF; i++) printf " clean_%s", $i
  55. printf "\n\tcd %s; $(MAKE) clean\n\n", $3
  56. printf "depend_%s:", $2
  57. for (i = 4; i <= NF; i++) printf " depend_%s", $i
  58. printf "\n\tcd %s; $(MAKE) depend\n\n", $3
  59. printf("else\nclean:");
  60. for (i = 4; i <= NF; i++) printf " clean_%s", $i
  61. printf("\ndepend:");
  62. for (i = 4; i <= NF; i++) printf " depend_%s", $i
  63. printf("\n");
  64. next
  65. }
  66. /^DISTLIB.*/ {
  67. printf "%s:", $2
  68. for (i = 4; i <= NF; i++) printf " %s", $i
  69. printf "\n\tcd %s; $(MAKE) export $(NSDEFS)\n", $3
  70. printf "clean_%s:", $2
  71. for (i = 4; i <= NF; i++) printf " clean_%s", $i
  72. printf "\n\tcd %s; $(MAKE) clean\n\n", $3
  73. printf "depend_%s:", $2
  74. for (i = 4; i <= NF; i++) printf " depend_%s", $i
  75. printf "\n\tcd %s; $(MAKE) depend\n\n", $3
  76. printf("else\nclean:");
  77. for (i = 4; i <= NF; i++) printf " clean_%s", $i
  78. printf("\ndepend:");
  79. for (i = 4; i <= NF; i++) printf " depend_%s", $i
  80. printf("\n");
  81. next
  82. }
  83. /^MODULE.*/ {
  84. printf "%s:", $2
  85. for (i = 4; i <= NF; i++) printf " %s", $i
  86. printf "\n\tcd %s; $(MAKE) $(MFLAGS)\n\n", $3
  87. printf "clean_%s:", $2
  88. for (i = 4; i <= NF; i++) printf " clean_%s", $i
  89. printf "\n\tcd %s; $(MAKE) clean\n\n", $3
  90. printf "depend_%s:", $2
  91. for (i = 4; i <= NF; i++) printf " depend_%s", $i
  92. printf "\n\tcd %s; $(MAKE) depend\n\n", $3
  93. printf("else\nclean:");
  94. for (i = 4; i <= NF; i++) printf " clean_%s", $i
  95. printf("\ndepend:");
  96. for (i = 4; i <= NF; i++) printf " depend_%s", $i
  97. printf("\n");
  98. next
  99. }
  100. /^PACKAGE.*/ {
  101. printf "%s:", $2
  102. for (i = 3; i <= NF; i++) printf " %s", $i
  103. printf "\nclean_%s:", $2
  104. for (i = 3; i <= NF; i++) printf " clean_%s", $i
  105. printf "\ndepend_%s:", $2
  106. for (i = 3; i <= NF; i++) printf " depend_%s", $i
  107. printf("\n");
  108. next
  109. }
  110. {print} ' modules.awk > modules.mk