Sublime Forum

Creating makefiles without .make extension

#1

So I spent an embarrassing amount of time trying to figure out why the makefile I created in ST couldn’t be found by make. It turns out I just had to delete the .make extension.

Is there any way I can just save my makefile without the extension? I’m doing this on Mac OS X 10.12, and apparently removing extensions is more involved than just renaming the file. Not only that, but when I do remove the extension, after saving my makefile again, Sublime Text saves a new makefile.make.

I guess I’m just going to have to create a makefile that includes the one I create in Sublime. But it would be useful to know how to create these without the .make extension.

Sorry if this sounds like a dumb question.

0 Likes

#2

The easiest way to create such a file is to save it under the name of Makefile before you set the syntax of the new file to be Makefile. Since the file is assumed to be plain text, it should accept the name with no extension and save it, and as soon as it’s saved the correct syntax is automatically applied and you’re good to go.

Apart from that, despite any protestations that MacOS might have about you renaming the file to not have an extension, it should be safe to do so if you’re used to working with Makefiles without any extension.

A bit of playing around shows that this behaves slightly differently based on the operating system that you use. Saving a file for the first time when it has a syntax set makes the Save dialog select an appropriate file type, which makes the OS suggest an extension to use for the file.

On Linux (at least my distribution), it accepts whatever I tell it, so it’s easy to make a file with no extension.

On Windows, if I just enter the filename Makefile it seems to detect that I don’t have an extension on the file and adds .make, but if I use the filename Makefile. (trailing period), it leaves the file with no extension.

On MacOS, entering Makefile ends me up with a Makefile.make and using Makefile. gets me a filename of Makefile..make, which is even less helpful.

This all seems to point out that at some level what the eventual file name is set to is either controlled by the OS, or Sublime is following an OS specific rule to try and behave like other applications on the same OS would act.

2 Likes