Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Makefiles

This thread is locked; no one can reply to it. rss feed Print
Makefiles
dthompson
Member #5,749
April 2005
avatar

At 27 years of age, I today learnt how to use GNU make; I spent the entire day adapting my game's build toolchain - which mainly consisted of a few Bash and Python scripts - to instead use a makefile.

I'm pretty happy with the result, as compilation is lightning fast now - though after chasing my tail for 8 hours trying to figure out how I was creating so many circular dependencies, I can confidently say that I'm glad that's over. ::)

All I can say now is that I'm glad I don't have to manage Allegro 5's (presumably orders-of-magnitude-larger) build process. Respect to those of you who have to meddle with it.

Now onto CMake I guess... 8-)

______________________________________________________
Website. It was freakdesign.bafsoft.net.
This isn't a game!

GullRaDriel
Member #3,861
September 2003
avatar

Good job.
Now add support for cross compilation and you're done !

#SelectExpand
1ifeq ($(OS),Windows_NT) 2 do_windows_preps 3else 4 UNAME_S := $(shell uname -s) 5 6 ifeq ($(UNAME_S),Linux) 7 CFLAGS+= -I./include/ -g -W -Wall -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENTED -std=gnu99 -ggdb3 -O0 8 endif 9 10 ifeq ($(UNAME_S),SunOS) 11 CC=cc 12 CFLAGS+= -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -g -v -xc99 -I ./include/ -mt 13 endif 14 15 #other os reachable via uname have to be checked there 16 17endif

;-)

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

I hate makefiles. Too many cryptic symbols that I can't remember and too many rules. CMake is miles better, but bad documentation makes it a pain. After you write a CMakeLists.txt, you can create projects and makefiles for any platform! So much nicer than other build systems. Autotools is an ancient secret no one shares anymore, and that's fine by me. I hate trying to adjust a configure script or figure out what it can do and how. Premake showed promise for a while, but ultimately, the problem with slashes took its toll and I moved on.

My old GUI lib built with a custom makefile, and install targets. Too hard to keep current though so I abandoned it. If I use anything for my new version, it's going to be CMake. Right now my build scripts consist of Code Blocks projects, which is kind of weak as far as multi-platform support goes. You have to make a new project for every platform it seems, or else I haven't figured out how to enable multiple compiler targets.

GullRaDriel
Member #3,861
September 2003
avatar

In CodeBlocks, project properties, build target, add a new, select a different compiler.

You can set a new compilers by copying one of the existing entry in Settings, compilers.

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Neil Roy
Member #2,229
April 2002
avatar

Once you understand how to create basic makefile, they're quite nice. I think the biggest problem I had with them in the past was using a space verses a tab, a quirk of makefiles I still don't understand. But that was about the only problem.

I made a basic makefile, then I simply adjust it for whatever project I am on (when I used them, which is rare these days). I certainly prefer them over CMake! But the Cmake GUI helps in that respect.

---
“I love you too.” - last words of Wanda Roy

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Gideon Weems
Member #3,925
October 2003

Go to: