xcode build using makefile - c

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.

Related

How to build GLUS with MinGW and Sublime Text 3

I am in a similar situation :
Eclipse CPP and GNU following these instructions. But i need to build GLUS with MinGW and sublime text.
I am learning C and OpenGL ,so i lack compilation/dependencies logic.
I would just like to undertsand in a simple way.
how to compile GLUS from those source:
https://github.com/McNopper/OpenGL/tree/master/GLUS/src
Where to install all the files in MinGW folder to setup things correctly.
Glew and Glfw are already configure correctly and works fine.
Thanks for your time.
Well Norbert Nopper kindly answer my question directly. And like the answer mention above. The path to follow to compile GLUS without any ide is by using cmake.
in the GLUS folder, there is a CMake file (https://cmake.org/). With
CMake, you can create the GLUS library without any IDE and for a lot
of platforms – including Windows and MinGW.
Yes cmake is the answer.
You usually create a build directory. Inside your git clone of the repository you do :
mkdir build
cd build
cmake ..
make

How to build an iPhone static library based on a Makefile?

I have managed to build a static C library on OSX using make on the command line.
I have tried to use the same Makefile (with ARCHFLAGS=-arch armv6 -arch armv7) to build a static library for iOS, but it fails with:
gcc-4.2: error trying to exec '/usr/bin/arm-apple-darwin10-gcc-4.2.1': execvp: No such file or directory
I guess it is not working because I'm using the OSX SDK make instead of a some part of the iOS SDK. Any clues?
N.B. For more details on the library in question (levmar) and for the Makefile, please refer to this Stack Overflow answer.
You need to find:
the location of the iOS compiler
the command line options that are used in the command line invocation
The easiest way is to create a test iPhone/iPad app in XCode, build it, and then look at the build log to find how XCode invokes the compiler.
Can you just make an Xcode project and invoke Xcode on the command line or from a script? If you don't want the fuss of maintaining an Xcode project, an easier approach might be to use CMake to generate an Xcode project and then invoke Xcode on the command line or from a script. This way you can stay in the text-file and script domain the whole time.

Replace BuildAll by Makefile

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.

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.

How to organise a C project in Eclipse /w multiple binaries?

I'm in the process of converting a project to Eclipse CDT, it consists of 2 (static) libraries and produces about 12 binaries, a few of the binaries have 2-3 different build configurations, and is built by scons
How should I structure this in an Eclipse workspace ? 1 project for everything ? 1 project for each of the binaries/libs ? Something else ?
I'd suggest you use CMAKE for this problem, It should be able target target the Eclipse build system. If not, it can generate a normal 'make' config for you. It is far better to go down this route since its more portable in the long term, and writing a hierarchical build system is quite straight forward.
I personally have used Eclipse CDT before, but only in makefile mode i.e. to build anything I'd manually run the makefile. Basically I used Eclipse as a glorified editor. Here's how I worked things:
Everything part of the otherall solution came under the same workspace. Each library/binary was its own directory and project, so that I could make each as required. I also had a separate folder (project) for tests with a makefile that built all the test exes I wanted to run so I could do valgrinds on simple bits of it.
As I said, I used make and not Eclipse CDT's built-in building routines - to that end I'd say it really doesn't matter how you structure it - do whatever makes sense / conforms best to the UNIX principles.

Resources