-1

I am currently learning, how to use make and Makefiles in depth. During that process, one question came up: I have the impression, that a lot of Makefiles first generating object files, and then link them into a library or another executable file.

So my question is: Is this best practice? And if yes, why?

devopsfun
  • 1,368
  • 2
  • 15
  • 37
  • what is the point of using a makefile then if you build everything every time. the point is to build what changed and leave what didnt alone. thus objects or libraries. Use a build script if you dont want to use makefiles. – old_timer May 14 '17 at 19:09
  • Imagine you change a single variable name. Should this force the compiler to compile *all* code again? – Daniel Jour May 14 '17 at 19:09

1 Answers1

1

Generating object files separately from the corresponding source files makes sense in Makefiles because this way there's no need to remake objects files from untouched source files.

Kirill Bulygin
  • 3,658
  • 1
  • 17
  • 23