trunk/makefile
| r245193 | r245194 | |
| 191 | 191 | |
| 192 | 192 | PARAMS+= --distro=$(DISTRO) |
| 193 | 193 | |
| 194 | #------------------------------------------------- |
| 195 | # sanity check the configuration |
| 196 | #------------------------------------------------- |
| 197 | |
| 198 | # enable symbols as it is useless without them |
| 199 | ifdef SANITIZE |
| 200 | SYMBOLS = 1 |
| 201 | endif |
| 202 | |
| 203 | # profiler defaults to on for DEBUG builds |
| 204 | ifdef DEBUG |
| 205 | ifndef PROFILER |
| 206 | PROFILER = 1 |
| 207 | endif |
| 208 | endif |
| 209 | |
| 210 | # allow gprof profiling as well, which overrides the internal PROFILER |
| 211 | # also enable symbols as it is useless without them |
| 212 | ifdef PROFILE |
| 213 | PROFILER = |
| 214 | SYMBOLS = 1 |
| 215 | ifndef SYMLEVEL |
| 216 | SYMLEVEL = 1 |
| 217 | endif |
| 218 | endif |
| 219 | |
| 220 | # specify a default optimization level if none explicitly stated |
| 221 | ifndef OPTIMIZE |
| 222 | ifndef SYMBOLS |
| 223 | OPTIMIZE = 3 |
| 224 | else |
| 225 | OPTIMIZE = 0 |
| 226 | endif |
| 227 | endif |
| 228 | |
| 229 | # set the symbols level |
| 230 | ifdef SYMBOLS |
| 231 | ifndef SYMLEVEL |
| 232 | SYMLEVEL = 2 |
| 233 | endif |
| 234 | endif |
| 235 | |
| 236 | ifdef SYMBOLS |
| 237 | PARAMS+= --SYMBOLS=$(SYMBOLS) |
| 238 | endif |
| 239 | |
| 240 | ifdef SYMLEVEL |
| 241 | PARAMS+= --SYMLEVEL=$(SYMLEVEL) |
| 242 | endif |
| 243 | |
| 244 | ifdef PROFILER |
| 245 | PARAMS+= --PROFILER=$(PROFILER) |
| 246 | endif |
| 247 | |
| 248 | ifdef PROFILE |
| 249 | PARAMS+= --PROFILE=$(PROFILE) |
| 250 | endif |
| 251 | |
| 252 | ifdef OPTIMIZE |
| 253 | PARAMS+= --OPTIMIZE=$(OPTIMIZE) |
| 254 | endif |
| 255 | |
| 256 | ifdef ARCHOPTS |
| 257 | PARAMS+= --ARCHOPTS=$(ARCHOPTS) |
| 258 | endif |
| 259 | |
| 260 | ifdef MAP |
| 261 | PARAMS+= --MAP=$(MAP) |
| 262 | endif |
| 263 | |
| 194 | 264 | # extension for executables |
| 195 | 265 | EXE = |
| 196 | 266 | |
trunk/scripts/genie.lua
| r245193 | r245194 | |
| 114 | 114 | description = "LD replacement", |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | newoption { |
| 118 | trigger = "PROFILE", |
| 119 | description = "Enable profiling.", |
| 120 | } |
| 121 | |
| 122 | newoption { |
| 123 | trigger = "SYMBOLS", |
| 124 | description = "Enable symbols.", |
| 125 | } |
| 126 | |
| 127 | newoption { |
| 128 | trigger = "SYMLEVEL", |
| 129 | description = "Symbols level.", |
| 130 | } |
| 131 | |
| 132 | newoption { |
| 133 | trigger = "PROFILER", |
| 134 | description = "Include the internal profiler.", |
| 135 | } |
| 136 | |
| 137 | newoption { |
| 138 | trigger = "OPTIMIZE", |
| 139 | description = "Optimization level.", |
| 140 | } |
| 141 | |
| 142 | newoption { |
| 143 | trigger = "ARCHOPTS", |
| 144 | description = "ARCHOPTS.", |
| 145 | } |
| 146 | |
| 147 | newoption { |
| 148 | trigger = "MAP", |
| 149 | description = "Generate a link map.", |
| 150 | } |
| 151 | |
| 117 | 152 | local os_version = str_to_version(_OPTIONS["os_version"]) |
| 118 | 153 | USE_BGFX = 1 |
| 119 | 154 | if (_OPTIONS["targetos"]=="macosx" and os_version < 100700) then |
| r245193 | r245194 | |
| 180 | 215 | |
| 181 | 216 | configuration { "x64", "Release" } |
| 182 | 217 | targetsuffix "64" |
| 218 | if _OPTIONS["PROFILE"] then |
| 219 | targetsuffix "64p" |
| 220 | end |
| 183 | 221 | |
| 184 | 222 | configuration { "x64", "Debug" } |
| 185 | 223 | targetsuffix "64d" |
| 186 | | |
| 224 | if _OPTIONS["PROFILE"] then |
| 225 | targetsuffix "64dp" |
| 226 | end |
| 227 | |
| 187 | 228 | configuration { "x32", "Release" } |
| 188 | 229 | targetsuffix "" |
| 189 | | |
| 230 | if _OPTIONS["PROFILE"] then |
| 231 | targetsuffix "p" |
| 232 | end |
| 233 | |
| 190 | 234 | configuration { "x32", "Debug" } |
| 191 | 235 | targetsuffix "d" |
| 192 | | |
| 236 | if _OPTIONS["PROFILE"] then |
| 237 | targetsuffix "dp" |
| 238 | end |
| 239 | |
| 193 | 240 | configuration { "Native", "Release" } |
| 194 | 241 | targetsuffix "" |
| 242 | if _OPTIONS["PROFILE"] then |
| 243 | targetsuffix "p" |
| 244 | end |
| 195 | 245 | |
| 196 | 246 | configuration { "Native", "Debug" } |
| 197 | 247 | targetsuffix "d" |
| 248 | if _OPTIONS["PROFILE"] then |
| 249 | targetsuffix "dp" |
| 250 | end |
| 198 | 251 | |
| 199 | 252 | configuration { } |
| 200 | 253 | |
| r245193 | r245194 | |
| 235 | 288 | configuration { "Debug" } |
| 236 | 289 | defines { |
| 237 | 290 | "MAME_DEBUG", |
| 238 | | "MAME_PROFILER", -- define MAME_PROFILER if we are a profiling build |
| 239 | 291 | } |
| 292 | if _OPTIONS["PROFILER"] then |
| 293 | defines{ |
| 294 | "MAME_PROFILER", -- define MAME_PROFILER if we are a profiling build |
| 295 | } |
| 296 | end |
| 297 | |
| 240 | 298 | configuration { "Release" } |
| 241 | 299 | defines { |
| 242 | 300 | "NDEBUG", |
| r245193 | r245194 | |
| 312 | 370 | } |
| 313 | 371 | end |
| 314 | 372 | -- add -g if we need symbols, and ensure we have frame pointers |
| 315 | | --ifdef SYMBOLS |
| 316 | | --CCOMFLAGS += -g$(SYMLEVEL) -fno-omit-frame-pointer -fno-optimize-sibling-calls |
| 317 | | --endif |
| 373 | if _OPTIONS["SYMBOLS"]~=nil then |
| 374 | buildoptions { |
| 375 | "-g" .. _OPTIONS["SYMLEVEL"], |
| 376 | "-fno-omit-frame-pointer", |
| 377 | "-fno-optimize-sibling-calls", |
| 378 | } |
| 379 | end |
| 318 | 380 | |
| 319 | 381 | --# we need to disable some additional implicit optimizations for profiling |
| 320 | | --ifdef PROFILE |
| 321 | | --CCOMFLAGS += -mno-omit-leaf-frame-pointer |
| 322 | | --endif |
| 323 | | |
| 382 | if _OPTIONS["PROFILE"] then |
| 383 | buildoptions { |
| 384 | "-mno-omit-leaf-frame-pointer", |
| 385 | } |
| 386 | end |
| 324 | 387 | -- add -v if we need verbose build information |
| 325 | | --ifdef VERBOSE |
| 326 | | --CCOMFLAGS += -v |
| 327 | | --endif |
| 388 | if _OPTIONS["VERBOSE"] then |
| 389 | buildoptions { |
| 390 | "-v", |
| 391 | } |
| 392 | end |
| 328 | 393 | |
| 329 | 394 | -- only show deprecation warnings when enabled |
| 330 | 395 | --ifndef DEPRECATED |
| r245193 | r245194 | |
| 334 | 399 | --endif |
| 335 | 400 | |
| 336 | 401 | -- add profiling information for the compiler |
| 337 | | --ifdef PROFILE |
| 338 | | --CCOMFLAGS += -pg |
| 339 | | --endif |
| 402 | if _OPTIONS["PROFILE"] then |
| 403 | buildoptions { |
| 404 | "-pg", |
| 405 | } |
| 406 | linkoptions { |
| 407 | "-pg", |
| 408 | } |
| 409 | end |
| 410 | if _OPTIONS["SYMBOLS"]==nil then |
| 411 | if _OPTIONS["targetos"]=="macosx" then |
| 412 | linkoptions { |
| 413 | "-s", |
| 414 | } |
| 415 | end |
| 416 | end |
| 340 | 417 | |
| 341 | 418 | --# add the optimization flag |
| 342 | 419 | buildoptions { |
| 343 | | "-O3", |
| 420 | "-O".. _OPTIONS["OPTIMIZE"], |
| 344 | 421 | "-fno-strict-aliasing" |
| 345 | 422 | } |
| 346 | 423 | |
| r245193 | r245194 | |
| 352 | 429 | |
| 353 | 430 | |
| 354 | 431 | -- if we are optimizing, include optimization options |
| 355 | | --ifneq ($(OPTIMIZE),0) |
| 356 | | --CCOMFLAGS += -fno-strict-aliasing $(ARCHOPTS) |
| 432 | --ifneq ($(),0) |
| 433 | if _OPTIONS["OPTIMIZE"] then |
| 434 | buildoptions { |
| 435 | "-fno-strict-aliasing" |
| 436 | } |
| 437 | if _OPTIONS["ARCHOPTS"] then |
| 438 | buildoptions { |
| 439 | _OPTIONS["ARCHOPTS"] |
| 440 | } |
| 441 | end |
| 357 | 442 | --ifdef LTO |
| 358 | 443 | --CCOMFLAGS += -flto |
| 359 | 444 | --endif |
| 360 | | --endif |
| 445 | end |
| 361 | 446 | |
| 362 | 447 | --ifdef SSE2 |
| 363 | 448 | --CCOMFLAGS += -msse2 |
| r245193 | r245194 | |
| 368 | 453 | --else |
| 369 | 454 | --CCOMFLAGS += -Wno-unknown-pragmas |
| 370 | 455 | --endif |
| 456 | |
| 457 | if _OPTIONS["MAP"] then |
| 458 | if (_OPTIONS["target"] == _OPTIONS["subtarget"]) then |
| 459 | linkoptions { |
| 460 | "-Wl,-Map," .. _OPTIONS["target"] .. ".map" |
| 461 | } |
| 462 | else |
| 463 | linkoptions { |
| 464 | "-Wl,-Map," .. _OPTIONS["target"] .. _OPTIONS["subtarget"] .. ".map" |
| 465 | } |
| 466 | |
| 467 | end |
| 468 | end |
| 469 | |
| 371 | 470 | buildoptions { |
| 372 | 471 | "-Wno-unknown-pragmas", |
| 373 | 472 | } |