# 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 LOGFILE := bld.log $(shell rm -f ${LOGFILE}) # remove the log file from last run ifeq (${G_BUILD},${B_WIN32}) PRNTFMT := printf "%-12s: %s\n" PRNTLOG := printf "\n\#\# %-12s: %s\n" else PRNTFMT := printf "%-8s: %s\n" PRNTLOG := printf "\n\#\# %-8s: %s\n" endif VERBOSE := 0 ifeq (${VERBOSE},0) # log the printf command Q1s := @ Q1e := >> ${LOGFILE} # quiet the printf command Q2s := @ Q2e := # log the command Q3s := @echo # NOTE: the space between @echo and the # is VERY important!! Q3e := >> ${LOGFILE} # quiet the command Q4s := @ Q4e := else # EAT the logging printf command Q1s := @true # NOTE: the space between @true and the # is VERY important!! Q1e := # EAT the quiet printf command Q2s := @true # NOTE: the space between @true and the # is VERY important!! Q2e := # EAT the logging command Q3s := @true # NOTE: the space between @true and the # is VERY important!! Q3e := # do not quiet the command Q4s := Q4e := 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