Commit | Line | Data |
---|---|---|
3fc83b9f | 1 | |
698cb4b6 PG |
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 | ||
7bbc50a4 PG |
24 | T_OPTFLAGS := -O2 |
25 | T_DBGFLAGS := -ggdb | |
a98a33a6 | 26 | T_PRFFLAGS := ${T_DBGFLAGS} -pg |
c08ba753 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 | |
bc38cb36 | 37 | T_WARFLAGS += -Wswitch-enum |
3fc83b9f | 38 | |
7bbc50a4 | 39 | G_CXXFLAGS := ${T_WARFLAGS} |
698cb4b6 PG |
40 | ifeq (${G_BUILD},${B_DEBUG}) |
41 | G_CXXFLAGS += ${T_DBGFLAGS} | |
42 | else | |
43 | ifeq (${G_BUILD},${B_FINAL}) | |
7bbc50a4 | 44 | G_CXXFLAGS += ${T_OPTFLAGS} |
9cc902bf | 45 | else |
698cb4b6 | 46 | ifeq (${G_BUILD},${B_WIN32}) |
7bbc50a4 | 47 | G_CXXFLAGS += ${T_OPTFLAGS} |
9cc902bf | 48 | else |
698cb4b6 PG |
49 | $(error 'G_BUILD = ${G_BUILD}' is invalid.) |
50 | endif | |
9cc902bf PG |
51 | endif |
52 | endif | |
3fc83b9f | 53 | |
7bbc50a4 PG |
54 | T_OPTFLAGS := |
55 | T_DBGFLAGS := | |
56 | T_PRFFLAGS := | |
57 | T_WARFLAGS := | |
58 | ||
a98a33a6 | 59 | G_LNKFLAGS := |
7bbc50a4 | 60 | |
698cb4b6 | 61 | ifeq (${G_BUILD},${B_WIN32}) |
7bbc50a4 | 62 | G_CXX := mingw32-g++ |
3fc83b9f | 63 | else |
7bbc50a4 | 64 | G_CXX := g++ |
3fc83b9f PG |
65 | endif |
66 | ||
698cb4b6 | 67 | ifeq (${G_BUILD},${B_WIN32}) |
b6a453de PG |
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 | ||
75c4965c PG |
75 | G_SRCSDIR := src/ |
76 | G_DEPSDIR := deps/ | |
77 | ||
698cb4b6 PG |
78 | ifeq (${G_BUILD},${B_DEBUG}) |
79 | G_OBJSDIR := objsd/ | |
80 | G_BINDIR := bind/ | |
75c4965c | 81 | else |
698cb4b6 | 82 | ifeq (${G_BUILD},${B_FINAL}) |
75c4965c PG |
83 | G_OBJSDIR := objs/ |
84 | G_BINDIR := bin/ | |
85 | else | |
698cb4b6 PG |
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 | |
75c4965c PG |
92 | endif |
93 | endif | |
94 | ||
3994427d PG |
95 | LOGFILE := bld.log |
96 | ||
97 | $(shell rm -f ${LOGFILE}) # remove the log file from last run | |
b6a453de | 98 | |
698cb4b6 | 99 | ifeq (${G_BUILD},${B_WIN32}) |
3fc83b9f | 100 | PRNTFMT := printf "%-12s: %s\n" |
97c2dcb5 | 101 | PRNTLOG := printf "\n\#\# %-12s: %s\n" |
3fc83b9f PG |
102 | else |
103 | PRNTFMT := printf "%-8s: %s\n" | |
97c2dcb5 | 104 | PRNTLOG := printf "\n\#\# %-8s: %s\n" |
3fc83b9f PG |
105 | endif |
106 | ||
107 | VERBOSE := 0 | |
108 | ||
109 | ifeq (${VERBOSE},0) | |
3994427d PG |
110 | # log the printf command |
111 | Q1s := @ | |
112 | Q1e := >> ${LOGFILE} | |
3fc83b9f | 113 | # quiet the printf command |
3994427d PG |
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 := | |
3fc83b9f | 122 | else |
3994427d PG |
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 := | |
3fc83b9f PG |
135 | endif |
136 | ||
b6a453de | 137 | |
698cb4b6 | 138 | ifeq (${G_BUILD},${B_WIN32}) |
b6a453de PG |
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 |