Game Development Community

Simplified makefile

by Rodney Rindels - Torqued · in Torque Game Builder · 07/03/2007 (9:40 pm) · 0 replies

While doing the build on linux is fairly trivial, I find myself testing multiple compilers and build and release versions often.

So I created a makefile for myself to make my life a bit easier and thought I would share it.

you just call it like so,

make release3

which would make a gcc3 release version

make debug3 would make a gcc3 debug version.

possible options are
clean, debug2,release2,debug3,release3,debug3.4,release3.4,debug4,release4

The only requirement is that the makefile lives in your topmost TGB directory , ie in the same directory as engine,games, etc

hope somebody finds it useful.

###########################################################
# Torque Game Builder - Simplified Build Script           #
###########################################################
# This Script needs to be placed in your top level TGB    #
# Directory.                                              #
# Assumes your Platform is LINUX, if its not.. change it  #
# in the PLATFORM variable below.                         #
###########################################################
CD = cd
ENGINEDIR = engine
COMPILERSDIR = $(ENGINEDIR)/compilers
MAKEDIR = $(COMPILERSDIR)/make
CONFIGURE = configure.mk
PLATFORM = LINUX
clean:
        $(CD) $(MAKEDIR);$(MAKE) clean

debug2: clean
        $(CD) $(MAKEDIR);$(MAKE) -f $(CONFIGURE) OS=$(PLATFORM) COMPILER=GCC2 BUILD=DEBUG; $(MAKE)

release2: clean
        $(CD) $(MAKEDIR);$(MAKE) -f $(CONFIGURE) OS=$(PLATFORM) COMPILER=GCC2 BUILD=RELEASE; $(MAKE)

debug3: clean
        $(CD) $(MAKEDIR);$(MAKE) -f $(CONFIGURE) OS=$(PLATFORM) COMPILER=GCC3 BUILD=DEBUG; $(MAKE)

release3: clean
        $(CD) $(MAKEDIR);$(MAKE) -f $(CONFIGURE) OS=$(PLATFORM) COMPILER=GCC3 BUILD=RELEASE; $(MAKE)

debug3.4: clean
        $(CD) $(MAKEDIR);$(MAKE) -f $(CONFIGURE) OS=$(PLATFORM) COMPILER=GCC3.4 BUILD=DEBUG; $(MAKE)

release3.4: clean
        $(CD) $(MAKEDIR);$(MAKE) -f $(CONFIGURE) OS=$(PLATFORM) COMPILER=GCC3.4 BUILD=RELEASE; $(MAKE)

debug4: clean
        $(CD) $(MAKEDIR);$(MAKE) -f $(CONFIGURE) OS=$(PLATFORM) COMPILER=GCC4 BUILD=DEBUG; $(MAKE)

release4: clean
        $(CD) $(MAKEDIR);$(MAKE) -f $(CONFIGURE) OS=$(PLATFORM) COMPILER=GCC4 BUILD=RELEASE; $(MAKE)