123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- #!/bin/sh -x
- # helper script to run make using GNU AWK with colorizing in development.
- /*
- * Copyright 2021 籽籮籮 籵籮籮籯类籲籷籰
- *
- * This includes splay Copyright (C) 1998-2021 Free Software Foundation, Inc.
- * This includes Copyright (C) 2008, 2011 Matthias Stallmann, Saurabh Gupta.
- * This includes Copyright (C) 2009 MiptVis GNU GPL version 3+ Boris Shurygin
- * Junio H Hamano gitster@pobox.com
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * These are the four essential freedoms with GNU GPL software:
- * 1: freedom to run the program, for any purpose
- * 2: freedom to study how the program works, and change it to make it do what you wish
- * 3: freedom to redistribute copies to help your Free Software friends
- * 4: freedom to distribute copies of your modified versions to your Free Software friends
- * , ,
- * / \
- * ((__-^^-,-^^-__))
- * `-_---' `---_-'
- * `--|o` 'o|--'
- * \ ` /
- * ): :(
- * :o_o:
- * "-"
- *
- * SPDX-License-Identifier: GPL-3.0+
- * License-Filename: LICENSE
- */
- #
- # /*
- # *
- # * This program is free software: you can redistribute it and/or modify
- # * it under the terms of the GNU General Public License as published by
- # * the Free Software Foundation, either version 3 of the License, or
- # * (at your option) any later version.
- # *
- # * This program is distributed in the hope that it will be useful,
- # * but WITHOUT ANY WARRANTY; without even the implied warranty of
- # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # * GNU General Public License for more details.
- # *
- # * You should have received a copy of the GNU General Public License
- # * along with this program. If not, see <http://www.gnu.org/licenses/>.
- # *
- # * The four essential freedoms with GNU GPL software:
- # * The freedom to run the program, for any purpose
- # * The freedom to study how the program works, and change it to make it do what you wish
- # * The freedom to redistribute copies so you can help others
- # * The freedom to distribute copies of your modified versions to others
- # *
- # * SPDX-License-Identifier: GPL-3.0+
- # * License-Filename: LICENSE
- # */
- #
- # GNU / Linux is user-friendly. It's just particular who its friends are :)
- #
- # Only for GNU LINUX console:
- #
- # \033 ascii ESCape
- # \033[<NUM>G move to column <NUM> (linux console, xterm, not vt100)
- # \033[<NUM>C move <NUM> columns forward but only upto last column
- # \033[<NUM>D move <NUM> columns backward but only upto first column
- # \033[<NUM>A move <NUM> rows up
- # \033[<NUM>B move <NUM> rows down
- # \033[1m switch on bold
- # \033[31m switch on red
- # \033[32m switch on green
- # \033[33m switch on yellow
- # \033[m switch off color/bold
- # \017 exit alternate mode (xterm, vt100, linux console)
- # \033[10m exit alternate mode (linux console)
- # \015 carriage return (without newline)
- # Black 0;30 Dark Gray 1;30
- # Blue 0;34 Light Blue 1;34
- # Green 0;32 Light Green 1;32
- # Cyan 0;36 Light Cyan 1;36
- # Red 0;31 Light Red 1;31
- # Purple 0;35 Light Purple 1;35
- # Brown 0;33 Yellow 1;33
- # Light Gray 0;37 White 1;37
- #
- # normally 4 args to make should be oke. otherwise argv() to do.
- # add colors for enter/leave dir
- # if errors then run script to mailto or otherwise
- # if errors then run script to start emacs on the file
- # this cn run with GNU gawk and mawk on debian Linux
- rm -v -f dsmake.output
- rm -v -f dsmake.errors
- rm -v -f dsmake.warnings
- make $1 $2 $3 $4 2>&1 |
- gawk '
- function toul() { print "\033[4m"; }
- function tobold() { print "\033[36m"; }
- function isentermakedir(thetext) { n = match(thetext, /[ ]Entering/); return n; }
- function isleavemakedir(thetext) { n = match(thetext, /[ ]Leaving/); return n; }
- function isgccerr(thetext) { n = match(thetext, /[ ]error:/); return n; }
- function isgccwarning(thetext) { n = match(thetext, /[ ]warning:/); return n; }
- BEGIN { tobold(); print "\033[34m"; print ":)" > "dsmake.output" }
- /^/ { 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; }
- END { print "end of make" > "dsmake.output"; print "\033[37m"; print "\033[10m"; }
- '
- # end.
|