fixed velocity math mistake, updated gravtiy well force to look better
[libbear.git] / vars.mk
... / ...
CommitLineData
1
2# cause the fancy SS_ directory rules to work out
3.SECONDEXPANSION:
4
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
17B_DEBUG := DEBUG
18B_FINAL := FINAL
19B_WIN32 := WIN32
20B_CYGWIN := CYGWIN
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
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
35endif
36endif
37endif
38
39
40T_OPTFLAGS := -O2
41T_DBGFLAGS := -ggdb
42T_PRFFLAGS := ${T_DBGFLAGS} -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
53T_WARFLAGS += -Wswitch-enum
54
55G_CXXFLAGS := ${T_WARFLAGS}
56ifeq (${G_BUILD},${B_DEBUG})
57 G_CXXFLAGS += ${T_DBGFLAGS}
58else
59ifeq (${G_BUILD},${B_FINAL})
60 G_CXXFLAGS += ${T_OPTFLAGS}
61else
62ifeq (${G_BUILD},${B_WIN32})
63 G_CXXFLAGS += ${T_OPTFLAGS}
64else
65ifeq (${G_BUILD},${B_CYGWIN})
66 G_CXXFLAGS += ${T_OPTFLAGS}
67else
68 $(error 'G_BUILD = ${G_BUILD}' is invalid.)
69endif
70endif
71endif
72endif
73
74T_OPTFLAGS :=
75T_DBGFLAGS :=
76T_PRFFLAGS :=
77T_WARFLAGS :=
78
79G_LNKFLAGS :=
80
81ifeq (${G_BUILD},${B_WIN32})
82 G_CXX := mingw32-g++
83else
84 G_CXX := g++
85endif
86
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
95ifeq (${G_BUILD},${B_WIN32})
96 G_LIBGL := -lopengl32 -lglu32
97 G_LIBSDL := `/usr/mingw32/bin/sdl-config --libs`
98else
99ifeq (${G_BUILD},${B_CYGWIN})
100 G_LIBGL := -lopengl32 -lglu32
101 G_LIBSDL := `sdl-config --libs`
102else
103 $(error 'G_BUILD = ${G_BUILD}' is invalid.)
104endif
105endif
106endif
107endif
108
109G_SRCSDIR := src
110
111ifeq (${G_BUILD},${B_DEBUG})
112 G_OBJSDIR := objsd
113 G_BINDIR := bind
114 G_DEPSDIR := depsd
115else
116ifeq (${G_BUILD},${B_FINAL})
117 G_OBJSDIR := objs
118 G_BINDIR := bin
119 G_DEPSDIR := deps
120else
121ifeq (${G_BUILD},${B_WIN32})
122 G_OBJSDIR := objs-mingw32
123 G_BINDIR := bin-mingw32
124 G_DEPSDIR := deps-mingw32
125else
126ifeq (${G_BUILD},${B_CYGWIN})
127 G_OBJSDIR := objs-cygwin
128 G_BINDIR := bin-cygwin
129 G_DEPSDIR := deps-cygwin
130else
131 $(error 'G_BUILD = ${G_BUILD}' is invalid.)
132endif
133endif
134endif
135endif
136
137LOGFILE := bld.log
138
139$(shell rm -f ${LOGFILE}) # remove the log file from last run
140
141ifeq (${G_BUILD},${B_WIN32})
142 PRNTFMT := printf "%-12s: %s\n"
143 PRNTLOG := printf "\n\#\# %-12s: %s\n"
144else
145 PRNTFMT := printf "%-8s: %s\n"
146 PRNTLOG := printf "\n\#\# %-8s: %s\n"
147endif
148
149VERBOSE := 0
150
151ifeq (${VERBOSE},0)
152 # log the printf command
153 Q1s :=
154 Q1e := >> ${LOGFILE}
155 # quiet the printf command
156 Q2s :=
157 Q2e :=
158 # log the command
159 Q3s := echo # NOTE: the space between @echo and the # is VERY important!!
160 Q3e := >> ${LOGFILE}
161 # quiet the command, log the output
162 Q4s := set -o pipefail &&
163 Q4e := 2>&1 | tee -a ${LOGFILE}
164else
165 # EAT the logging printf command
166 Q1s := true # NOTE: the space between @true and the # is VERY important!!
167 Q1e :=
168 # EAT the quiet printf command
169 Q2s := true # NOTE: the space between @true and the # is VERY important!!
170 Q2e :=
171 # EAT the logging command
172 Q3s := true # NOTE: the space between @true and the # is VERY important!!
173 Q3e :=
174 # do not quiet the command
175 Q4s :=
176 Q4e :=
177endif
178
179
180ifeq (${G_BUILD},${B_WIN32})
181 prefix := /usr/mingw32
182else
183 prefix := /usr
184endif
185exec_prefix := ${prefix}
186includedir := ${prefix}/include
187libdir := ${exec_prefix}/lib
188INSTALL := install
189