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