# cause the fancy $${@D} directory rules to work out .SECONDEXPANSION: B_DEBUG := DEBUG B_FINAL := FINAL B_WIN32 := WIN32 # set this on the command line to get a WIN32 or a FINAL build G_BUILD := ${B_DEBUG} ifeq (${G_BUILD},${B_DEBUG}) else ifeq (${G_BUILD},${B_FINAL}) else ifeq (${G_BUILD},${B_WIN32}) else $(error 'G_BUILD = ${G_BUILD}' is invalid. Valid types are '${B_DEBUG}', '${B_FINAL}' or '${B_WIN32}') endif endif endif T_OPTFLAGS := -O2 T_DBGFLAGS := -ggdb T_PRFFLAGS := ${T_DBGFLAGS} -pg T_WARFLAGS := -Wall -Wextra -pedantic -ansi G_CXXFLAGS := ${T_WARFLAGS} ifeq (${G_BUILD},${B_DEBUG}) G_CXXFLAGS += ${T_DBGFLAGS} else ifeq (${G_BUILD},${B_FINAL}) G_CXXFLAGS += ${T_OPTFLAGS} else ifeq (${G_BUILD},${B_WIN32}) G_CXXFLAGS += ${T_OPTFLAGS} else $(error 'G_BUILD = ${G_BUILD}' is invalid.) endif endif endif T_OPTFLAGS := T_DBGFLAGS := T_PRFFLAGS := T_WARFLAGS := G_LNKFLAGS := ifeq (${G_BUILD},${B_WIN32}) G_CXX := mingw32-g++ else G_CXX := g++ endif ifeq (${G_BUILD},${B_WIN32}) G_LIBGL := -lopengl32 -lglu32 G_LIBSDL := `/usr/mingw32/bin/sdl-config --libs` else G_LIBGL := -lGL -lGLU G_LIBSDL := `sdl-config --libs` endif G_SRCSDIR := src/ G_DEPSDIR := deps/ ifeq (${G_BUILD},${B_DEBUG}) G_OBJSDIR := objsd/ G_BINDIR := bind/ else ifeq (${G_BUILD},${B_FINAL}) G_OBJSDIR := objs/ G_BINDIR := bin/ else ifeq (${G_BUILD},${B_WIN32}) G_OBJSDIR := objs-mingw32/ G_BINDIR := bin-mingw32/ else $(error 'G_BUILD = ${G_BUILD}' is invalid.) endif endif endif ifeq (${G_BUILD},${B_WIN32}) PRNTFMT := printf "%-12s: %s\n" else PRNTFMT := printf "%-8s: %s\n" endif VERBOSE := 0 ifeq (${VERBOSE},0) # quiet the printf command Q1 := @ # quiet the command that is `replaced' by an echo Q2 := @ else # EAT the printf command as if it was not there Q1 := @true # NOTE: the space between @true and the # is VERY important!! # do not quiet the command output Q2 := endif ifeq (${G_BUILD},${B_WIN32}) prefix := /usr/mingw32 else prefix := /usr endif exec_prefix := ${prefix} includedir := ${prefix}/include libdir := ${exec_prefix}/lib INSTALL := install