Quake-III-Arena

Quake III Arena GPL Source Release
Log | Files | Refs

Conscript (3471B)


      1 # game building
      2 # builds the game for vanilla Q3 and TA
      3 
      4 # there are slight differences between Q3 and TA build:
      5 #   -DMISSIONPACK
      6 # the config is passed in the imported variable TARGET_DIR
      7 
      8 # qvm building against native:
      9 # only native has g_syscalls.c
     10 # only qvm has ../game/bg_lib.c
     11 # qvm uses a custom g_syscalls.asm with equ stubs
     12 
     13 Import qw( BASE_CFLAGS TARGET_DIR INSTALL_DIR NO_VM NO_SO CC CXX LINK );
     14 
     15 $env = new cons(
     16   # the code has the very bad habit of doing things like #include "../ui/ui_shared.h"
     17   # this seems to confuse the dependency analysis, explicit toplevel includes seem to fix
     18   CPPPATH => '#cgame:#game:#q3_ui',
     19   CC => $CC,
     20   CXX => $CXX,
     21   LINK => $LINK,
     22 	ENV => { PATH => $ENV{PATH}, HOME => $ENV{HOME} },
     23   CFLAGS => $BASE_CFLAGS . '-fPIC',
     24   LDFLAGS => '-shared -ldl -lm'
     25 );
     26 
     27 # for TA, use -DMISSIONPACK
     28 %ta_env_hash = $env->copy(
     29   CPPPATH => '#cgame:#game:#ui'
     30   );
     31 $ta_env_hash{CFLAGS} = '-DMISSIONPACK ' . $ta_env_hash{CFLAGS};
     32 $ta_env = new cons(%ta_env_hash);
     33 
     34 # qvm building
     35 # we heavily customize the cons environment
     36 $vm_env = new cons(
     37   # the code has the very bad habit of doing things like #include "../ui/ui_shared.h"
     38   # this seems to confuse the dependency analysis, explicit toplevel includes seem to fix
     39   CPPPATH => '#cgame:#game:#q3_ui',
     40   CC => 'q3lcc',
     41   CCCOM => '%CC %CFLAGS %_IFLAGS -c %< -o %>',
     42   SUFOBJ => '.asm',
     43   LINK => 'q3asm',
     44   CFLAGS => '-DQ3_VM -S -Wf-target=bytecode -Wf-g',
     45   # need to know where to find the compiler tools
     46   ENV => { PATH => $ENV{PATH} . ":./qvmtools", },
     47 );
     48 
     49 # TA qvm building
     50 %vm_ta_env_hash = $vm_env->copy(
     51   CPPPATH => '#cgame:#game:#ui'
     52   );
     53 $vm_ta_env_hash{CFLAGS} = '-DMISSIONPACK ' . $vm_ta_env_hash{CFLAGS};
     54 $vm_ta_env = new cons(%vm_ta_env_hash);
     55 
     56 # the file with vmMain function MUST be the first one of the list
     57 @FILES = qw(
     58   g_main.c
     59   ai_chat.c
     60   ai_cmd.c
     61   ai_dmnet.c
     62   ai_dmq3.c
     63   ai_main.c
     64   ai_team.c
     65   ai_vcmd.c
     66   bg_misc.c
     67   bg_pmove.c
     68   bg_slidemove.c
     69   g_active.c
     70   g_arenas.c
     71   g_bot.c
     72   g_client.c
     73   g_cmds.c
     74   g_combat.c
     75   g_items.c
     76   g_mem.c
     77   g_misc.c
     78   g_missile.c
     79   g_mover.c
     80   g_session.c
     81   g_spawn.c
     82   g_svcmds.c
     83   g_target.c
     84   g_team.c
     85   g_trigger.c
     86   g_utils.c
     87   g_weapon.c
     88   q_math.c
     89   q_shared.c
     90   );
     91 $FILESREF = \@FILES;
     92 
     93 # only in .so
     94 # (VM uses a custom .asm with equ stubs)
     95 @SO_FILES = qw(
     96   g_syscalls.c
     97   );
     98 $SO_FILESREF = \@SO_FILES;
     99   
    100 # only for VM
    101 @VM_FILES = qw(
    102   bg_lib.c
    103   g_syscalls.asm
    104   );
    105 $VM_FILESREF = \@VM_FILES;  
    106 
    107 # FIXME CPU string?
    108 # NOTE: $env $ta_env and $vm_env $vm_ta_env may not be necessary
    109 #   we could alter the $env and $ta_env based on $TARGET_DIR
    110 #   doing it this way to ensure homogeneity with cgame building
    111 if ($TARGET_DIR eq 'Q3')
    112 {
    113 	if ($NO_SO eq 0)
    114 	{
    115 		Program $env 'qagamei386.so', @$FILESREF, @$SO_FILESREF;
    116 		Install $env $INSTALL_DIR, 'qagamei386.so';
    117 	}
    118 	if ($NO_VM eq 0)
    119 	{
    120     Depends $vm_env 'qagame.qvm', '#qvmtools/q3lcc';
    121     Depends $vm_env 'qagame.qvm', '#qvmtools/q3asm';
    122 		Program $vm_env 'qagame.qvm', @$FILESREF, @$VM_FILESREF;
    123 		Install $vm_env $INSTALL_DIR . '/vm', 'qagame.qvm';
    124 	}
    125 }
    126 else
    127 {
    128 	if ($NO_SO eq 0)
    129 	{
    130 		Program $ta_env 'qagamei386.so', @$FILESREF, @$SO_FILESREF;
    131 		Install $ta_env $INSTALL_DIR, 'qagamei386.so';
    132 	}
    133 	if ($NO_VM eq 0)
    134 	{
    135     Depends $vm_env 'qagame.qvm', '#qvmtools/q3lcc';
    136     Depends $vm_env 'qagame.qvm', '#qvmtools/q3asm';
    137 		Program $vm_ta_env 'qagame.qvm', @$FILESREF, @$VM_FILESREF;    
    138 		Install $vm_ta_env $INSTALL_DIR . '/vm', 'qagame.qvm';
    139 	}
    140 }