cleaned signal handler
[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
20
21# set this on the command line to get a WIN32 or a FINAL build
22G_BUILD := ${B_DEBUG}
23
24ifeq (${G_BUILD},${B_DEBUG})
25else
26ifeq (${G_BUILD},${B_FINAL})
27else
28ifeq (${G_BUILD},${B_WIN32})
29else
30 $(error 'G_BUILD = ${G_BUILD}' is invalid. Valid types are '${B_DEBUG}', '${B_FINAL}' or '${B_WIN32}')
31endif
32endif
33endif
34
35
7bbc50a4
PG
36T_OPTFLAGS := -O2
37T_DBGFLAGS := -ggdb
a98a33a6 38T_PRFFLAGS := ${T_DBGFLAGS} -pg
c08ba753
PG
39
40T_WARFLAGS :=
41T_WARFLAGS += -Wall
42T_WARFLAGS += -Wextra
43T_WARFLAGS += -pedantic
44T_WARFLAGS += -ansi
45T_WARFLAGS += -Wshadow
46T_WARFLAGS += -Wswitch-enum
47T_WARFLAGS += -Wfloat-equal
48T_WARFLAGS += -Wundef
bc38cb36 49T_WARFLAGS += -Wswitch-enum
3fc83b9f 50
7bbc50a4 51G_CXXFLAGS := ${T_WARFLAGS}
698cb4b6
PG
52ifeq (${G_BUILD},${B_DEBUG})
53 G_CXXFLAGS += ${T_DBGFLAGS}
54else
55ifeq (${G_BUILD},${B_FINAL})
7bbc50a4 56 G_CXXFLAGS += ${T_OPTFLAGS}
9cc902bf 57else
698cb4b6 58ifeq (${G_BUILD},${B_WIN32})
7bbc50a4 59 G_CXXFLAGS += ${T_OPTFLAGS}
9cc902bf 60else
698cb4b6
PG
61 $(error 'G_BUILD = ${G_BUILD}' is invalid.)
62endif
9cc902bf
PG
63endif
64endif
3fc83b9f 65
7bbc50a4
PG
66T_OPTFLAGS :=
67T_DBGFLAGS :=
68T_PRFFLAGS :=
69T_WARFLAGS :=
70
a98a33a6 71G_LNKFLAGS :=
7bbc50a4 72
698cb4b6 73ifeq (${G_BUILD},${B_WIN32})
7bbc50a4 74 G_CXX := mingw32-g++
3fc83b9f 75else
7bbc50a4 76 G_CXX := g++
3fc83b9f
PG
77endif
78
698cb4b6 79ifeq (${G_BUILD},${B_WIN32})
b6a453de
PG
80 G_LIBGL := -lopengl32 -lglu32
81 G_LIBSDL := `/usr/mingw32/bin/sdl-config --libs`
82else
83 G_LIBGL := -lGL -lGLU
84 G_LIBSDL := `sdl-config --libs`
85endif
86
c3f228a5
PG
87G_SRCSDIR := src
88G_DEPSDIR := deps
75c4965c 89
698cb4b6 90ifeq (${G_BUILD},${B_DEBUG})
c3f228a5
PG
91 G_OBJSDIR := objsd
92 G_BINDIR := bind
75c4965c 93else
698cb4b6 94ifeq (${G_BUILD},${B_FINAL})
c3f228a5
PG
95 G_OBJSDIR := objs
96 G_BINDIR := bin
75c4965c 97else
698cb4b6 98ifeq (${G_BUILD},${B_WIN32})
c3f228a5
PG
99 G_OBJSDIR := objs-mingw32
100 G_BINDIR := bin-mingw32
698cb4b6
PG
101else
102 $(error 'G_BUILD = ${G_BUILD}' is invalid.)
103endif
75c4965c
PG
104endif
105endif
106
3994427d
PG
107LOGFILE := bld.log
108
109$(shell rm -f ${LOGFILE}) # remove the log file from last run
b6a453de 110
698cb4b6 111ifeq (${G_BUILD},${B_WIN32})
3fc83b9f 112 PRNTFMT := printf "%-12s: %s\n"
97c2dcb5 113 PRNTLOG := printf "\n\#\# %-12s: %s\n"
3fc83b9f
PG
114else
115 PRNTFMT := printf "%-8s: %s\n"
97c2dcb5 116 PRNTLOG := printf "\n\#\# %-8s: %s\n"
3fc83b9f
PG
117endif
118
119VERBOSE := 0
120
121ifeq (${VERBOSE},0)
3994427d
PG
122 # log the printf command
123 Q1s := @
124 Q1e := >> ${LOGFILE}
3fc83b9f 125 # quiet the printf command
3994427d
PG
126 Q2s := @
127 Q2e :=
128 # log the command
129 Q3s := @echo # NOTE: the space between @echo and the # is VERY important!!
130 Q3e := >> ${LOGFILE}
131 # quiet the command
132 Q4s := @
133 Q4e :=
3fc83b9f 134else
3994427d
PG
135 # EAT the logging printf command
136 Q1s := @true # NOTE: the space between @true and the # is VERY important!!
137 Q1e :=
138 # EAT the quiet printf command
139 Q2s := @true # NOTE: the space between @true and the # is VERY important!!
140 Q2e :=
141 # EAT the logging command
142 Q3s := @true # NOTE: the space between @true and the # is VERY important!!
143 Q3e :=
144 # do not quiet the command
145 Q4s :=
146 Q4e :=
3fc83b9f
PG
147endif
148
b6a453de 149
698cb4b6 150ifeq (${G_BUILD},${B_WIN32})
b6a453de
PG
151 prefix := /usr/mingw32
152else
153 prefix := /usr
154endif
155exec_prefix := ${prefix}
156includedir := ${prefix}/include
157libdir := ${exec_prefix}/lib
158INSTALL := install
159