Conscript (2289B)
1 # Q3 ui building 2 3 # qvm building against native: 4 # only native has ui_syscalls.c 5 # qvm uses a 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:#q3_ui', 14 CC => $CC, 15 CXX => $CXX, 16 LINK => $LINK, 17 ENV => { PATH => $ENV{PATH}, HOME => $ENV{HOME} }, 18 CFLAGS => $BASE_CFLAGS . '-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:#q3_ui', 28 CC => 'q3lcc', 29 CCCOM => '%CC %CFLAGS %_IFLAGS -c %< -o %>', 30 SUFOBJ => '.asm', 31 LINK => 'q3asm', 32 CFLAGS => '-DQ3_VM -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 ../game/bg_misc.c 41 ../game/q_math.c 42 ../game/q_shared.c 43 ui_addbots.c 44 ui_atoms.c 45 ui_cdkey.c 46 ui_cinematics.c 47 ui_confirm.c 48 ui_connect.c 49 ui_controls2.c 50 ui_credits.c 51 ui_demo2.c 52 ui_display.c 53 ui_gameinfo.c 54 ui_ingame.c 55 ui_menu.c 56 ui_mfield.c 57 ui_mods.c 58 ui_network.c 59 ui_options.c 60 ui_playermodel.c 61 ui_players.c 62 ui_playersettings.c 63 ui_preferences.c 64 ui_qmenu.c 65 ui_removebots.c 66 ui_serverinfo.c 67 ui_servers2.c 68 ui_setup.c 69 ui_sound.c 70 ui_sparena.c 71 ui_specifyserver.c 72 ui_splevel.c 73 ui_sppostgame.c 74 ui_spskill.c 75 ui_startserver.c 76 ui_team.c 77 ui_teamorders.c 78 ui_video.c 79 ); 80 $FILESREF = \@FILES; 81 82 if ($NO_SO eq 0) 83 { 84 Program $env 'uii386.so', @$FILESREF, '../ui/ui_syscalls.c'; 85 Install $env $INSTALL_DIR, 'uii386.so'; 86 } 87 if ($NO_VM eq 0) 88 { 89 Depends $vm_env 'ui.qvm', '#qvmtools/q3lcc'; 90 Depends $vm_env 'ui.qvm', '#qvmtools/q3asm'; 91 Program $vm_env 'ui.qvm', @$FILESREF, '../game/bg_lib.c', '../ui/ui_syscalls.asm'; 92 Install $vm_env $INSTALL_DIR . '/vm', 'ui.qvm'; 93 }