Everything Frontend

Dealing With Makefiles in IntelliJ

Lately I’ve started to use Makefiles for my frontend projects for their simplicity. In fact a combination of make + webpack + karma/mocha has been working quite well and saves me from installing three hundred gulp / grunt plugins since I can do most of the file manipulation just in bash.

WARNING: This article is outdated and is kept only for search rating.

Please use Intellij Makefile Plugin instead

A minor annoyance that has been bugging me is lack of the support for Makefile in IntelliJ. Of course you can install C/C++ language for IntelliJ that does support Makefile, since node includes many native modules IntelliJ starts to index and interpret stuff that it shouldn’t.

So there are two things that should be there — basic syntax highlighting and tabs instead of spaces.

Syntax Highlighting

It’s turns out it is possible to create custom file types in IntelliJ, I’ve created one for Makefiles. The number highlighting is a bit funky but the rest should be good. To install it you can download this settings jar:

https://www.everythingfrontend.com/files/makefile.jar

Then just go to File > Import Settings and import that file.

Indent with Tabs

If you have a setting to detect indentation enabled, this should just work, but in case it doesn’t you can install EditorConfig plugin and then add the following to your .editorconfig settings:

# Override for Makefile
[{Makefile, makefile, GNUmakefile}]
indent_style = tab
indent_size = 4