2

Is the exec keyword required in a Makefile?

build-cache: clean-cache                                    
    @exec ./scripts/copy_packages.sh
    ./scripts/build_makefile.sh
    docker build -t common/cache ./cache

I just noticed that some lines use exec and others do not.

G. Deward
  • 1,542
  • 3
  • 17
  • 30

1 Answers1

6

No (exec is not a keyword in make); you're misparsing the line:

@exec ./scripts/copy_packages.sh

The @ means "do not echo this line" when executing the commands in this 'recipe'. The exec means that the shell that make starts to run the line replaces itself with the script ./scripts/copy_packages.sh.

See also What do @, - and + do as prefixes to recipe lines in make?

Community
  • 1
  • 1
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278