I have a code repository with a top level Makefile for a C project. On pressing Ctrl+B, it tries the C++ single file build and does not use the top level Makefile. Based on searches in the forum (and prior use), it seems that it should automatically use the top level Makefile for this type of projects. I recently installed the SublimeREPL package which may be linked to this problem as I was able to build with top level Makefiles before in this code repository.
Top level Makefile not used for build
I agree that it should do that by default because for my own uses I have a Makefile in every directory and I had to use a custom build to stop it from using the root file. I don’t use SublimeREPL so I can’t say if that might conflict, though.
Is the folder with the top level Makefile a part of the current project or a folder that you’ve opened? If it’s part of a folder, have you opened more than one and the first one isn’t the one with the Makefile in it?
The working directory for Makefie.sublime-build is:
"working_dir": "${folder:${project_path:${file_path}}}",
Which should expand to the open folder, or the project path, or the path of the current file in that order, I believe.
According to the unofficial docs, folder expands to the first opened folder and project_path is the directory that the current project file is stored in. So if the Makefile is not in one of those locations (depending on how you’re doing it) that might be why.
This is certainly related to SublimeREPL. I tried a few times after enabling and disabling the package. Whenever enabled, the Makefile was not used. When disabled, it was fine.