home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 March / Gamestar_82_2006-03_dvd.iso / DVDStar / Editace / quake4_sdkv10.exe / source / SConstruct < prev   
Text File  |  2005-11-14  |  19KB  |  628 lines

  1. # -*- mode: python -*-
  2. # Quake4 build script
  3. # TTimo <ttimo@idsoftware.com>
  4. # http://scons.sourceforge.net
  5.  
  6. import sys, os, time, commands, re, pickle, StringIO, popen2, commands, pdb, zipfile, string
  7. import SCons
  8.  
  9. sys.path.append( 'sys/scons' )
  10. import scons_utils
  11.  
  12. conf_filename='site.conf'
  13. # choose configuration variables which should be saved between runs
  14. # ( we handle all those as strings )
  15. serialized=['CC', 'CXX', 'JOBS', 'BUILD', 'IDNET_HOST', 'GL_HARDLINK', 'DEDICATED',
  16.     'DEBUG_MEMORY', 'LIBC_MALLOC', 'ID_NOLANADDRESS', 'ID_MCHECK',
  17.     'TARGET_CORE', 'TARGET_GAME', 'TARGET_MONO', 'TARGET_DEMO', 'NOCURL',
  18.     'BUILD_ROOT', 'Q4TEST', 'TARGET_GAMEPAK', 'PATCHLEVEL' ]
  19.  
  20. # global build mode ------------------------------
  21.  
  22. g_sdk = not os.path.exists( 'sys/scons/SConscript.core' )
  23.  
  24. # ------------------------------------------------
  25.  
  26. # help -------------------------------------------
  27.  
  28. help_string = """
  29. Usage: scons [OPTIONS] [TARGET] [CONFIG]
  30.  
  31. [OPTIONS] and [TARGET] are covered in command line options, use scons -H
  32.  
  33. [CONFIG]: KEY="VALUE" [...]
  34. a number of configuration options saved between runs in the """ + conf_filename + """ file
  35. erase """ + conf_filename + """ to start with default settings again
  36.  
  37. CC (default gcc)
  38. CXX (default g++)
  39.     Specify C and C++ compilers (defaults gcc and g++)
  40.     ex: CC="gcc-3.3"
  41.     You can use ccache and distcc, for instance:
  42.     CC="ccache distcc gcc" CXX="ccache distcc g++"
  43.  
  44. JOBS (default 1)
  45.     Parallel build
  46.  
  47. BUILD (default debug)
  48.     Use debug-all/debug/release to select build settings
  49.     ex: BUILD="release"
  50.     debug-all: no optimisations, debugging symbols
  51.     debug: -O -g
  52.     release: all optimisations, including CPU target etc.
  53.  
  54. BUILD_ROOT (default 'build')
  55.     change the build root directory
  56.  
  57. NOCONF (default 0, not saved)
  58.     ignore site configuration and use defaults + command line only
  59. """
  60.  
  61. if ( not g_sdk ):
  62.     help_string += """
  63. DEDICATED (default 0)
  64.     Control regular / dedicated type of build:
  65.     0 - client
  66.     1 - dedicated server
  67.     2 - both
  68.  
  69. TARGET_CORE (default 1)
  70.     Build the core
  71.  
  72. TARGET_GAME (default 1)
  73.     Build the game code
  74.  
  75. TARGET_MONO (default 0)
  76.     Build a monolithic binary
  77.  
  78. TARGET_DEMO (default 0)
  79.     Build demo client ( both a core and game, no mono )
  80.     NOTE: if you *only* want the demo client, set TARGET_CORE and TARGET_GAME to 0
  81.  
  82. IDNET_HOST (default to source hardcoded)
  83.     Override builtin IDNET_HOST with your own settings
  84.     
  85. GL_HARDLINK (default 0)
  86.     Instead of dynamically loading the OpenGL libraries, use implicit dependencies
  87.     NOTE: no GL logging capability and no r_glDriver with GL_HARDLINK 1
  88.  
  89. DEBUG_MEMORY (default 0)
  90.     Enables memory logging to file
  91.     
  92. LIBC_MALLOC (default 1)
  93.     Toggle idHeap memory / libc malloc usage
  94.     When libc malloc is on, memory size statistics are wrong ( no _msize )
  95.  
  96. ID_NOLANADDRESS (default 0)
  97.     Don't recognize any IP as LAN address. This is useful when debugging network
  98.     code where LAN / not LAN influences application behaviour
  99.     
  100. ID_MCHECK (default 2)
  101.     Perform heap consistency checking
  102.     0: on in Debug / off in Release
  103.     1 forces on, 2 forces off
  104.     note that idlib has it's own block allocator/checking
  105.     this should not be considered a replacement, but an additional tool
  106.     note: this is the same as MALLOC_CHECK_, but different from mtrace
  107.  
  108. SETUP_TAGGED (default 0, not saved)
  109.     build tagged binaries distribution implies release, excludes other setups
  110.  
  111. SETUP_DEDICATED (default 0, not saved)
  112.     build dedicated server setup. implies release
  113.  
  114. SETUP_DEMO (default 0, not saved)
  115.     build demo setup. implies release
  116.  
  117. SETUP_FULL (default 0, not saved)
  118.     build full setup. implies release
  119.  
  120. PATCHLEVEL (default 0)
  121.     setup a patchlevel for si_version and installer name since I work Linux releases from a vendor tree and don't modify AutoVersion.h build numbers
  122.  
  123. TARGET_GAMEPAK (default 0, not saved)
  124.     build a game pak pk4
  125.     if no setup is scheduled, from whatever game is being compiled ( current configuration )
  126.     if setups are scheduled, controls gamepak building during setup ( might wanna use a reference one for pure-compatible updates )
  127.  
  128. SDK (default 0, not saved)
  129.     build an SDK release
  130.  
  131. NOCURL (default 0)
  132.     set to 1 to disable usage of libcurl and http/ftp downloads feature
  133.  
  134. FIX_INCLUDE (default 0, not saved)
  135.     fix include paths while compiling
  136.     wraps around the compiler call to catch and fix include path errors
  137.     note that since this process modifies files on the fly, it's not a good idea to use it with several jobs
  138.  
  139. FIX_SUPER (default 0, not saved)
  140.     fix usage of __super msvc-ism
  141.     wraps around gcc to do a search and fix pass
  142.  
  143. Q4TEST (default 0)
  144.     q4test build
  145.     MP-only gamecode, enables binary tagging
  146.  
  147. ASSETS (optional, not saved)
  148.     point to the setup assets directory
  149. """
  150.  
  151. Help( help_string )
  152.  
  153. # end help ---------------------------------------
  154.  
  155. # sanity -----------------------------------------
  156.  
  157. EnsureSConsVersion( 0, 96 )
  158.  
  159. # end sanity -------------------------------------
  160.  
  161. # system detection -------------------------------
  162.  
  163. # OS and CPU
  164. OS = commands.getoutput( 'uname -s' )
  165. if ( OS == 'Linux' ):
  166.     cpu = commands.getoutput( 'uname -m' )
  167.     if ( cpu == 'i686' ):
  168.         cpu = 'x86'
  169.     else:
  170.         cpu = 'cpu'
  171. elif ( OS == 'Darwin' ):
  172.     cpu = commands.getoutput( 'uname -m' )
  173.     if ( cpu == 'Power Macintosh' ):
  174.         cpu = 'ppc'
  175.     else:
  176.         cpu = 'cpu'
  177.  
  178. # end system detection ---------------------------
  179.  
  180. # default settings -------------------------------
  181.  
  182. CC = 'gcc'
  183. CXX = 'g++'
  184. JOBS = '1'
  185. BUILD = 'debug'
  186. DEDICATED = '0'
  187. TARGET_CORE = '1'
  188. TARGET_GAME = '1'
  189. TARGET_GAMEPAK = '0'
  190. TARGET_MONO = '0'
  191. TARGET_DEMO = '0'
  192. IDNET_HOST = ''
  193. GL_HARDLINK = '0'
  194. if ( OS == 'Darwin' ):
  195.     GL_HARDLINK = '1'
  196. DEBUG_MEMORY = '0'
  197. LIBC_MALLOC = '1'
  198. ID_NOLANADDRESS = '0'
  199. ID_MCHECK = '2'
  200. BUILD_ROOT = 'build'
  201. SETUP_TAGGED = '0'
  202. SETUP_DEDICATED = '0'
  203. SETUP_DEMO = '0'
  204. SETUP_FULL = '0'
  205. SETUP = '0'    # no cmdline control, will be set to 1 if any form of setup is requested
  206. SDK = '0'
  207. NOCONF = '0'
  208. # TMP - off till patch 1
  209. NOCURL = '1'
  210. FIX_INCLUDES = '0'
  211. FIX_SUPER = '0'
  212. Q4TEST = '0'
  213. ASSETS = ''
  214. PATCHLEVEL = '0'
  215.  
  216. # end default settings ---------------------------
  217.  
  218. # site settings ----------------------------------
  219.  
  220. if ( not ARGUMENTS.has_key( 'NOCONF' ) or ARGUMENTS['NOCONF'] != '1' ):
  221.     site_dict = {}
  222.     if (os.path.exists(conf_filename)):
  223.         site_file = open(conf_filename, 'r')
  224.         p = pickle.Unpickler(site_file)
  225.         site_dict = p.load()
  226.         print 'Loading build configuration from ' + conf_filename + ':'
  227.         for k, v in site_dict.items():
  228.             exec_cmd = k + '=\'' + v + '\''
  229.             print '  ' + exec_cmd
  230.             exec(exec_cmd)
  231. else:
  232.     print 'Site settings ignored'
  233.  
  234. # end site settings ------------------------------
  235.  
  236. # command line settings --------------------------
  237.  
  238. for k in ARGUMENTS.keys():
  239.     exec_cmd = k + '=\'' + ARGUMENTS[k] + '\''
  240.     print 'Command line: ' + exec_cmd
  241.     exec( exec_cmd )
  242.  
  243. # end command line settings ----------------------
  244.  
  245. # save site configuration ----------------------
  246.  
  247. if ( not ARGUMENTS.has_key( 'NOCONF' ) or ARGUMENTS['NOCONF'] != '1' ):
  248.     for k in serialized:
  249.         exec_cmd = 'site_dict[\'' + k + '\'] = ' + k
  250.         exec(exec_cmd)
  251.  
  252.     site_file = open(conf_filename, 'w')
  253.     p = pickle.Pickler(site_file)
  254.     p.dump(site_dict)
  255.     site_file.close()
  256.  
  257. # end save site configuration ------------------
  258.  
  259. # configuration rules --------------------------
  260.  
  261. if ( TARGET_GAMEPAK == '1' ):
  262.     TARGET_GAME = '1'
  263.  
  264. if ( SETUP_TAGGED != '0' or SETUP_DEDICATED != '0' or SETUP_DEMO != '0' or SETUP_FULL != '0' ):
  265.     DEDICATED    = '2'
  266.     BUILD        = 'release'
  267.     SETUP        = '1'
  268.     TARGET_GAME = '1'
  269.     TARGET_CORE = '1'
  270.     TARGET_GAMEPAK = '1'
  271.  
  272. if ( SETUP != '0' ):
  273.     if ( SETUP_TAGGED != '0' ):
  274.         SETUP_DEDICATED = '0'
  275.         SETUP_DEMO = '0'
  276.         SETUP_FULL = '0'
  277.         Q4TEST = '1'
  278.     else:
  279.         Q4TEST = '0'
  280.  
  281. if ( g_sdk or SDK != '0' ):
  282.     TARGET_CORE = '0'
  283.     TARGET_GAME = '1'
  284.     TARGET_MONO = '0'
  285.     TARGET_DEMO = '0'
  286.  
  287. # end configuration rules ----------------------
  288.  
  289. # general configuration, target selection --------
  290.  
  291. g_build = BUILD_ROOT + '/' + BUILD
  292.  
  293. SConsignFile( 'scons.signatures' )
  294.  
  295. if ( GL_HARDLINK != '0' ):
  296.     g_build += '-hardlink'
  297.  
  298. if ( DEBUG_MEMORY != '0' ):
  299.     g_build += '-debugmem'
  300.     
  301. if ( LIBC_MALLOC != '1' ):
  302.     g_build += '-nolibcmalloc'
  303.  
  304. if ( Q4TEST != '0' ):
  305.     g_build += '-q4test'
  306.  
  307. SetOption('num_jobs', JOBS)
  308.  
  309. LINK = CXX
  310.  
  311. # common flags
  312. # BASE + CORE + OPT for engine
  313. # BASE + GAME + OPT for game
  314. # _noopt versions of the environements are built without the OPT
  315.  
  316. BASECPPFLAGS = [ ]
  317. CORECPPPATH = [ ]
  318. CORELIBPATH = [ ]
  319. CORECPPFLAGS = [ ]
  320. GAMECPPFLAGS = [ ]
  321. BASELINKFLAGS = [ ]
  322. CORELINKFLAGS = [ ]
  323.  
  324. # for release build, further optimisations that may not work on all files
  325. OPTCPPFLAGS = [ ]
  326.  
  327. BASECPPFLAGS.append( '-pipe' )
  328. # warn all
  329. BASECPPFLAGS.append( '-Wall' )
  330. # don't wrap gcc messages
  331. BASECPPFLAGS.append( '-fmessage-length=0' )
  332.  
  333. if ( g_sdk or SDK != '0' ):
  334.     BASECPPFLAGS.append( '-DQ4SDK' )
  335.  
  336. if ( Q4TEST == '1' ):
  337.     # _MPBETA implie ID_TAGGED_BUILD but also disables some single player functionality
  338.     #BASECPPFLAGS.append( '-D_MPBETA' )
  339.     BASECPPFLAGS.append( '-DID_TAGGED_BUILD' )
  340.  
  341. if ( OS == 'Darwin' ):
  342.     # a few more common defines
  343.     BASECPPFLAGS += [ '-Wno-long-double', '-arch', 'ppc', '-fasm-blocks', '-fpascal-strings', '-faltivec', '-mcpu=G5', '-mtune=G5' ]
  344.     BASECPPFLAGS += [ '-DMACOS_X' ]
  345.     BASECPPFLAGS += [ '-Wno-unknown-pragmas' ]
  346.  
  347. if ( BUILD == 'debug-all' ):
  348.     BASECPPFLAGS.append( '-g' )
  349.     BASECPPFLAGS.append( '-D_DEBUG' )
  350.     if ( ID_MCHECK == '0' ):
  351.         ID_MCHECK = '1'
  352. elif ( BUILD == 'debug' ):
  353.     BASECPPFLAGS.append( '-g' )
  354.     BASECPPFLAGS.append( '-O1' )
  355.     BASECPPFLAGS.append( '-D_DEBUG' )
  356.     if ( ID_MCHECK == '0' ):
  357.         ID_MCHECK = '1'
  358. elif ( BUILD == 'release' ):
  359.     BASECPPFLAGS.append( '-D_FINAL' )
  360.     if ( OS == 'Linux' ):
  361.         # -fomit-frame-pointer: gcc manual indicates -O sets this implicitely,
  362.         # only if that doesn't affect debugging
  363.         # on Linux, this affects backtrace capability, so I'm assuming this is needed
  364.         # -finline-functions: implicit at -O3
  365.         # -fschedule-insns2: implicit at -O3
  366.         # -funroll-loops ?
  367.         # -mfpmath=sse -msse ?
  368.         # -march=pentium3 ? ( -march=i686 == pentiumpro )
  369.         OPTCPPFLAGS = [ '-O3', '-march=i686', '-Winline', '-ffast-math', '-fomit-frame-pointer', '-finline-functions', '-fschedule-insns2' ]
  370.         if ( ID_MCHECK == '0' ):
  371.             ID_MCHECK = '2'
  372.     elif ( OS == 'Darwin' ):
  373.         OPTCPPFLAGS = [ '-O3', '-falign-functions=16', '-falign-loops=16', '-finline' ]
  374. else:
  375.     print 'Unknown build configuration ' + BUILD
  376.     sys.exit(0)
  377.  
  378. if ( GL_HARDLINK != '0' ):
  379.     CORECPPFLAGS.append( '-DID_GL_HARDLINK' )
  380.  
  381. if ( DEBUG_MEMORY != '0' ):
  382.     BASECPPFLAGS += [ '-DID_DEBUG_MEMORY', '-DID_REDIRECT_NEWDELETE' ]
  383.     
  384. if ( LIBC_MALLOC != '1' ):
  385.     BASECPPFLAGS.append( '-DUSE_LIBC_MALLOC=0' )
  386.  
  387. if ( len( IDNET_HOST ) ):
  388.     CORECPPFLAGS.append( '-DIDNET_HOST=\\"%s\\"' % IDNET_HOST )
  389.  
  390. if ( ID_NOLANADDRESS != '0' ):
  391.     CORECPPFLAGS.append( '-DID_NOLANADDRESS' )
  392.     
  393. if ( ID_MCHECK == '1' ):
  394.     BASECPPFLAGS.append( '-DID_MCHECK' )
  395.  
  396. CORECPPFLAGS.append( '-DID_PATCHLEVEL=\\".%s\\"' % PATCHLEVEL )
  397.  
  398. # create the build environements
  399.  
  400. if ( FIX_INCLUDES == '1' ):
  401.     CC = './sys/scons/fixincludes.py \'' + CC + '\''
  402.     CXX = './sys/scons/fixincludes.py \'' + CXX + '\''
  403.  
  404. if ( FIX_SUPER == '1' ):
  405.     CC = './sys/scons/fixsuper.py \'' + CC + '\''
  406.     CXX = './sys/scons/fixsuper.py \'' + CXX + '\''
  407.  
  408. # NOTE: you need a patched scons to support building of ObjC and ObjC++ files
  409. g_base_env = Environment( ENV = os.environ, CC = CC, CXX = CXX, LINK = LINK, CPPFLAGS = BASECPPFLAGS, LINKFLAGS = BASELINKFLAGS, CPPPATH = CORECPPPATH, LIBPATH = CORELIBPATH, OS = OS )
  410. scons_utils.SetupUtils( g_base_env )
  411. if ( OS == 'Darwin' ):
  412.     g_base_env.Append( CXXFLAGS = [ '-Wno-invalid-offsetof' ] )
  413.  
  414. g_env = g_base_env.Copy()
  415.  
  416. g_env['CPPFLAGS'] += OPTCPPFLAGS
  417. g_env['CPPFLAGS'] += CORECPPFLAGS
  418. g_env['LINKFLAGS'] += CORELINKFLAGS
  419.  
  420. if ( BUILD != 'release' ):
  421.     g_env_noopt = g_env.Copy()
  422. else:
  423.     g_env_noopt = g_base_env.Copy()
  424.     g_env_noopt['CPPFLAGS'] += CORECPPFLAGS
  425.     g_env_noopt.Append( CPPFLAGS = '-O1' )
  426.     g_env_noopt['LINKFLAGS'] += CORELINKFLAGS
  427.  
  428. g_game_env = g_base_env.Copy()
  429. g_game_env['CPPFLAGS'] += OPTCPPFLAGS
  430. g_game_env['CPPFLAGS'] += GAMECPPFLAGS
  431.  
  432. # maintain this dangerous optimization off at all times
  433. g_env.Append( CPPFLAGS = '-fno-strict-aliasing' )
  434. g_env_noopt.Append( CPPFLAGS = '-fno-strict-aliasing' )
  435. g_game_env.Append( CPPFLAGS = '-fno-strict-aliasing' )
  436.  
  437. if ( int(JOBS) > 1 ):
  438.     print 'Using buffered process output'
  439.     scons_utils.SetupBufferedOutput( g_env )
  440.     scons_utils.SetupBufferedOutput( g_game_env )
  441.  
  442. # mark the globals
  443.  
  444. local_dedicated = 0
  445. # 0 for monolithic build
  446. local_gamedll = 1
  447. # carry around rather than using .a, avoids binutils bugs
  448. idlib_objects = []
  449. game_objects = []
  450. local_demo = 0
  451. # curl usage. there is a global toggle flag
  452. local_curl = 0
  453. curl_lib = []
  454. # if idlib should produce PIC objects ( depending on core or game inclusion )
  455. local_idlibpic = 0
  456. eventdefs = None
  457.  
  458. GLOBALS = 'g_env g_env_noopt g_game_env OS ID_MCHECK idlib_objects game_objects local_dedicated local_gamedll local_demo local_idlibpic curl_lib local_curl eventdefs GL_HARDLINK NOCURL Q4TEST'
  459.  
  460. # end general configuration ----------------------
  461.  
  462. # targets ----------------------------------------
  463.  
  464. Export( 'GLOBALS ' + GLOBALS )
  465.  
  466. quake4    = None
  467. q4ded    = None
  468. game    = None
  469. q4_mon    = None
  470.  
  471. Default( None )
  472.  
  473. # build curl if needed
  474. if ( NOCURL == '0' and ( TARGET_CORE == '1' or TARGET_MONO == '1' ) ):
  475.     # 1: debug, 2: release
  476.     if ( BUILD == 'release' ):
  477.         local_curl = 2
  478.     else:
  479.         local_curl = 1
  480.     Export( 'GLOBALS ' + GLOBALS )
  481.     curl_lib = SConscript( 'sys/scons/SConscript.curl' )
  482.  
  483. if ( TARGET_CORE == '1' ):
  484.     local_gamedll = 1
  485.     local_demo = 0
  486.     local_idlibpic = 0
  487.     if ( DEDICATED == '0' or DEDICATED == '2' ):
  488.         local_dedicated = 0
  489.         Export( 'GLOBALS ' + GLOBALS )
  490.         
  491.         BuildDir( g_build + '/core/glimp', '.', duplicate = 1 )
  492.         SConscript( g_build + '/core/glimp/sys/scons/SConscript.gl' )
  493.         BuildDir( g_build + '/core', '.', duplicate = 0 )
  494.         idlib_objects = SConscript( g_build + '/core/sys/scons/SConscript.idlib' )
  495.         Export( 'GLOBALS ' + GLOBALS ) # update idlib_objects
  496.         quake4 = SConscript( g_build + '/core/sys/scons/SConscript.core' )
  497.  
  498.         if ( OS == 'Linux' ):
  499.             Default( InstallAs( '#quake4.%s' % cpu, quake4 ) )
  500.         
  501.     if ( DEDICATED == '1' or DEDICATED == '2' ):
  502.         local_dedicated = 1
  503.         Export( 'GLOBALS ' + GLOBALS )
  504.         
  505.         BuildDir( g_build + '/dedicated/glimp', '.', duplicate = 1 )
  506.         SConscript( g_build + '/dedicated/glimp/sys/scons/SConscript.gl' )
  507.         BuildDir( g_build + '/dedicated', '.', duplicate = 0 )
  508.         idlib_objects = SConscript( g_build + '/dedicated/sys/scons/SConscript.idlib' )
  509.         Export( 'GLOBALS ' + GLOBALS )
  510.         q4ded = SConscript( g_build + '/dedicated/sys/scons/SConscript.core' )
  511.  
  512.         if ( OS == 'Linux' ):
  513.             Default( InstallAs( '#q4ded.%s' % cpu, q4ded ) )
  514.  
  515. if ( TARGET_GAME == '1' ):
  516.     local_gamedll = 1
  517.     local_demo = 0
  518.     local_dedicated = 0
  519.     local_idlibpic = 1
  520.     Export( 'GLOBALS ' + GLOBALS )
  521.     dupe = 0
  522.     if ( SDK == '1' ):
  523.         # building an SDK, use scons for dependencies walking
  524.         # clear the build directory to be safe
  525.         g_env.PreBuildSDK( g_build + '/game', PATCHLEVEL )
  526.         dupe = 1
  527.     BuildDir( g_build + '/game', '.', duplicate = dupe )
  528.     idlib_objects = SConscript( g_build + '/game/sys/scons/SConscript.idlib' )
  529.     Export( 'GLOBALS ' + GLOBALS )
  530.     game = SConscript( g_build + '/game/sys/scons/SConscript.game' )
  531.  
  532.     Default( InstallAs( '#game%s.so' % cpu, game ) )
  533.     
  534. if ( TARGET_MONO == '1' ):
  535.     # the game in a single piece
  536.     local_gamedll = 0
  537.     local_dedicated = 0
  538.     local_demo = 0
  539.     local_idlibpic = 0
  540.     if ( DEDICATED == '0' or DEDICATED == '2' ):
  541.         Export( 'GLOBALS ' + GLOBALS )
  542.         BuildDir( g_build + '/mono/glimp', '.', duplicate = 1 )
  543.         SConscript( g_build + '/mono/glimp/sys/scons/SConscript.gl' )
  544.         BuildDir( g_build + '/mono', '.', duplicate = 0 )
  545.         idlib_objects = SConscript( g_build + '/mono/sys/scons/SConscript.idlib' )
  546.         game_objects = SConscript( g_build + '/mono/sys/scons/SConscript.game' )
  547.         Export( 'GLOBALS ' + GLOBALS )
  548.         q4_mono = SConscript( g_build + '/mono/sys/scons/SConscript.core' )
  549.  
  550.         if ( OS == 'Linux' ):
  551.             Default( InstallAs( '#q4mono.%s' % cpu, q4_mono ) )
  552.     
  553.     if ( DEDICATED == '1' or DEDICATED == '2' ):
  554.         local_dedicated = 1
  555.         Export( 'GLOBALS ' + GLOBALS )
  556.         BuildDir( g_build + '/monoded/glimp', '.', duplicate = 1 )
  557.         SConscript( g_build + '/monoded/glimp/sys/scons/SConscript.gl' )
  558.         BuildDir( g_build + '/monoded', '.', duplicate = 0 )
  559.         idlib_objects = SConscript( g_build + '/monoded/sys/scons/SConscript.idlib' )
  560.         game_objects = SConscript( g_build + '/monoded/sys/scons/SConscript.game' )
  561.         Export( 'GLOBALS ' + GLOBALS )
  562.         q4_monoded = SConscript( g_build + '/monoded/sys/scons/SConscript.core' )
  563.  
  564.         if ( OS == 'Linux' ):
  565.             Default( InstallAs( '#q4monoded.%s' % cpu, q4_monoded ) )
  566.  
  567. if ( OS == 'Darwin' ):
  568.     src = []
  569.     if ( TARGET_CORE == '1' ):
  570.         if ( DEDICATED == '0' or DEDICATED == '2' ):
  571.             src.append( quake4 )
  572.         if ( DEDICATED == '1' or DEDICATED == '2' ):
  573.             src.append( q4ded )
  574.     if ( TARGET_MONO == '1' ):
  575.         if ( DEDICATED == '0' or DEDICATED == '2' ):
  576.             src.append( q4_mono )
  577.         if ( DEDICATED == '1' or DEDICATED == '2' ):
  578.             src.append( q4_monoded )
  579.     if ( len( src ) ):
  580.         q4mac = Command( 'q4mac', src, Action( g_env.BuildBundle ) )
  581.         Default( q4mac )    
  582.  
  583. if ( SETUP == '1' ):
  584.     brandelf = Program( 'brandelf', 'sys/linux/setup/brandelf.c' )
  585.     setup_source = [ brandelf, quake4, q4ded, game ]
  586.     do_gamepak = ( TARGET_GAMEPAK != '0' )
  587.     setups = []
  588.     if ( SETUP_TAGGED == '1' ):
  589.         g_env_tagged = g_env.Copy()
  590.         g_env_tagged.Prepare( do_gamepak, ASSETS, PATCHLEVEL )
  591.         setup_tagged = Command( 'setup_tagged', setup_source, Action( g_env_tagged.BuildSetup ) )
  592.         Default( setup_tagged )
  593.         setups.append( setup_tagged )
  594.     if ( SETUP_DEMO == '1' ):
  595.         g_env_demo = g_env.Copy()
  596.         g_env_demo.Prepare( do_gamepak, ASSETS, PATCHLEVEL )
  597.         setup_demo = Command( 'setup_demo', setup_source, Action( g_env_demo.BuildSetup ) )
  598.         Default( setup_demo )
  599.         setups.append( setup_demo )
  600.     if ( SETUP_DEDICATED == '1' ):
  601.         g_env_ded = g_env.Copy()
  602.         g_env_ded.Prepare( do_gamepak, ASSETS, PATCHLEVEL )
  603.         setup_ded = Command( 'setup_ded', setup_source, Action( g_env_ded.BuildSetup ) )
  604.         Default( setup_ded )
  605.         setups.append( setup_ded )
  606.     if ( SETUP_FULL == '1' ):
  607.         g_env_full = g_env.Copy()
  608.         g_env_full.Prepare( do_gamepak, ASSETS, PATCHLEVEL )
  609.         setup_full = Command( 'setup_full', setup_source, Action( g_env_full.BuildSetup ) )
  610.         Default( setup_full )
  611.         setups.append( setup_full )
  612.     # setup dependencies so they are built sequentially
  613.     i = 1
  614.     while ( i < len( setups ) ):
  615.         Depends( setups[ i ], setups[ i - 1 ] )
  616.         i += 1
  617. else:
  618.     if ( TARGET_GAMEPAK == '1' ):
  619.         game_pak = Command( 'gamepak', game, Action( g_env.BuildGamePak ) )
  620.         Default( game_pak )
  621.  
  622. if ( SDK != '0' ):
  623.     setup_sdk = Command( 'sdk', [ ], Action( g_env.BuildSDK ) )
  624.     Default( setup_sdk )
  625.     g_env.Depends( setup_sdk, game ) 
  626.     
  627. # end targets ------------------------------------
  628.