home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / docs / src / makefile2html.gawk < prev    next >
Encoding:
Text File  |  1997-01-24  |  891 b   |  49 lines

  1. BEGIN {
  2.     active=0;
  3. }
  4. /^\#[ \t]+BEGIN_DESC/ {
  5.     active=1;
  6.     match($0,/{.*}/);
  7.     section=substr($0,RSTART+1,RLENGTH-2);
  8.     next
  9. }
  10. /^\#[ \t]+END_DESC/ {
  11.     active=0;
  12.     next
  13. }
  14. /^\#/ {
  15.     if (active)
  16.     {
  17.     line=$0;
  18.     gsub(/^\#[ \t]*/,"",line);
  19.     sections[section]=sections[section] line "\n";
  20.     }
  21. }
  22. END {
  23.     if ("makefile" in sections)
  24.     {
  25.     print sections["makefile"];
  26.     }
  27.  
  28.     nfilt=split(secfilt,a_filt,/,[ \t]+/);
  29.     for (t=1; t<=nfilt; t++)
  30.     {
  31.     if (a_filt[t] in sections)
  32.     {
  33.         if (section=="makefile")
  34.         {
  35.         # nop
  36.         }
  37.         else if (section=="target")
  38.         print "This makefile defines the following targets:"
  39.         else if (section=="makevar")
  40.         print "This makefile defines the following targets:"
  41.         else
  42.         print "The section "section" contains:"
  43.         print "\\begin{description}\n"
  44.         print sections[section]
  45.         print "\n\\end{description}\n"
  46.     }
  47.     }
  48. }
  49.