gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > Makefiles - what do they do? and how to write them?

#45790 - doomlord_uk - Tue Jun 14, 2005 11:26 pm

Hi, I'm just setting out on a project to write a game for the GBA (first real programming project :) ) and I am looking for information on what makefiles actually *do* and on how to write them. AFAICT, a makefile is a batch file/script for automating a build from a source file?? Is that right?

Anyway, I didn't see anything in the sticky thread and a quick search didn't turn up anything I could see was relevant directly but I apologise if I missed anything!

So, does anyone have any links or references to some good guides & tutorials online for makefiles? I guess it's too big a subject to cover here, but I want to learn as much as possible :)

Thanks for any help!

#45791 - APL - Tue Jun 14, 2005 11:51 pm

A make file is like a batch file, but a very special that's specificaly designed for creating other files and keeping them up to date..

For instance, you'd make a make file that says your game depends on modules A, B and C. And then you'd also put that module A requires certain source files, B requires certain other source files, and C requires a bitmap or something. Then you have the commands to make the files. (Compiler commands, or image converting commands, etc.)

That way, if you change a single file in your project, you don't have to remember which files have to be remade. You just run make, make checks all the timestamps, and re-builds only the parts of your project that need to be rebuilt.

I didn't explain this very well, But this link explains it pretty well : http://www.wlug.org.nz/MakefileHowto
_________________
-Andy L
http://www.depthchasers.com