modules.sh 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. # do so, delete this exception statement from your version.
  32. #
  33. #
  34. # Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  35. # Copyright (C) 2005 Red Hat, Inc.
  36. # All rights reserved.
  37. # END COPYRIGHT BLOCK
  38. #
  39. #
  40. # This is extracted from the 2.0 config shell script to decouple the module
  41. # extraction functionality.
  42. #
  43. # Input: modules.awk
  44. # Output: modules.mk (this will be included in nsconfig.mk)
  45. #
  46. awk '
  47. /^LIBRARY.*/ {
  48. printf "%s:", $2
  49. for (i = 4; i <= NF; i++) printf " %s", $i
  50. printf "\n\tcd %s; $(MAKE) $(MFLAGS)\n", $3
  51. printf "clean_%s:", $2
  52. for (i = 4; i <= NF; i++) printf " clean_%s", $i
  53. printf "\n\tcd %s; $(MAKE) clean\n\n", $3
  54. printf "depend_%s:", $2
  55. for (i = 4; i <= NF; i++) printf " depend_%s", $i
  56. printf "\n\tcd %s; $(MAKE) depend\n\n", $3
  57. printf("else\nclean:");
  58. for (i = 4; i <= NF; i++) printf " clean_%s", $i
  59. printf("\ndepend:");
  60. for (i = 4; i <= NF; i++) printf " depend_%s", $i
  61. printf("\n");
  62. next
  63. }
  64. /^DISTLIB.*/ {
  65. printf "%s:", $2
  66. for (i = 4; i <= NF; i++) printf " %s", $i
  67. printf "\n\tcd %s; $(MAKE) export $(NSDEFS)\n", $3
  68. printf "clean_%s:", $2
  69. for (i = 4; i <= NF; i++) printf " clean_%s", $i
  70. printf "\n\tcd %s; $(MAKE) clean\n\n", $3
  71. printf "depend_%s:", $2
  72. for (i = 4; i <= NF; i++) printf " depend_%s", $i
  73. printf "\n\tcd %s; $(MAKE) depend\n\n", $3
  74. printf("else\nclean:");
  75. for (i = 4; i <= NF; i++) printf " clean_%s", $i
  76. printf("\ndepend:");
  77. for (i = 4; i <= NF; i++) printf " depend_%s", $i
  78. printf("\n");
  79. next
  80. }
  81. /^MODULE.*/ {
  82. printf "%s:", $2
  83. for (i = 4; i <= NF; i++) printf " %s", $i
  84. printf "\n\tcd %s; $(MAKE) $(MFLAGS)\n\n", $3
  85. printf "clean_%s:", $2
  86. for (i = 4; i <= NF; i++) printf " clean_%s", $i
  87. printf "\n\tcd %s; $(MAKE) clean\n\n", $3
  88. printf "depend_%s:", $2
  89. for (i = 4; i <= NF; i++) printf " depend_%s", $i
  90. printf "\n\tcd %s; $(MAKE) depend\n\n", $3
  91. printf("else\nclean:");
  92. for (i = 4; i <= NF; i++) printf " clean_%s", $i
  93. printf("\ndepend:");
  94. for (i = 4; i <= NF; i++) printf " depend_%s", $i
  95. printf("\n");
  96. next
  97. }
  98. /^PACKAGE.*/ {
  99. printf "%s:", $2
  100. for (i = 3; i <= NF; i++) printf " %s", $i
  101. printf "\nclean_%s:", $2
  102. for (i = 3; i <= NF; i++) printf " clean_%s", $i
  103. printf "\ndepend_%s:", $2
  104. for (i = 3; i <= NF; i++) printf " depend_%s", $i
  105. printf("\n");
  106. next
  107. }
  108. {print} ' modules.awk > modules.mk