bayaz, (edited )

Quick question about Makefiles: is there any reason to put recipe lines inside parens? I'm not asking about variable expansion -- I mean an entire line. For example, see SuiteSparse: https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/dev/Makefile

Normally, you would use parens to make sure you don't mess with your state, but each line of a recipe in GNU Make is effectively run in its own environment anyway.

I've seen it a few places now, so just wondering whether it is simply stylistic preference or if there is some effect I'm missing.

EDIT: Okay, did find one case where it could matter, although it doesn't apply in SuiteSparse. If you use the .ONESHELL special target, then all lines of your recipes run in a single shell, rather than each getting their own shell. In that case, if you wanted to get back something like the original new-shell-per-line behavior, you could wrap lines in parens as described above. TIL.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • uselessserver093
  • Food
  • aaaaaaacccccccce
  • [email protected]
  • test
  • CafeMeta
  • testmag
  • MUD
  • RhythmGameZone
  • RSS
  • dabs
  • Socialism
  • KbinCafe
  • TheResearchGuardian
  • Ask_kbincafe
  • oklahoma
  • feritale
  • SuperSentai
  • KamenRider
  • All magazines