Previous 199869 Revisions Next

r36682 Thursday 26th March, 2015 at 14:45:59 UTC by Miodrag Milanović
More parameter handling (nw)
[/trunk]makefile
[scripts]genie.lua

trunk/makefile
r245193r245194
191191
192192PARAMS+= --distro=$(DISTRO)
193193
194#-------------------------------------------------
195# sanity check the configuration
196#-------------------------------------------------
197
198# enable symbols as it is useless without them
199ifdef SANITIZE
200SYMBOLS = 1
201endif
202
203# profiler defaults to on for DEBUG builds
204ifdef DEBUG
205ifndef PROFILER
206PROFILER = 1
207endif
208endif
209
210# allow gprof profiling as well, which overrides the internal PROFILER
211# also enable symbols as it is useless without them
212ifdef PROFILE
213PROFILER =
214SYMBOLS = 1
215ifndef SYMLEVEL
216SYMLEVEL = 1
217endif
218endif
219
220# specify a default optimization level if none explicitly stated
221ifndef OPTIMIZE
222ifndef SYMBOLS
223OPTIMIZE = 3
224else
225OPTIMIZE = 0
226endif
227endif
228
229# set the symbols level
230ifdef SYMBOLS
231ifndef SYMLEVEL
232SYMLEVEL = 2
233endif
234endif
235
236ifdef SYMBOLS
237PARAMS+= --SYMBOLS=$(SYMBOLS)
238endif
239
240ifdef SYMLEVEL
241PARAMS+= --SYMLEVEL=$(SYMLEVEL)
242endif
243
244ifdef PROFILER
245PARAMS+= --PROFILER=$(PROFILER)
246endif
247
248ifdef PROFILE
249PARAMS+= --PROFILE=$(PROFILE)
250endif
251
252ifdef OPTIMIZE
253PARAMS+= --OPTIMIZE=$(OPTIMIZE)
254endif
255
256ifdef ARCHOPTS
257PARAMS+= --ARCHOPTS=$(ARCHOPTS)
258endif
259
260ifdef MAP
261PARAMS+= --MAP=$(MAP)
262endif
263
194264# extension for executables
195265EXE =
196266
trunk/scripts/genie.lua
r245193r245194
114114   description = "LD replacement",
115115}
116116
117newoption {
118   trigger = "PROFILE",
119   description = "Enable profiling.",
120}
121
122newoption {
123   trigger = "SYMBOLS",
124   description = "Enable symbols.",
125}
126
127newoption {
128   trigger = "SYMLEVEL",
129   description = "Symbols level.",
130}
131
132newoption {
133   trigger = "PROFILER",
134   description = "Include the internal profiler.",
135}
136
137newoption {
138   trigger = "OPTIMIZE",
139   description = "Optimization level.",
140}
141
142newoption {
143   trigger = "ARCHOPTS",
144   description = "ARCHOPTS.",
145}
146
147newoption {
148   trigger = "MAP",
149   description = "Generate a link map.",
150}
151
117152local os_version = str_to_version(_OPTIONS["os_version"])
118153USE_BGFX = 1
119154if (_OPTIONS["targetos"]=="macosx" and  os_version < 100700) then
r245193r245194
180215
181216configuration { "x64", "Release" }
182217   targetsuffix "64"
218   if _OPTIONS["PROFILE"] then
219      targetsuffix "64p"
220   end
183221
184222configuration { "x64", "Debug" }
185223   targetsuffix "64d"
186
224   if _OPTIONS["PROFILE"] then
225      targetsuffix "64dp"
226   end
227   
187228configuration { "x32", "Release" }
188229   targetsuffix ""
189
230   if _OPTIONS["PROFILE"] then
231      targetsuffix "p"
232   end
233   
190234configuration { "x32", "Debug" }
191235   targetsuffix "d"
192
236   if _OPTIONS["PROFILE"] then
237      targetsuffix "dp"
238   end
239   
193240configuration { "Native", "Release" }
194241   targetsuffix ""
242   if _OPTIONS["PROFILE"] then
243      targetsuffix "p"
244   end
195245
196246configuration { "Native", "Debug" }
197247   targetsuffix "d"
248   if _OPTIONS["PROFILE"] then
249      targetsuffix "dp"
250   end
198251
199252configuration { }
200253
r245193r245194
235288configuration { "Debug" }
236289   defines {
237290      "MAME_DEBUG",
238      "MAME_PROFILER", -- define MAME_PROFILER if we are a profiling build
239291   }
292   if _OPTIONS["PROFILER"] then
293      defines{
294         "MAME_PROFILER", -- define MAME_PROFILER if we are a profiling build
295      }
296   end
297
240298configuration { "Release" }
241299   defines {
242300      "NDEBUG",
r245193r245194
312370      }
313371   end
314372-- 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
373if _OPTIONS["SYMBOLS"]~=nil then
374   buildoptions {
375      "-g" .. _OPTIONS["SYMLEVEL"],
376      "-fno-omit-frame-pointer",
377      "-fno-optimize-sibling-calls",
378   }
379end
318380
319381--# we need to disable some additional implicit optimizations for profiling
320--ifdef PROFILE
321--CCOMFLAGS += -mno-omit-leaf-frame-pointer
322--endif
323
382if _OPTIONS["PROFILE"] then
383   buildoptions {
384      "-mno-omit-leaf-frame-pointer",
385   }
386end
324387-- add -v if we need verbose build information
325--ifdef VERBOSE
326--CCOMFLAGS += -v
327--endif
388if _OPTIONS["VERBOSE"] then
389   buildoptions {
390      "-v",
391   }
392end
328393
329394-- only show deprecation warnings when enabled
330395--ifndef DEPRECATED
r245193r245194
334399--endif
335400
336401-- add profiling information for the compiler
337--ifdef PROFILE
338--CCOMFLAGS += -pg
339--endif
402if _OPTIONS["PROFILE"] then
403   buildoptions {
404      "-pg",
405   }
406   linkoptions {
407      "-pg",
408   }
409end
410if _OPTIONS["SYMBOLS"]==nil then
411   if _OPTIONS["targetos"]=="macosx" then
412      linkoptions {
413         "-s",
414      }
415   end
416end
340417
341418--# add the optimization flag
342419   buildoptions {
343      "-O3",
420      "-O".. _OPTIONS["OPTIMIZE"],
344421      "-fno-strict-aliasing"
345422   }
346423
r245193r245194
352429
353430
354431-- if we are optimizing, include optimization options
355--ifneq ($(OPTIMIZE),0)
356--CCOMFLAGS += -fno-strict-aliasing $(ARCHOPTS)
432--ifneq ($(),0)
433if _OPTIONS["OPTIMIZE"] then
434   buildoptions {
435      "-fno-strict-aliasing"
436   }
437   if _OPTIONS["ARCHOPTS"] then   
438      buildoptions {
439         _OPTIONS["ARCHOPTS"]
440      }
441   end
357442--ifdef LTO
358443--CCOMFLAGS += -flto
359444--endif
360--endif
445end
361446
362447--ifdef SSE2
363448--CCOMFLAGS += -msse2
r245193r245194
368453--else
369454--CCOMFLAGS += -Wno-unknown-pragmas
370455--endif
456
457if _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   
468end
469
371470   buildoptions {
372471      "-Wno-unknown-pragmas",
373472   }


Previous 199869 Revisions Next


© 1997-2024 The MAME Team