Home > Software engineering >  CLion custom compiler: Makefile parser says "No compilation commands found"
CLion custom compiler: Makefile parser says "No compilation commands found"

Time:10-09

I'm trying to get a custom compiler working in CLion and having a bear of a time. Can anyone help me find out what I'm doing wrong? I have the full code on Github.

What I have

  • The command line tools are all behind the same executable named mpw. So the C compiler is behind mpw SC, the linker is behind mpw link. There's also a tool named Rez to add some metadata to the executable, but I'm fine if CLion just ignores that.
  • I'm using a make file to do the actual build.
  • I've created a custom compiler definition YAML and selected it in CLion's project settings. I tried to follow the Jetbrains docs [1] [2] but couldn't find out what code insight target name to use (It eventually compiles for 68000 CPU, old MacOS, anyone know where I can find a list of allowed clangd target names?).
  • The Makefile works when I call make clean or make all from command line.

Problem

When I open the folder in CLion, it tries to parse the Makefile and reports:

(x) Analysing makefile
(x) No compilation commands found

Goal

  • Get CLion to see all my code (including system headers at ~/mpw/Interfaces/CIncludes) so I can use its code navigation to auto-complete code. Refactoring would be nice too.
  • Get CLion to understand my Makefile so I can build using the "hammer" icon inside CLion.

Custom Compiler Definition


compilers:
  - description: "MPW SC"
    match-sources: ".*\\.c"
    match-language: "C"
    match-compiler-exe: "(.*/)?mpw SC"
    code-insight-target-name: mpw
    include-dirs:
      - ${user-home}/mpw/Interfaces/CIncludes
    defines-text: "
#define __MRC__ 0x0700
#define OLDROUTINENAMES 1
"

Makefile

SOURCES=SillyBalls.c
RFILES=SillyBalls.r Size.r
EXECUTABLE=SillyBalls

MPW=~/Programming/mpw/build/bin/mpw
RINCLUDES=~/mpw/Interfaces/RIncludes

LDFLAGS =-w -c 'SILB' -t APPL \
    -sn STDIO=Main -sn INTENV=Main -sn            
  • Related