fixed velocity math mistake, updated gravtiy well force to look better
[libbear.git] / vars.mk
CommitLineData
3fc83b9f 1
e3c1a188 2# cause the fancy SS_ directory rules to work out
698cb4b6
PG
3.SECONDEXPANSION:
4
e3c1a188
PG
5# The SS rules need to be 'recursive' so they evaluate the @ variables at
6# secondary expansion time
7SS_DIR = ${@D}
8
9# Warning this secondary expansion rule is very very sensitive
10# tricks are needed to make things work because the stem % does not match
11# empty also, it is used by the call syntax as the package variable needs to be
12# invoked as usage time while the rest has to be delayed till secondary
13# expansion.
14SS_DEPSDIR = $(patsubst %/,%,$(patsubst ${OBJSDIR_$(1)}%,${DEPSDIR_$(1)}%,$(dir $@)))
15
16
698cb4b6
PG
17B_DEBUG := DEBUG
18B_FINAL := FINAL
19B_WIN32 := WIN32
333583c5 20B_CYGWIN := CYGWIN
698cb4b6
PG
21
22# set this on the command line to get a WIN32 or a FINAL build
23G_BUILD := ${B_DEBUG}
24
25ifeq (${G_BUILD},${B_DEBUG})
26else
27ifeq (${G_BUILD},${B_FINAL})
28else
29ifeq (${G_BUILD},${B_WIN32})
30else
333583c5
PG
31ifeq (${G_BUILD},${B_CYGWIN})
32else
33 $(error 'G_BUILD = ${G_BUILD}' is invalid. Valid types are '${B_DEBUG}', '${B_FINAL}', '${B_CYGWIN}', or '${B_WIN32}')
34endif
698cb4b6
PG
35endif
36endif
37endif
38
39
7bbc50a4
PG
40T_OPTFLAGS := -O2
41T_DBGFLAGS := -ggdb
a98a33a6 42T_PRFFLAGS := ${T_DBGFLAGS} -pg
c08ba753
PG
43
44T_WARFLAGS :=
45T_WARFLAGS += -Wall
46T_WARFLAGS += -Wextra
47T_WARFLAGS += -pedantic
48T_WARFLAGS += -ansi
49T_WARFLAGS += -Wshadow
50T_WARFLAGS += -Wswitch-enum
51T_WARFLAGS += -Wfloat-equal
52T_WARFLAGS += -Wundef
bc38cb36 53T_WARFLAGS += -Wswitch-enum
3fc83b9f 54
7bbc50a4 55G_CXXFLAGS := ${T_WARFLAGS}
698cb4b6
PG
56ifeq (${G_BUILD},${B_DEBUG})
57 G_CXXFLAGS += ${T_DBGFLAGS}
58else
59ifeq (${G_BUILD},${B_FINAL})
7bbc50a4 60 G_CXXFLAGS += ${T_OPTFLAGS}
9cc902bf 61else
698cb4b6 62ifeq (${G_BUILD},${B_WIN32})
7bbc50a4 63 G_CXXFLAGS += ${T_OPTFLAGS}
9cc902bf 64else
333583c5
PG
65ifeq (${G_BUILD},${B_CYGWIN})
66 G_CXXFLAGS += ${T_OPTFLAGS}
67else
698cb4b6
PG
68 $(error 'G_BUILD = ${G_BUILD}' is invalid.)
69endif
9cc902bf
PG
70endif
71endif
333583c5 72endif
3fc83b9f 73
7bbc50a4
PG
74T_OPTFLAGS :=
75T_DBGFLAGS :=
76T_PRFFLAGS :=
77T_WARFLAGS :=
78
a98a33a6 79G_LNKFLAGS :=
7bbc50a4 80
698cb4b6 81ifeq (${G_BUILD},${B_WIN32})
7bbc50a4 82 G_CXX := mingw32-g++
3fc83b9f 83else
7bbc50a4 84 G_CXX := g++
3fc83b9f
PG
85endif
86
333583c5
PG
87ifeq (${G_BUILD},${B_DEBUG})
88 G_LIBGL := -lGL -lGLU
89 G_LIBSDL := `sdl-config --libs`
90else
91ifeq (${G_BUILD},${B_FINAL})
92 G_LIBGL := -lGL -lGLU
93 G_LIBSDL := `sdl-config --libs`
94else
698cb4b6 95ifeq (${G_BUILD},${B_WIN32})
b6a453de
PG
96 G_LIBGL := -lopengl32 -lglu32
97 G_LIBSDL := `/usr/mingw32/bin/sdl-config --libs`
98else
333583c5
PG
99ifeq (${G_BUILD},${B_CYGWIN})
100 G_LIBGL := -lopengl32 -lglu32
b6a453de 101 G_LIBSDL := `sdl-config --libs`
333583c5
PG
102else
103 $(error 'G_BUILD = ${G_BUILD}' is invalid.)
104endif
105endif
106endif
b6a453de
PG
107endif
108
c3f228a5 109G_SRCSDIR := src
75c4965c 110
698cb4b6 111ifeq (${G_BUILD},${B_DEBUG})
c3f228a5
PG
112 G_OBJSDIR := objsd
113 G_BINDIR := bind
ff3fc4bf 114 G_DEPSDIR := depsd
75c4965c 115else
698cb4b6 116ifeq (${G_BUILD},${B_FINAL})
c3f228a5
PG
117 G_OBJSDIR := objs
118 G_BINDIR := bin
ff3fc4bf 119 G_DEPSDIR := deps
75c4965c 120else
698cb4b6 121ifeq (${G_BUILD},${B_WIN32})
c3f228a5
PG
122 G_OBJSDIR := objs-mingw32
123 G_BINDIR := bin-mingw32
ff3fc4bf 124 G_DEPSDIR := deps-mingw32
698cb4b6 125else
333583c5 126ifeq (${G_BUILD},${B_CYGWIN})
ff3fc4bf
PG
127 G_OBJSDIR := objs-cygwin
128 G_BINDIR := bin-cygwin
129 G_DEPSDIR := deps-cygwin
333583c5 130else
698cb4b6
PG
131 $(error 'G_BUILD = ${G_BUILD}' is invalid.)
132endif
75c4965c
PG
133endif
134endif
333583c5 135endif
75c4965c 136
3994427d
PG
137LOGFILE := bld.log
138
139$(shell rm -f ${LOGFILE}) # remove the log file from last run
b6a453de 140
698cb4b6 141ifeq (${G_BUILD},${B_WIN32})
3fc83b9f 142 PRNTFMT := printf "%-12s: %s\n"
97c2dcb5 143 PRNTLOG := printf "\n\#\# %-12s: %s\n"
3fc83b9f
PG
144else
145 PRNTFMT := printf "%-8s: %s\n"
97c2dcb5 146 PRNTLOG := printf "\n\#\# %-8s: %s\n"
3fc83b9f
PG
147endif
148
149VERBOSE := 0
150
151ifeq (${VERBOSE},0)
3994427d 152 # log the printf command
55b26c7b 153 Q1s :=
3994427d 154 Q1e := >> ${LOGFILE}
3fc83b9f 155 # quiet the printf command
55b26c7b 156 Q2s :=
3994427d
PG
157 Q2e :=
158 # log the command
55b26c7b 159 Q3s := echo # NOTE: the space between @echo and the # is VERY important!!
3994427d 160 Q3e := >> ${LOGFILE}
b07f0a1d 161 # quiet the command, log the output
55b26c7b 162 Q4s := set -o pipefail &&
b07f0a1d 163 Q4e := 2>&1 | tee -a ${LOGFILE}
3fc83b9f 164else
3994427d 165 # EAT the logging printf command
55b26c7b 166 Q1s := true # NOTE: the space between @true and the # is VERY important!!
3994427d
PG
167 Q1e :=
168 # EAT the quiet printf command
55b26c7b 169 Q2s := true # NOTE: the space between @true and the # is VERY important!!
3994427d
PG
170 Q2e :=
171 # EAT the logging command
55b26c7b 172 Q3s := true # NOTE: the space between @true and the # is VERY important!!
3994427d
PG
173 Q3e :=
174 # do not quiet the command
175 Q4s :=
176 Q4e :=
3fc83b9f
PG
177endif
178
b6a453de 179
698cb4b6 180ifeq (${G_BUILD},${B_WIN32})
b6a453de
PG
181 prefix := /usr/mingw32
182else
183 prefix := /usr
184endif
185exec_prefix := ${prefix}
186includedir := ${prefix}/include
187libdir := ${exec_prefix}/lib
188INSTALL := install
189