Replace BuildAll by Makefile - c

Is it possible to replace BuildAll of Eclipse CDT by a Makefile?
I mean I have a Makefile in C and I would buildall from this file. I build a Target in Eclipse to compile but I would use the Ctrl+B to buildall. My environment is Eclipse-Cdt.

There is no problem in creating a makefile that would invoke other make files.
But achieving interaction between Eclipse and the makefile would be extremely hard.

If I recall correctly, you can tell Eclipse CDT to use your own makefile instead of generating one. And you can tell Eclispe to use a specific target. So it should be easy.
my2c

I found the solution to use my own makefile. In fact it's very easy. The alone think that I did is to precise the emplacement of the makefile in the build properties.

Related

How to link a particularly named static library in Makefile?

I recently used Cmake/MinGW to build the glfw3 library from source. After make install, in the lib folder, I got the following binaries:
glfw3.dll
glfw3dll.a
Now to link with the static library in makefile, I changed the name of glfw3dll.a to libglfw3dll.a, so that I could write the linker flag -lglfw3dll in the makefile. But this feels like a hack. Is there a way to do it without changing the name?
Is there a way to do it without changing the name?
Yes, pass:
-l:glfw3dll.a
BTW, this is a fact about the commandline options of GNU ld. It has nothing to do with make or makefiles.

Eclipse builds a too heavy binary file

I've just ported a C project from Kdevelop to eclipse, the binary that before was around 600kb now is 5000kb and I don't know which is my mistake.
I am using the option to autogenerate the Makefile, could it be the reason?
thanks!
I have solved simply using the original makefile from kdevelop instead of the autogenerated eclipse makefile

xcode build using makefile

I hope that this makes sense.... is there a way to get xCode to use the makefile system for building C programs??
Yes - set up an "external build system" project.

Creating Project from existing source code in Eclipse

I am new to Eclipse. Working on school project from source code provided by instructor. Project compiles without problems using provided makefile, but I want to compile/edit inside of Eclipse.
I have tried to import as Makefile project, but right away getting an error
make: *** No rule to make target `all'.
Here is a basic list of files.
Main:
Makefile
mm.{c,h}
malloc.c
mdriver.c
short{1,2}-bal.rep
Supporting:
config.h
fsecs.{c,h}
clock.{c,h}
fcyc.{c,h}
ftimer.{c,h}
memlib.{c,h}
Why I can't simply "Import" source, as I can do it in Visual Studio ?
Thanks !
CDT will attempt to build the project using make all, and it seems that your Makefile does not have that target. Easiest is to add:
all: your-target-to-make-stuff
to your Makefile. If you want to configure how CDT invokes make, you can right-click on the project, select Properties → C/C++ Build. Under the Behavior tab, you can select which make targets CDT should invoke when building and cleaning.
I don't have an Eclipse with C/C++ plugin at my hands right now, but I have an idea what it could be:
It appears that your Eclipse is starting make with the specific target 'all', which doesn't seem to exist in the Makefile - you should be able to reproduce this behavior on the command line with the command make all instead of just make.
If this is the case, there are two solutions: one is to modify the Makefile to introduce a target 'all'; or modify the C/C++ builder settings in Eclipse to execute the make without any argument.
You can install the C/C++ for developers plugin.
Or in many cases I would use Ant to create or call make files.

compiling on Windows and Linux

I am just looking for some guidelines, as this might seem like a very open question.
I have a project that has been compiled using Visual Studio 2008 sp1. I have to compile so it will run linux using gcc 4.4.1 C99.
It is a demo application that I didn't write myself.
The source code is written so it can be cross-platform (linux, windows), so the code will compile and run on linux. However, has it has been developed using VS, I don't have any makefile to use.
I could write a make file. But I am not sure about the dependences as there are about 20 files all together (*.c and *.h).
I am just wondering how can I write a makefile from a visual studio project? Is there any settings I can use? and what depends on what? Anything else?
Many thanks for any suggestions,
The makedepend utility will scan the C files you give it, using C preprocessing rules to determine their dependencies and output them to a Makefile.
This should do most of what you want.
One tool that you can use is CMake. CMake can generate a VS.net solution file, and it can generate a Unix makefile. This way is not easy, nor is it the without its bumps in the road. (Especially when the build sequence gets complex)
Start with a very simple Makefile:
theapp: *.c *.h Makefile
gcc *.c -o theapp
Those two lines will get you 90% of the way there (and, in a lot of cases, 100% of the way).
Now you can make and run your app in Unix simply with:
$ make && ./theapp
I don't recommend that you use those complex Makefile generators like automake unless you plan on releasing this stuff to the world.
For private projects, keep your makefiles simple and clean.

Resources