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