Conscript (1815B)
1 # TA ui building 2 3 # qvm building against native: 4 # only native has ui_syscalls.c 5 # qvm uses a custom ui_syscalls.asm with equ stubs 6 # qvm has additional bg_lib.c 7 8 Import qw( BASE_CFLAGS TARGET_DIR INSTALL_DIR NO_VM NO_SO CC CXX LINK ); 9 10 $env = new cons( 11 # the code has the very bad habit of doing things like #include "../ui/ui_shared.h" 12 # this seems to confuse the dependency analysis, explicit toplevel includes seem to fix 13 CPPPATH => '#cgame:#game:#ui', 14 CC => $CC, 15 CXX => $CXX, 16 LINK => $LINK, 17 ENV => { PATH => $ENV{PATH}, HOME => $ENV{HOME} }, 18 CFLAGS => $BASE_CFLAGS . '-DMISSIONPACK -fPIC', 19 LDFLAGS => '-shared -ldl -lm' 20 ); 21 22 # qvm building 23 # we heavily customize the cons environment 24 $vm_env = new cons( 25 # the code has the very bad habit of doing things like #include "../ui/ui_shared.h" 26 # this seems to confuse the dependency analysis, explicit toplevel includes seem to fix 27 CPPPATH => '#cgame:#game:#ui', 28 CC => 'q3lcc', 29 CCCOM => '%CC %CFLAGS %_IFLAGS -c %< -o %>', 30 SUFOBJ => '.asm', 31 LINK => 'q3asm', 32 CFLAGS => '-DQ3_VM -DMISSIONPACK -S -Wf-target=bytecode -Wf-g', 33 # need to know where to find the compiler tools 34 ENV => { PATH => $ENV{PATH} . ":./qvmtools", }, 35 ); 36 37 # the file with vmMain function MUST be the first one of the list 38 @FILES = qw( 39 ui_main.c 40 ui_atoms.c 41 ui_gameinfo.c 42 ui_players.c 43 ui_util.c 44 ui_shared.c 45 ../game/bg_misc.c 46 ../game/q_math.c 47 ../game/q_shared.c 48 ); 49 $FILESREF = \@FILES; 50 51 if ($NO_SO eq 0) 52 { 53 Program $env 'uii386.so', @$FILESREF, 'ui_syscalls.c'; 54 Install $env $INSTALL_DIR, 'uii386.so'; 55 } 56 if ($NO_VM eq 0) 57 { 58 Depends $vm_env 'ui.qvm', '#qvmtools/q3lcc'; 59 Depends $vm_env 'ui.qvm', '#qvmtools/q3asm'; 60 Program $vm_env 'ui.qvm', @$FILESREF, '../game/bg_lib.c', 'ui_syscalls.asm'; 61 Install $vm_env $INSTALL_DIR . '/vm', 'ui.qvm'; 62 }