added comments to 'nice' output in bld log
[libbear.git] / vars.mk
CommitLineData
3fc83b9f 1
698cb4b6
PG
2# cause the fancy $${@D} directory rules to work out
3.SECONDEXPANSION:
4
5B_DEBUG := DEBUG
6B_FINAL := FINAL
7B_WIN32 := WIN32
8
9# set this on the command line to get a WIN32 or a FINAL build
10G_BUILD := ${B_DEBUG}
11
12ifeq (${G_BUILD},${B_DEBUG})
13else
14ifeq (${G_BUILD},${B_FINAL})
15else
16ifeq (${G_BUILD},${B_WIN32})
17else
18 $(error 'G_BUILD = ${G_BUILD}' is invalid. Valid types are '${B_DEBUG}', '${B_FINAL}' or '${B_WIN32}')
19endif
20endif
21endif
22
23
7bbc50a4
PG
24T_OPTFLAGS := -O2
25T_DBGFLAGS := -ggdb
a98a33a6 26T_PRFFLAGS := ${T_DBGFLAGS} -pg
7bbc50a4 27T_WARFLAGS := -Wall -Wextra -pedantic -ansi
3fc83b9f 28
7bbc50a4 29G_CXXFLAGS := ${T_WARFLAGS}
698cb4b6
PG
30ifeq (${G_BUILD},${B_DEBUG})
31 G_CXXFLAGS += ${T_DBGFLAGS}
32else
33ifeq (${G_BUILD},${B_FINAL})
7bbc50a4 34 G_CXXFLAGS += ${T_OPTFLAGS}
9cc902bf 35else
698cb4b6 36ifeq (${G_BUILD},${B_WIN32})
7bbc50a4 37 G_CXXFLAGS += ${T_OPTFLAGS}
9cc902bf 38else
698cb4b6
PG
39 $(error 'G_BUILD = ${G_BUILD}' is invalid.)
40endif
9cc902bf
PG
41endif
42endif
3fc83b9f 43
7bbc50a4
PG
44T_OPTFLAGS :=
45T_DBGFLAGS :=
46T_PRFFLAGS :=
47T_WARFLAGS :=
48
a98a33a6 49G_LNKFLAGS :=
7bbc50a4 50
698cb4b6 51ifeq (${G_BUILD},${B_WIN32})
7bbc50a4 52 G_CXX := mingw32-g++
3fc83b9f 53else
7bbc50a4 54 G_CXX := g++
3fc83b9f
PG
55endif
56
698cb4b6 57ifeq (${G_BUILD},${B_WIN32})
b6a453de
PG
58 G_LIBGL := -lopengl32 -lglu32
59 G_LIBSDL := `/usr/mingw32/bin/sdl-config --libs`
60else
61 G_LIBGL := -lGL -lGLU
62 G_LIBSDL := `sdl-config --libs`
63endif
64
75c4965c
PG
65G_SRCSDIR := src/
66G_DEPSDIR := deps/
67
698cb4b6
PG
68ifeq (${G_BUILD},${B_DEBUG})
69 G_OBJSDIR := objsd/
70 G_BINDIR := bind/
75c4965c 71else
698cb4b6 72ifeq (${G_BUILD},${B_FINAL})
75c4965c
PG
73 G_OBJSDIR := objs/
74 G_BINDIR := bin/
75else
698cb4b6
PG
76ifeq (${G_BUILD},${B_WIN32})
77 G_OBJSDIR := objs-mingw32/
78 G_BINDIR := bin-mingw32/
79else
80 $(error 'G_BUILD = ${G_BUILD}' is invalid.)
81endif
75c4965c
PG
82endif
83endif
84
3994427d
PG
85LOGFILE := bld.log
86
87$(shell rm -f ${LOGFILE}) # remove the log file from last run
b6a453de 88
698cb4b6 89ifeq (${G_BUILD},${B_WIN32})
3fc83b9f 90 PRNTFMT := printf "%-12s: %s\n"
97c2dcb5 91 PRNTLOG := printf "\n\#\# %-12s: %s\n"
3fc83b9f
PG
92else
93 PRNTFMT := printf "%-8s: %s\n"
97c2dcb5 94 PRNTLOG := printf "\n\#\# %-8s: %s\n"
3fc83b9f
PG
95endif
96
97VERBOSE := 0
98
99ifeq (${VERBOSE},0)
3994427d
PG
100 # log the printf command
101 Q1s := @
102 Q1e := >> ${LOGFILE}
3fc83b9f 103 # quiet the printf command
3994427d
PG
104 Q2s := @
105 Q2e :=
106 # log the command
107 Q3s := @echo # NOTE: the space between @echo and the # is VERY important!!
108 Q3e := >> ${LOGFILE}
109 # quiet the command
110 Q4s := @
111 Q4e :=
3fc83b9f 112else
3994427d
PG
113 # EAT the logging printf command
114 Q1s := @true # NOTE: the space between @true and the # is VERY important!!
115 Q1e :=
116 # EAT the quiet printf command
117 Q2s := @true # NOTE: the space between @true and the # is VERY important!!
118 Q2e :=
119 # EAT the logging command
120 Q3s := @true # NOTE: the space between @true and the # is VERY important!!
121 Q3e :=
122 # do not quiet the command
123 Q4s :=
124 Q4e :=
3fc83b9f
PG
125endif
126
b6a453de 127
698cb4b6 128ifeq (${G_BUILD},${B_WIN32})
b6a453de
PG
129 prefix := /usr/mingw32
130else
131 prefix := /usr
132endif
133exec_prefix := ${prefix}
134includedir := ${prefix}/include
135libdir := ${exec_prefix}/lib
136INSTALL := install
137