Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
A Shallow Dive into GNU Make (memfault.com)
10 points by fra on March 4, 2020 | hide | past | favorite | 3 comments


The one common paradigm of Makefiles I'm enjoying (and using myself) is the pattern for enabling more verbose logging.

  ifeq ($(V),1)
  Q :=
  else
  Q := @
  endif

  somerule: 
    $(Q)$(CC) -c $^ -o $@

  $ make V=1
It's mentioned in this article and I suggest everyone use it in their Makefiles, for when the time comes for me and others to debug it.


There's no need to write $(V) and $(Q) since they are single letter variables you can just do $V or $Q. Of course, you may prefer the more verbose version.


While CMake & Bazel are gaining in popularity, Make is still the de-facto standard for firmware projects. It certainly is miles better than some of the XML-based, GUI-first build systems IDEs bundled with Keil or IAR.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: