How to recognize .mk as a makefile type (text/x-makefile)

Asked by mikes on 2009-10-29

In the file browser, a file named Makefile shows up as type Makefile. A file named something.mk shows up as plain text. Also, gedit treats them differently. How does one get a .mk file to look like what it is, a makefile? Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Lesmana Zimmer
Solved:
2009-11-02
Last query:
2009-11-02
Last reply:
2009-10-31
Best Lesmana Zimmer (lesmana) said : #1

here is a quick and dirty solution to your question

1. create the file: "~/.local/share/mime/packages/Overrides.xml"

2. put this in the file
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
  <mime-type type="text/x-makefile.mk">
    <comment>Makefile.mk</comment>
    <sub-class-of type="text/x-makefile"/>
    <glob pattern="*.mk"/>
  </mime-type>
</mime-info>

3. run command: "update-mime-database ~/.local/share/mime"

4. refresh nautilus

5. rejoice :)

read here for more background info: http://library.gnome.org/admin/system-admin-guide/stable/mimetypes-modifying.html.en

mikes (mike-stich) said : #2

As you said, rejoice! Thank you.

(Being new to Ubuntu, it took a little poking around to figure out that "Nautilus" is the file browser, but not much. Thanks again)

Mike

mikes (mike-stich) said : #3

The pointer to the gnome documentation is very useful also. Thanks for teaching me to fish ...
Mike