Makefile说明。了解别人的Makefile

我对Linux编程比较陌生。

我了解,在编译多个文件时,可以使用Makefile来简化编译过程。 不必每次需要编译和运行程序时都编写“ g ++ main.cpp x.cpp y.cpp -o可执行文件”,而是可以将其放入Makefile并在该目录中运行make。

I am trying to get a RPi and Arduino to communicate with each other using the nRF24L01 radios using tmrh20's library here. I have been successful using tmrh20's Makefile to build the the executable needed (on the RPi). I would like to, however, use tmrh20's library to build my own executables.

我已经看过关于Makefile的一些教程视频,但似乎仍然无法拼凑出tmrh20的情况。

The Makefile (1) in question is here. I believe it is somehow referencing a second Makefile (2) (for filenames?) here. (Why is this necessary?)

If it helps anyone understand (it took me a while) I had to build using SPIDEV (the instructions here) the Makefile (3) in the RF24 directory which produced several object files which I think are relevant to Makefile (1)&(2).

我如何从tmrh20的Makefile中找出制作我自己的Makefile所需的文件(如果这很有意义?)他似乎在Makefile中使用了未定义的变量?还是在其他地方定义?

对我的解释不力表示歉意。