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 |
7bbc50a4 | 27 | T_WARFLAGS := -Wall -Wextra -pedantic -ansi |
3fc83b9f | 28 | |
7bbc50a4 | 29 | G_CXXFLAGS := ${T_WARFLAGS} |
698cb4b6 PG |
30 | ifeq (${G_BUILD},${B_DEBUG}) |
31 | G_CXXFLAGS += ${T_DBGFLAGS} | |
32 | else | |
33 | ifeq (${G_BUILD},${B_FINAL}) | |
7bbc50a4 | 34 | G_CXXFLAGS += ${T_OPTFLAGS} |
9cc902bf | 35 | else |
698cb4b6 | 36 | ifeq (${G_BUILD},${B_WIN32}) |
7bbc50a4 | 37 | G_CXXFLAGS += ${T_OPTFLAGS} |
9cc902bf | 38 | else |
698cb4b6 PG |
39 | $(error 'G_BUILD = ${G_BUILD}' is invalid.) |
40 | endif | |
9cc902bf PG |
41 | endif |
42 | endif | |
3fc83b9f | 43 | |
7bbc50a4 PG |
44 | T_OPTFLAGS := |
45 | T_DBGFLAGS := | |
46 | T_PRFFLAGS := | |
47 | T_WARFLAGS := | |
48 | ||
a98a33a6 | 49 | G_LNKFLAGS := |
7bbc50a4 | 50 | |
698cb4b6 | 51 | ifeq (${G_BUILD},${B_WIN32}) |
7bbc50a4 | 52 | G_CXX := mingw32-g++ |
3fc83b9f | 53 | else |
7bbc50a4 | 54 | G_CXX := g++ |
3fc83b9f PG |
55 | endif |
56 | ||
698cb4b6 | 57 | ifeq (${G_BUILD},${B_WIN32}) |
b6a453de PG |
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 | ||
75c4965c PG |
65 | G_SRCSDIR := src/ |
66 | G_DEPSDIR := deps/ | |
67 | ||
698cb4b6 PG |
68 | ifeq (${G_BUILD},${B_DEBUG}) |
69 | G_OBJSDIR := objsd/ | |
70 | G_BINDIR := bind/ | |
75c4965c | 71 | else |
698cb4b6 | 72 | ifeq (${G_BUILD},${B_FINAL}) |
75c4965c PG |
73 | G_OBJSDIR := objs/ |
74 | G_BINDIR := bin/ | |
75 | else | |
698cb4b6 PG |
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 | |
75c4965c PG |
82 | endif |
83 | endif | |
84 | ||
3994427d PG |
85 | LOGFILE := bld.log |
86 | ||
87 | $(shell rm -f ${LOGFILE}) # remove the log file from last run | |
b6a453de | 88 | |
698cb4b6 | 89 | ifeq (${G_BUILD},${B_WIN32}) |
3fc83b9f | 90 | PRNTFMT := printf "%-12s: %s\n" |
97c2dcb5 | 91 | PRNTLOG := printf "\n\#\# %-12s: %s\n" |
3fc83b9f PG |
92 | else |
93 | PRNTFMT := printf "%-8s: %s\n" | |
97c2dcb5 | 94 | PRNTLOG := printf "\n\#\# %-8s: %s\n" |
3fc83b9f PG |
95 | endif |
96 | ||
97 | VERBOSE := 0 | |
98 | ||
99 | ifeq (${VERBOSE},0) | |
3994427d PG |
100 | # log the printf command |
101 | Q1s := @ | |
102 | Q1e := >> ${LOGFILE} | |
3fc83b9f | 103 | # quiet the printf command |
3994427d PG |
104 | Q2s := @ |
105 | Q2e := | |
106 | # log the command | |
107 | Q3s := @echo # NOTE: the space between @echo and the # is VERY important!! | |
108 | Q3e := >> ${LOGFILE} | |
109 | # quiet the command | |
110 | Q4s := @ | |
111 | Q4e := | |
3fc83b9f | 112 | else |
3994427d PG |
113 | # EAT the logging printf command |
114 | Q1s := @true # NOTE: the space between @true and the # is VERY important!! | |
115 | Q1e := | |
116 | # EAT the quiet printf command | |
117 | Q2s := @true # NOTE: the space between @true and the # is VERY important!! | |
118 | Q2e := | |
119 | # EAT the logging command | |
120 | Q3s := @true # NOTE: the space between @true and the # is VERY important!! | |
121 | Q3e := | |
122 | # do not quiet the command | |
123 | Q4s := | |
124 | Q4e := | |
3fc83b9f PG |
125 | endif |
126 | ||
b6a453de | 127 | |
698cb4b6 | 128 | ifeq (${G_BUILD},${B_WIN32}) |
b6a453de PG |
129 | prefix := /usr/mingw32 |
130 | else | |
131 | prefix := /usr | |
132 | endif | |
133 | exec_prefix := ${prefix} | |
134 | includedir := ${prefix}/include | |
135 | libdir := ${exec_prefix}/lib | |
136 | INSTALL := install | |
137 |