~lobisquit/Makefile.version

1bea64cf — Enrico Lovisotto 8 months ago
Added bear command for LSP support
d71bc9d0 — Enrico Lovisotto 11 months ago
Changed to MIT license
4466ebd3 — Enrico Lovisotto 1 year, 23 days ago
Better intro.

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~lobisquit/Makefile.version
read/write
git@git.sr.ht:~lobisquit/Makefile.version

You can also use your local clone with git send-email.

#C template project

This project shows an example Makefile project with nice functionalities built in.

#Header file awareness

Make cannot know if a C target object depends on an header file. Typically the target depends only on the corresponding source, as only the compiler knows which header files are included.

Here this knowledge is added to Makefile, via GCC "-MM" functionality. Only the list of SOURCES is needed, everything else is automatic.

One .d file per each is created from each source file, containing the list of headers as a target dependency for the object. The .d file depends itself on the list of source inputs, as an include may be added in the code making it obsolete.

#Version control awareness

It is enhanced with the Makefile.version file that provides

  • GIT_COMMIT_HASH variable to use, for example, in preprocessors #define
  • no-uncommitted-changes target to append as a dependency to all targets that need everything to be committed before building them

If the release program

  1. is built with no-uncommitted-changes as a dependency
  2. logs to the user its commit, meaning GIT_COMMIT_HASH

one can exactly match each release executable with a commit.

This hopefully makes support easier, as developers can see the exact code that is run in the user machine.