我了解,在编译多个文件时,可以使用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.


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).