home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / ncurses-1.9.9e-src.tgz / tar.out / fsf / ncurses / mk-2nd.awk < prev    next >
Text File  |  1996-09-28  |  1KB  |  54 lines

  1. # Generate compile-rules for the modules that we are using in libraries or
  2. # programs.  We are listing them explicitly because we have turned off the
  3. # suffix rules (to force compilation with the appropriate flags).  We could use
  4. # make-recursion but that would result in makefiles that are useless for
  5. # development.
  6. #
  7. # Variables:
  8. #    model
  9. #    MODEL (uppercase version of "model"; toupper is not portable)
  10. #    echo (yes iff we will show the $(CC) lines)
  11. #
  12. # Fields in src/modules:
  13. #    $1 = module name
  14. #    $2 = progs|lib|c++
  15. #    $3 = source-directory
  16. #
  17. # Fields in src/modules past $3 are dependencies
  18. #
  19. BEGIN    {
  20.     print  ""
  21.     }
  22.     {
  23.     if ( $1 != "#" && $1 != "" ) {
  24.         print  ""
  25.         if ( $2 == "c++" ) {
  26.             compile="CXX"
  27.             suffix=".cc"
  28.         } else {
  29.             compile="CC"
  30.             suffix=".c"
  31.         }
  32.         printf "../%s/%s.o :\t%s/%s%s", model, $1, $3, $1, suffix
  33.         for (n = 4; n <= NF; n++) printf " \\\n\t\t\t%s", $n
  34.         print  ""
  35.         if ( echo == "yes" )
  36.             atsign=""
  37.         else {
  38.             atsign="@"
  39.             printf "\t@echo 'compiling %s (%s)'\n", $1, model
  40.         }
  41.         if ( $3 == "." || srcdir == "." )
  42.             printf "\t%scd ../%s; $(%s) $(CFLAGS_%s) -c ../%s/%s%s", atsign, model, compile, MODEL, name, $1, suffix
  43.         else
  44.             printf "\t%scd ../%s; $(%s) $(CFLAGS_%s) -c %s/%s%s", atsign, model, compile, MODEL, $3, $1, suffix
  45.     } else {
  46.         printf "%s", $1
  47.         for (n = 2; n <= NF; n++) printf " %s", $n
  48.     }
  49.     print  ""
  50.     }
  51. END    {
  52.     print  ""
  53.     }
  54.