#!/usr/bin/env perl # # This script may be used to generate a minimized 'help' recipe # from the readable version of the code in the Makefile. # # Just pipe the entire Makefile through this script. $_ = join "", map { chomp; s/^# *//; $_ } grep { /^# \@awk/ .. 0 } <>; # remove whitespace around operators, statements and blocks s/ ([+=<>~]|[-+<>=]=|!~|&&|\|\|) /$1/g; s/([;{}(),]) (?!#)/$1/g; s/ ([{}()])(?!")/$1/g; s/\$(?!\()/\$\$/g; s/;}/}/g; # shorten variable names s/\bhang\b/a/g; s/\bbuffer\b/b/g; s/\bcolor\b/c/g; s/\bdesc\b/d/g; s/\bfields\b/f/g; s/\btarget\b(?!>)/g/g; s/\bheader\b/h/g; s/\bnocolor\b/m/g; s/\bpad\b/p/g; s/\bparts\b/q/g; s/\bstr\b/s/g; s/\btrim\b/t/g; s/\bspout\b/u/g; s/\bindent\b/y/g; # leftover corrections s/(printf?) /$1/g; s/ (tab) /$1/g; s/" y/"y/g; s/b \$/b\$/g; s/(BEGIN{[^{}]+;)b="";/$1/g; print;