Author Topic: Q:Is Make acting differently in CodeBlocks? A:Only if it runs a different make.  (Read 2219 times)

Offline VReality

  • Single posting newcomer
  • *
  • Posts: 5
I ran into a little build problem, using makefiles with Code::Blocks, and I ended up solving it before finishing this post.  I figured I'd go ahead and post it anyway, just in case it helps anyone out in the future.  This problem appears to be specific to the MinGW32 installation.

My makefile contains make 'functions' to perform certain helpful tasks.  Here is a sample:

Code: [Select]
CREATE_PATH = if not exist $(1) (echo   Creating directory $(1))&&(md $(1))

...

$(OUTPUT_PATH)/%.o : $(SOURCE_PATH)/%.cpp
@$(call CREATE_PATH,$(@D))
...

The idea here is that before the compile command creates a .o file, it makes sure the output directory in which it will go exists, by checking for it, and creating it if necessary (my ‘clean’ command simply deletes the output directory).  And for tasks like this, I have a small collection of make ‘functions’ which are executed with make’s $(call function, parameters) construct.

When I executed this makefile from within the Code::Blocks IDE, it appears that the make function calls were being ignored.  They're weren't failing.  The were just not being run at all.  This caused the build to fail.  I could get the build to succeed by replacing the calls with the code they call, like this:

Code: [Select]
$(OUTPUT_PATH)/%.o : $(SOURCE_PATH)/%.cpp
@if not exist $(@D) (echo   Creating directory $(@D))&&(md $(@D))
...

Apparently there are two different versions of make in the MinGW installation.  I believe that by default, Code::Blocks was using the one called 'make.exe', and it exhibited this behavior.  When I changed it to use the one called, 'mingw32-make.exe', it worked correctly.