Conscript 1.8 KB

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