如何调用子makefile而不硬编码其路径?

如何调用子makefile而不硬编码其路径?,makefile,gnu-make,makefile-project,multiple-makefiles,Makefile,Gnu Make,Makefile Project,Multiple Makefiles,我的文件夹结构如下: ./Makefile ./template ./template/Makefile ./template/html/ ./template/html/Makefile ./template/latex/ ./template/latex/Makefile ./template/latex/foo/ ./template/latex/foo/Makefile ./template/latex/bar/ ./template/latex/bar/Makefile ./... #

我的文件夹结构如下:

./Makefile
./template
./template/Makefile
./template/html/
./template/html/Makefile
./template/latex/
./template/latex/Makefile
./template/latex/foo/
./template/latex/foo/Makefile
./template/latex/bar/
./template/latex/bar/Makefile
./... # a lot more
(文件夹结构可能嵌套得更多)

如何调用./template/latex/bar/Makefile(来自它的
all
目标),而不硬编码Makefile的路径

最好的情况是能够这样称呼它:

make latex/bar # for the latex/bar template
make latex     # for all latex templates
make html      # for all html templates
make           # for all templates

是否希望每个makefile运行直接子目录中的所有makefiles?否,我希望能够从顶层makefile中的子makefile调用目标。是否仅从顶层调用任何子目录中的目标?或者是任何子目录中的任何子目录?您是要直接转到目标子目录,还是要在途中遍历每个嵌套子目录
Makefile