Makefile generators

General questions regarding the usage of CodeLite
User avatar
Jarod42
CodeLite Expert
Posts: 237
Joined: Wed Sep 30, 2009 5:54 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Makefile generators

Post by Jarod42 »

I'm on Windows, using Msys.

I tried different makefile generator, but only the Default works for me:

- CMake and NMakefile for visual are out of scope, I use neither one.

-GNU makefile one step build : Fail

C:\WINDOWS\system32\cmd.exe /C ""C:/msys64/mingw64/bin/mingw32-make.exe" -j8 -e -f Makefile"

Code: Select all

----------Building project:[ MyProject - Release ]----------
mingw32-make[1]: *** No rule to make target 'Release/up_up_src_mylib.c.o', needed by 'Release/libmylib.dll'.  Stop.
mingw32-make[1]: Entering directory 'C:/Code/MyProject/project/codelite'
mingw32-make[1]: Leaving directory 'C:/Code/MyProject/project/codelite'
mingw32-make: *** [Makefile:5: All] Error 2
====0 errors, 0 warnings====
- Codelite make generator: Fail

Code: Select all

C:\WINDOWS\system32\cmd.exe /C ""C:/msys64/mingw64/bin/mingw32-make.exe" -j8 -e -f  Makefile"
----------Building project:[ MyProject - Release ]----------
mingw32-make[1]: Entering directory 'C:/Code/MyProject/project/codelite'
/usr/bin/sh: -c: line 1: syntax error: unexpected end of file
mingw32-make[1]: *** [MyProject.mk:88: MakeIntermediateDirs] Error 1
mingw32-make[1]: *** Waiting for unfinished jobs....
<built-in>: fatal error: opening dependency file ./build-Release//up_up_src_mylib.c.o.d: No such file or directory
compilation terminated.
mingw32-make[1]: *** [MyProject.mk:103: build-Release//up_up_src_mylib.c.o.d] Error 1
mingw32-make[1]: Leaving directory 'C:/Code/MyProject/project/codelite'
mingw32-make: *** [Makefile:5: All] Error 2
====0 errors, 0 warnings====
With (strange) Projecct.mk line 87-92

Code: Select all

MakeIntermediateDirs:
	@if not exist ".\build-$(ConfigurationName)\" mkdir ".\build-$(ConfigurationName)\"
	@if not exist "".\build-$(ConfigurationName)\lib"" mkdir "".\build-$(ConfigurationName)\lib""

:
	@if not exist ".\build-$(ConfigurationName)\" mkdir ".\build-$(ConfigurationName)\"
- mixed \ and / for paths in Makefile
- double "
- empty makefile rule

Are they some doc about generator?
Are there some configuration needed for those generators?
Are they restricted to other OS/compiler/...
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Makefile generators

Post by eranif »

The problem is that you are using MSYS on Windows (not the terminal, but the gcc that comes with it)
This configuration is not "native" and was not tested.

You can:
1. Install MinGW compiler
2. Use the "default" (although I personally prefer the "CodeLite Make Generator")

The main problem is that the SHELL used is /usr/bin/bash by default under MSYS, which does not work with
the mkdir command of Windows for several reasons:

- mkdir on Windows does not have the -p option, so the syntax must be in the form of @if not exist path\to\dir mkdir path\to\dir
- mkdir on Windows does not work with /... this is why you see the mixed "\" and "/"

I will add a new builder for Windows: "CodeLite Makefile Generator - UNIX", which is identical to the "CodeLite Make Generator", but uses mkdir -p and forward slashes

Eran
Make sure you have read the HOW TO POST thread
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Makefile generators

Post by eranif »

I just added new builder "CodeLite Makefile Generator - UNIX" that will generate UNIX compatible Makefile on Windows
It's committed in git master
Make sure you have read the HOW TO POST thread
User avatar
Jarod42
CodeLite Expert
Posts: 237
Joined: Wed Sep 30, 2009 5:54 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: Makefile generators

Post by Jarod42 »

> You can:
> 1. Install MinGW compiler

Not sure what you mean, as mingw tools are installed for msys2 through pacman.
I would prefer to not install a new toolset.

> 2. Use the "default"

It is what I used (by accident) for my projects.
but I try to build Codelite which uses another generator :-)
And changing of generator require some tweak (default adjustment seems to change from static lib to shared one, and manual requires some paths fixes).

> (although I personally prefer the "CodeLite Make Generator")

In which ways is it better?

> I just added new builder "CodeLite Makefile Generator - UNIX" that will generate UNIX compatible Makefile on Windows

Name might be misleading if it is for Windows (only?).
Maybe "posix makefile", but not sure it is correct (as it might just be disabled extensions for Makefile and issues are tools used IIUC),
so maybe "Unix tools".

Switching to that one might be easier, but not ideal anyway.

Unclear for me all those generators do. As I understand:

CMake: use CMakeLists.txt instead of Codelite configuration
NMake: for msvc (don't know if other makefile generators can handle that compiler)
Default: ??? The one we provide in configuration
GNU makefile one step build: ???
Codelite make generator: ??? Makefile using windows tools
CodeLite Makefile Generator - UNIX: ??? Makefile using gnu/unix tools
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Makefile generators

Post by eranif »

When you install via MSYS, the compiler is using /usr/bin/bash as the default terminal (this is the main reason for the errors)
because SHELL is set to bash and not CMD

The more new 'CodeLite Makefile Generator' is better in a way that it places all the build artefacts under a single directory, usually it will be placed under the workspace folder with a name that matches the current build configuration:

WORKSPACE_PATH/build-Debug/...
WORKSPACE_PATH/build-Release/...

This allows a complete separation from various build configuration and it follows the concept of 'building outside of the source tree' (and it also does not pollute it with different intermediate files and folders)

For clarification:
Default -> is the original makefile generator that I wrote
CodeLite Makefile Generator -> is the newer one which uses the out-of-source tree build concept
CMake -> is coming from the CMake plugin (if you disable this plugin it will be removed)
CodeLite Makefile Generator - UNIX -> is similar to CodeLite Makefile Generator, but it assumes UNIX tools (e.g. mkdir -p) on Windows environment
Make sure you have read the HOW TO POST thread
User avatar
Jarod42
CodeLite Expert
Posts: 237
Joined: Wed Sep 30, 2009 5:54 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: Makefile generators

Post by Jarod42 »

> The more new 'CodeLite Makefile Generator' is better in a way that it places all the build artefacts under a single directory

Is it configurable for Default, so seems better ;-) (And I configure Codelite projects via premake).

Thanks for clarification.
Post Reply