home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / shell / 3149 < prev    next >
Encoding:
Internet Message Format  |  1992-07-27  |  2.3 KB

  1. Path: sparky!uunet!crdgw1!rdsunx.crd.ge.com!rdsunx!montnaro
  2. From: montnaro@ausable.crd.ge.com (Skip Montanaro)
  3. Newsgroups: comp.unix.shell
  4. Subject: Long argument lines generated by Make
  5. Message-ID: <MONTNARO.92Jul27114410@ausable.crd.ge.com>
  6. Date: 27 Jul 92 16:44:10 GMT
  7. Sender: usenet@crd.ge.com (Required for NNTP)
  8. Reply-To: montanaro@crd.ge.com (Skip Montanaro)
  9. Distribution: comp
  10. Organization: GE Corporate Research & Development, Schenectady, NY
  11. Lines: 42
  12. Nntp-Posting-Host: ausable.crd.ge.com
  13.  
  14.  
  15. I have a long list of filenames generated by the Make automatic variable $?
  16. (all dependency files newer than the target) that I'd like to feed to a
  17. depend file generator script. Unfortunately, on many (most? all?) System V
  18. machines the space for environment variables and command line args is too
  19. small.
  20.  
  21. We have three ways of generating this depend target, either link to a
  22. production version (the fastest), perform an update of the local version
  23. (medium fast), or create one from scratch (excruciatingly slow on machines
  24. whose compiler doesn't understand "-M"). The actions for the depend target
  25. look roughly like this (we use GNU make):
  26.  
  27. %.depend : GNUmakefile and lots of other files
  28.     if [ we can link to the production version ] ; then \
  29.         ln -s $(production)/$@ $@ ; \
  30.     elif [ $? is made up of just .c files ] ; then \
  31.         depend -u -f $@ $? ; \
  32.     else \
  33.         depend -f $@ $(filter %.c,$^) ; \
  34.     fi
  35.  
  36. Our System V machines sometimes give us "Arg list too long" errors on the
  37. above command. The test arg in the elif branch and the two depend commands
  38. can each have lots of files, thus combining to making the whole if statement
  39. too long to execute (I think). Both of the individual depend commands are
  40. short enough to run.
  41.  
  42. I'd like to use xargs to generate a series of depend update commands ("xargs
  43. depend -u -f $@"), but I can't think of any way to generate stdin for xargs
  44. that doesn't involve putting most or all of the $? contents on the command
  45. line (using a series of echo commands or a for loop, for instance),
  46. consequently generating an if statement that is too long.
  47.  
  48. Short of breaking up some of the libraries we build into smaller chunks
  49. (which isn't really a viable option), can anybody see a way to get around
  50. the small env/arglist space on System V machines for this problem?
  51.  
  52. Thanks,
  53.  
  54. --
  55. Skip (montanaro@crd.ge.com)
  56.