updated targets.txt with changes to 'all'
[libbear.git] / vars.mk
1
2 # cause the fancy $${@D} directory rules to work out
3 .SECONDEXPANSION:
4
5 B_DEBUG    := DEBUG
6 B_FINAL    := FINAL
7 B_WIN32    := WIN32
8
9 # set this on the command line to get a WIN32 or a FINAL build
10 G_BUILD    := ${B_DEBUG}
11
12 ifeq (${G_BUILD},${B_DEBUG})
13 else
14 ifeq (${G_BUILD},${B_FINAL})
15 else
16 ifeq (${G_BUILD},${B_WIN32})
17 else
18     $(error 'G_BUILD = ${G_BUILD}' is invalid. Valid types are '${B_DEBUG}', '${B_FINAL}' or '${B_WIN32}')
19 endif
20 endif
21 endif
22
23
24 T_OPTFLAGS := -O2
25 T_DBGFLAGS := -ggdb
26 T_PRFFLAGS := ${T_DBGFLAGS} -pg
27 T_WARFLAGS := -Wall -Wextra -pedantic -ansi
28
29 G_CXXFLAGS := ${T_WARFLAGS}
30 ifeq (${G_BUILD},${B_DEBUG})
31     G_CXXFLAGS    += ${T_DBGFLAGS}
32 else
33 ifeq (${G_BUILD},${B_FINAL})
34     G_CXXFLAGS    += ${T_OPTFLAGS}
35 else
36 ifeq (${G_BUILD},${B_WIN32})
37     G_CXXFLAGS    += ${T_OPTFLAGS}
38 else
39     $(error 'G_BUILD = ${G_BUILD}' is invalid.)
40 endif
41 endif
42 endif
43
44 T_OPTFLAGS :=
45 T_DBGFLAGS :=
46 T_PRFFLAGS :=
47 T_WARFLAGS :=
48
49 G_LNKFLAGS :=
50
51 ifeq (${G_BUILD},${B_WIN32})
52     G_CXX := mingw32-g++
53 else
54     G_CXX := g++
55 endif
56
57 ifeq (${G_BUILD},${B_WIN32})
58     G_LIBGL   := -lopengl32 -lglu32
59     G_LIBSDL  := `/usr/mingw32/bin/sdl-config --libs`
60 else
61     G_LIBGL   := -lGL -lGLU
62     G_LIBSDL  := `sdl-config --libs`
63 endif
64
65 G_SRCSDIR := src/
66 G_DEPSDIR := deps/
67
68 ifeq (${G_BUILD},${B_DEBUG})
69     G_OBJSDIR := objsd/
70     G_BINDIR  := bind/
71 else
72 ifeq (${G_BUILD},${B_FINAL})
73     G_OBJSDIR := objs/
74     G_BINDIR  := bin/
75 else
76 ifeq (${G_BUILD},${B_WIN32})
77     G_OBJSDIR := objs-mingw32/
78     G_BINDIR  := bin-mingw32/
79 else
80     $(error 'G_BUILD = ${G_BUILD}' is invalid.)
81 endif
82 endif
83 endif
84
85
86 ifeq (${G_BUILD},${B_WIN32})
87     PRNTFMT := printf "%-12s: %s\n"
88 else
89     PRNTFMT := printf "%-8s: %s\n"
90 endif
91
92 VERBOSE := 0
93
94 ifeq (${VERBOSE},0)
95     # quiet the printf command
96     Q1 := @
97     # quiet the command that is `replaced' by an echo
98     Q2 := @
99 else
100     # EAT the printf command as if it was not there
101     Q1 := @true # NOTE: the space between @true and the # is VERY important!!
102     # do not quiet the command output
103     Q2 :=
104 endif
105
106
107 ifeq (${G_BUILD},${B_WIN32})
108     prefix      := /usr/mingw32
109 else
110     prefix      := /usr
111 endif
112 exec_prefix := ${prefix}
113 includedir  := ${prefix}/include
114 libdir      := ${exec_prefix}/lib
115 INSTALL     := install
116