dmake 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #!/bin/sh -x
  2. # helper script to run make using GNU AWK with colorizing in development.
  3. /*
  4. * Copyright 2021 籽籮籮 籵籮籮籯类籲籷籰
  5. *
  6. * This includes splay Copyright (C) 1998-2021 Free Software Foundation, Inc.
  7. * This includes Copyright (C) 2008, 2011 Matthias Stallmann, Saurabh Gupta.
  8. * This includes Copyright (C) 2009 MiptVis GNU GPL version 3+ Boris Shurygin
  9. * Junio H Hamano gitster@pobox.com
  10. *
  11. * This program is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation, either version 3 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. * These are the four essential freedoms with GNU GPL software:
  25. * 1: freedom to run the program, for any purpose
  26. * 2: freedom to study how the program works, and change it to make it do what you wish
  27. * 3: freedom to redistribute copies to help your Free Software friends
  28. * 4: freedom to distribute copies of your modified versions to your Free Software friends
  29. * , ,
  30. * / \
  31. * ((__-^^-,-^^-__))
  32. * `-_---' `---_-'
  33. * `--|o` 'o|--'
  34. * \ ` /
  35. * ): :(
  36. * :o_o:
  37. * "-"
  38. *
  39. * SPDX-License-Identifier: GPL-3.0+
  40. * License-Filename: LICENSE
  41. */
  42. #
  43. # /*
  44. # *
  45. # * This program is free software: you can redistribute it and/or modify
  46. # * it under the terms of the GNU General Public License as published by
  47. # * the Free Software Foundation, either version 3 of the License, or
  48. # * (at your option) any later version.
  49. # *
  50. # * This program is distributed in the hope that it will be useful,
  51. # * but WITHOUT ANY WARRANTY; without even the implied warranty of
  52. # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  53. # * GNU General Public License for more details.
  54. # *
  55. # * You should have received a copy of the GNU General Public License
  56. # * along with this program. If not, see <http://www.gnu.org/licenses/>.
  57. # *
  58. # * The four essential freedoms with GNU GPL software:
  59. # * The freedom to run the program, for any purpose
  60. # * The freedom to study how the program works, and change it to make it do what you wish
  61. # * The freedom to redistribute copies so you can help others
  62. # * The freedom to distribute copies of your modified versions to others
  63. # *
  64. # * SPDX-License-Identifier: GPL-3.0+
  65. # * License-Filename: LICENSE
  66. # */
  67. #
  68. # GNU / Linux is user-friendly. It's just particular who its friends are :)
  69. #
  70. # Only for GNU LINUX console:
  71. #
  72. # \033 ascii ESCape
  73. # \033[<NUM>G move to column <NUM> (linux console, xterm, not vt100)
  74. # \033[<NUM>C move <NUM> columns forward but only upto last column
  75. # \033[<NUM>D move <NUM> columns backward but only upto first column
  76. # \033[<NUM>A move <NUM> rows up
  77. # \033[<NUM>B move <NUM> rows down
  78. # \033[1m switch on bold
  79. # \033[31m switch on red
  80. # \033[32m switch on green
  81. # \033[33m switch on yellow
  82. # \033[m switch off color/bold
  83. # \017 exit alternate mode (xterm, vt100, linux console)
  84. # \033[10m exit alternate mode (linux console)
  85. # \015 carriage return (without newline)
  86. # Black 0;30 Dark Gray 1;30
  87. # Blue 0;34 Light Blue 1;34
  88. # Green 0;32 Light Green 1;32
  89. # Cyan 0;36 Light Cyan 1;36
  90. # Red 0;31 Light Red 1;31
  91. # Purple 0;35 Light Purple 1;35
  92. # Brown 0;33 Yellow 1;33
  93. # Light Gray 0;37 White 1;37
  94. #
  95. # normally 4 args to make should be oke. otherwise argv() to do.
  96. # add colors for enter/leave dir
  97. # if errors then run script to mailto or otherwise
  98. # if errors then run script to start emacs on the file
  99. # this cn run with GNU gawk and mawk on debian Linux
  100. rm -v -f dsmake.output
  101. rm -v -f dsmake.errors
  102. rm -v -f dsmake.warnings
  103. make $1 $2 $3 $4 2>&1 |
  104. gawk '
  105. function toul() { print "\033[4m"; }
  106. function tobold() { print "\033[36m"; }
  107. function isentermakedir(thetext) { n = match(thetext, /[ ]Entering/); return n; }
  108. function isleavemakedir(thetext) { n = match(thetext, /[ ]Leaving/); return n; }
  109. function isgccerr(thetext) { n = match(thetext, /[ ]error:/); return n; }
  110. function isgccwarning(thetext) { n = match(thetext, /[ ]warning:/); return n; }
  111. BEGIN { tobold(); print "\033[34m"; print ":)" > "dsmake.output" }
  112. /^/ { print $0 > "dsmake.output"; print "\033[34m"; if(isgccerr($0)) { print "\033[31m"; print $0 > "dsmake.errors"; } ; if(isgccwarning($0)) { print "\033[35m"; print $0 > "dsmake.warnings" } ; print $0; next; }
  113. END { print "end of make" > "dsmake.output"; print "\033[37m"; print "\033[10m"; }
  114. '
  115. # end.