From a890b593c617e26935252f90f62b1be35759907f Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Thu, 4 Mar 2021 18:01:45 +0200 Subject: Add makefile notes --- doc/makefiles.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 doc/makefiles.md (limited to 'doc/makefiles.md') diff --git a/doc/makefiles.md b/doc/makefiles.md new file mode 100644 index 0000000..cb00c96 --- /dev/null +++ b/doc/makefiles.md @@ -0,0 +1,19 @@ +# How to write makefiles +and useful notes on understanding them + +## Manual +[gnu](https://www.gnu.org/software/make/manual/html_node/index.html) + +## [Variables](https://www.gnu.org/software/make/manual/html_node/Setting.html) +:= expanded variable, right-hand side can contain variables +?= only set if it doesn't have a value +!= execute a shell script on the right-hand side and assign its result to the left-hand side + +## Targets +$@ is target +$< is first dependency +$^ is all dependencies + +## Dependencies +Use compiled -MMD switch to create rules (.d files) +Include .d files for targets using -include (include if available) -- cgit v1.2.1