views:

277

answers:

2

Hi there.

i have been developing iPhone apps for a few months now, i have gone through some examples of some iphone open source apps which have "makeFile" file in them. Just like cydia has got here Cydia Source Code

i googled for it but couldnt get any satisfactory explanation of it. All explanations are somewhat complex.

Can somebody please explain me in simple language what this makefile is?

+1  A: 

A make file is like an executable in windows. It has a preset list of commands to run in order to "make" your application work and it can manage your dependencies so you don't have to constantly respecify them. The alternative to a make file is running the application in a console.

The problem with running applications in a command line is that you may need to repeatedly specify all the project parameters whenever you want to run an application. Another downside to running an application from the command line is that you have to open the terminal/dos in order to run your application. Most end users of you application are not going to want to have to do this. Having a makefile makes starting up your application as easy as clicking on a makefile.

The main difference between a makefile and other files like .exe is they are platform independant and can be run in multiple operating systems.

macneil
Brilliant Explanation, thanks !!!
raziiq
+3  A: 

In Xcode, you select "Build" from the menu and it compiles your project. A Makefile does the same thing, except from the command line. A Makefile contains information about which files need to be rebuilt if you change a certain file.

See http://en.wikipedia.org/wiki/Makefile

Makefiles are nice because they work on a very wide variety of systems.

Dietrich Epp
excellent starting point for any beginner like me. Thanks !!!One more thing i wanna know is that, when you have xcode building the projects for you, then why to use makefile for such projects
raziiq
You only have a make file if your IDE is not automatically building your project for you, for example in netbeans/eclipse the jar file is automatically generated so you could just run the jar file like an exe (if you have java installed). In this case making a make file makes things redundant (no pun intended).
macneil
Thanks for the reply.here in this link for example, a guy is using a makefile to build the projecthttp://www.ipodtouchfans.com/forums/showthread.php?t=103558so i can do the same in IDE, without any need of makefile, right? And i can build the same project he is doing by programming in xcode (IDE for Mac/iPhone), and there is no need for that makefile?
raziiq
Yeah when working with IDE's you don't need a makefile unless you want more control of your project. There are alot of ways to deploy projects. You could even look into using batch files and ant build scripts. At the end of the day do what is best for your specific project. Which if you don't need much control and you are just starting out, would probably be using an automatic build. It is safer, you can't really mess it up and it is fast.
macneil
Perfect!!!So i should stick to IDE in most of the cases, unless i really need to dig down to my project build details.Thanks for the replies guys, :)
raziiq