Commit | Line | Data |
---|---|---|
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 | |
7 | SS_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. | |
14 | SS_DEPSDIR = $(patsubst %/,%,$(patsubst ${OBJSDIR_$(1)}%,${DEPSDIR_$(1)}%,$(dir $@))) | |
15 | ||
16 | ||
698cb4b6 PG |
17 | B_DEBUG := DEBUG |
18 | B_FINAL := FINAL | |
19 | B_WIN32 := WIN32 | |
333583c5 | 20 | B_CYGWIN := CYGWIN |
698cb4b6 PG |
21 | |
22 | # set this on the command line to get a WIN32 or a FINAL build | |
23 | G_BUILD := ${B_DEBUG} | |
24 | ||
25 | ifeq (${G_BUILD},${B_DEBUG}) | |
26 | else | |
27 | ifeq (${G_BUILD},${B_FINAL}) | |
28 | else | |
29 | ifeq (${G_BUILD},${B_WIN32}) | |
30 | else | |
333583c5 PG |
31 | ifeq (${G_BUILD},${B_CYGWIN}) |
32 | else | |
33 | $(error 'G_BUILD = ${G_BUILD}' is invalid. Valid types are '${B_DEBUG}', '${B_FINAL}', '${B_CYGWIN}', or '${B_WIN32}') | |
34 | endif | |
698cb4b6 PG |
35 | endif |
36 | endif | |
37 | endif | |
38 | ||
39 | ||
7bbc50a4 PG |
40 | T_OPTFLAGS := -O2 |
41 | T_DBGFLAGS := -ggdb | |
a98a33a6 | 42 | T_PRFFLAGS := ${T_DBGFLAGS} -pg |
c08ba753 PG |
43 | |
44 | T_WARFLAGS := | |
45 | T_WARFLAGS += -Wall | |
46 | T_WARFLAGS += -Wextra | |
47 | T_WARFLAGS += -pedantic | |
48 | T_WARFLAGS += -ansi | |
49 | T_WARFLAGS += -Wshadow | |
50 | T_WARFLAGS += -Wswitch-enum | |
51 | T_WARFLAGS += -Wfloat-equal | |
52 | T_WARFLAGS += -Wundef | |
bc38cb36 | 53 | T_WARFLAGS += -Wswitch-enum |
3fc83b9f | 54 | |
7bbc50a4 | 55 | G_CXXFLAGS := ${T_WARFLAGS} |
698cb4b6 PG |
56 | ifeq (${G_BUILD},${B_DEBUG}) |
57 | G_CXXFLAGS += ${T_DBGFLAGS} | |
58 | else | |
59 | ifeq (${G_BUILD},${B_FINAL}) | |
7bbc50a4 | 60 | G_CXXFLAGS += ${T_OPTFLAGS} |
9cc902bf | 61 | else |
698cb4b6 | 62 | ifeq (${G_BUILD},${B_WIN32}) |
7bbc50a4 | 63 | G_CXXFLAGS += ${T_OPTFLAGS} |
9cc902bf | 64 | else |
333583c5 PG |
65 | ifeq (${G_BUILD},${B_CYGWIN}) |
66 | G_CXXFLAGS += ${T_OPTFLAGS} | |
67 | else | |
698cb4b6 PG |
68 | $(error 'G_BUILD = ${G_BUILD}' is invalid.) |
69 | endif | |
9cc902bf PG |
70 | endif |
71 | endif | |
333583c5 | 72 | endif |
3fc83b9f | 73 | |
7bbc50a4 PG |
74 | T_OPTFLAGS := |
75 | T_DBGFLAGS := | |
76 | T_PRFFLAGS := | |
77 | T_WARFLAGS := | |
78 | ||
a98a33a6 | 79 | G_LNKFLAGS := |
7bbc50a4 | 80 | |
698cb4b6 | 81 | ifeq (${G_BUILD},${B_WIN32}) |
7bbc50a4 | 82 | G_CXX := mingw32-g++ |
3fc83b9f | 83 | else |
7bbc50a4 | 84 | G_CXX := g++ |
3fc83b9f PG |
85 | endif |
86 | ||
333583c5 PG |
87 | ifeq (${G_BUILD},${B_DEBUG}) |
88 | G_LIBGL := -lGL -lGLU | |
89 | G_LIBSDL := `sdl-config --libs` | |
90 | else | |
91 | ifeq (${G_BUILD},${B_FINAL}) | |
92 | G_LIBGL := -lGL -lGLU | |
93 | G_LIBSDL := `sdl-config --libs` | |
94 | else | |
698cb4b6 | 95 | ifeq (${G_BUILD},${B_WIN32}) |
b6a453de PG |
96 | G_LIBGL := -lopengl32 -lglu32 |
97 | G_LIBSDL := `/usr/mingw32/bin/sdl-config --libs` | |
98 | else | |
333583c5 PG |
99 | ifeq (${G_BUILD},${B_CYGWIN}) |
100 | G_LIBGL := -lopengl32 -lglu32 | |
b6a453de | 101 | G_LIBSDL := `sdl-config --libs` |
333583c5 PG |
102 | else |
103 | $(error 'G_BUILD = ${G_BUILD}' is invalid.) | |
104 | endif | |
105 | endif | |
106 | endif | |
b6a453de PG |
107 | endif |
108 | ||
c3f228a5 | 109 | G_SRCSDIR := src |
75c4965c | 110 | |
698cb4b6 | 111 | ifeq (${G_BUILD},${B_DEBUG}) |
c3f228a5 PG |
112 | G_OBJSDIR := objsd |
113 | G_BINDIR := bind | |
ff3fc4bf | 114 | G_DEPSDIR := depsd |
75c4965c | 115 | else |
698cb4b6 | 116 | ifeq (${G_BUILD},${B_FINAL}) |
c3f228a5 PG |
117 | G_OBJSDIR := objs |
118 | G_BINDIR := bin | |
ff3fc4bf | 119 | G_DEPSDIR := deps |
75c4965c | 120 | else |
698cb4b6 | 121 | ifeq (${G_BUILD},${B_WIN32}) |
c3f228a5 PG |
122 | G_OBJSDIR := objs-mingw32 |
123 | G_BINDIR := bin-mingw32 | |
ff3fc4bf | 124 | G_DEPSDIR := deps-mingw32 |
698cb4b6 | 125 | else |
333583c5 | 126 | ifeq (${G_BUILD},${B_CYGWIN}) |
ff3fc4bf PG |
127 | G_OBJSDIR := objs-cygwin |
128 | G_BINDIR := bin-cygwin | |
129 | G_DEPSDIR := deps-cygwin | |
333583c5 | 130 | else |
698cb4b6 PG |
131 | $(error 'G_BUILD = ${G_BUILD}' is invalid.) |
132 | endif | |
75c4965c PG |
133 | endif |
134 | endif | |
333583c5 | 135 | endif |
75c4965c | 136 | |
3994427d PG |
137 | LOGFILE := bld.log |
138 | ||
139 | $(shell rm -f ${LOGFILE}) # remove the log file from last run | |
b6a453de | 140 | |
698cb4b6 | 141 | ifeq (${G_BUILD},${B_WIN32}) |
3fc83b9f | 142 | PRNTFMT := printf "%-12s: %s\n" |
97c2dcb5 | 143 | PRNTLOG := printf "\n\#\# %-12s: %s\n" |
3fc83b9f PG |
144 | else |
145 | PRNTFMT := printf "%-8s: %s\n" | |
97c2dcb5 | 146 | PRNTLOG := printf "\n\#\# %-8s: %s\n" |
3fc83b9f PG |
147 | endif |
148 | ||
149 | VERBOSE := 0 | |
150 | ||
151 | ifeq (${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 | 164 | else |
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 |
177 | endif |
178 | ||
b6a453de | 179 | |
698cb4b6 | 180 | ifeq (${G_BUILD},${B_WIN32}) |
b6a453de PG |
181 | prefix := /usr/mingw32 |
182 | else | |
183 | prefix := /usr | |
184 | endif | |
185 | exec_prefix := ${prefix} | |
186 | includedir := ${prefix}/include | |
187 | libdir := ${exec_prefix}/lib | |
188 | INSTALL := install | |
189 |