Makefile.Linux.i386 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #
  2. # Quake2 gamei386.so Makefile for Linux 2.0
  3. #
  4. # Jan '98 by Zoid <zoid@idsoftware.com>
  5. #
  6. # ELF only
  7. #
  8. # Probably requires GNU make
  9. #
  10. # This builds the gamei386.so for Linux based on the q2source_12_11.zip
  11. # release.
  12. # Put his Makefile in the game subdirectory you get when you unzip
  13. # q2source_12_11.zip.
  14. #
  15. # There are two compiler errors you'll get, the following fixes
  16. # are necessary:
  17. #
  18. # In g_local.h (around line 828), you must change the
  19. # typedef struct g_client_s { ... } gclient_t;
  20. # to just:
  21. # struct g_client_s { ... };
  22. # The typedef is already defined elsewhere (seems to compile fine under
  23. # MSCV++ for Win32 for some reason).
  24. #
  25. # m_player.h has a Ctrl-Z at the end (damn DOS editors). Remove it or
  26. # gcc complains.
  27. #
  28. # Note that the source in q2source_12_11.zip is for version 3.05. To
  29. # get it to run with Linux 3.10, change the following in game.h:
  30. # #define GAME_API_VERSION 1
  31. # change it to:
  32. # #define GAME_API_VERSION 2
  33. ARCH=i386
  34. CC=gcc
  35. BASE_CFLAGS=-Dstricmp=strcasecmp
  36. #use these cflags to optimize it
  37. CFLAGS=$(BASE_CFLAGS) -m486 -O6 -ffast-math -funroll-loops \
  38. -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
  39. -malign-jumps=2 -malign-functions=2
  40. #use these when debugging
  41. #CFLAGS=$(BASE_CFLAGS) -g
  42. OBJDIR=linux
  43. LDFLAGS=-ldl -lm
  44. SHLIBEXT=so
  45. SHLIBCFLAGS=-fPIC
  46. SHLIBLDFLAGS=-shared
  47. DO_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
  48. #############################################################################
  49. # SETUP AND BUILD
  50. # GAME
  51. #############################################################################
  52. GAME_OBJS = \
  53. $(OBJDIR)/g_ai.o $(OBJDIR)/p_client.o $(OBJDIR)/g_svcmds.o $(OBJDIR)/g_cmds.o \
  54. $(OBJDIR)/g_combat.o $(OBJDIR)/g_func.o $(OBJDIR)/g_items.o \
  55. $(OBJDIR)/g_main.o $(OBJDIR)/g_misc.o $(OBJDIR)/g_monster.o $(OBJDIR)/g_phys.o \
  56. $(OBJDIR)/g_save.o $(OBJDIR)/g_spawn.o \
  57. $(OBJDIR)/g_target.o $(OBJDIR)/g_trigger.o $(OBJDIR)/g_utils.o $(OBJDIR)/g_weapon.o \
  58. $(OBJDIR)/m_move.o \
  59. $(OBJDIR)/p_hud.o $(OBJDIR)/p_trail.o $(OBJDIR)/p_view.o $(OBJDIR)/p_weapon.o \
  60. $(OBJDIR)/q_shared.o $(OBJDIR)/g_ctf.o $(OBJDIR)/p_menu.o $(OBJDIR)/g_chase.o
  61. game$(ARCH).$(SHLIBEXT) : $(GAME_OBJS)
  62. $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS)
  63. $(OBJDIR)/g_ai.o : g_ai.c
  64. $(DO_CC)
  65. $(OBJDIR)/p_client.o : p_client.c
  66. $(DO_CC)
  67. $(OBJDIR)/g_svcmds.o : g_svcmds.c
  68. $(DO_CC)
  69. $(OBJDIR)/g_cmds.o : g_cmds.c
  70. $(DO_CC)
  71. $(OBJDIR)/g_combat.o : g_combat.c
  72. $(DO_CC)
  73. $(OBJDIR)/g_func.o : g_func.c
  74. $(DO_CC)
  75. $(OBJDIR)/g_items.o : g_items.c
  76. $(DO_CC)
  77. $(OBJDIR)/g_main.o : g_main.c
  78. $(DO_CC)
  79. $(OBJDIR)/g_misc.o : g_misc.c
  80. $(DO_CC)
  81. $(OBJDIR)/g_monster.o : g_monster.c
  82. $(DO_CC)
  83. $(OBJDIR)/g_phys.o : g_phys.c
  84. $(DO_CC)
  85. $(OBJDIR)/g_save.o : g_save.c
  86. $(DO_CC)
  87. $(OBJDIR)/g_spawn.o : g_spawn.c
  88. $(DO_CC)
  89. $(OBJDIR)/g_target.o : g_target.c
  90. $(DO_CC)
  91. $(OBJDIR)/g_trigger.o : g_trigger.c
  92. $(DO_CC)
  93. $(OBJDIR)/g_utils.o : g_utils.c
  94. $(DO_CC)
  95. $(OBJDIR)/g_weapon.o : g_weapon.c
  96. $(DO_CC)
  97. $(OBJDIR)/m_move.o : m_move.c
  98. $(DO_CC)
  99. $(OBJDIR)/p_hud.o : p_hud.c
  100. $(DO_CC)
  101. $(OBJDIR)/p_trail.o : p_trail.c
  102. $(DO_CC)
  103. $(OBJDIR)/p_view.o : p_view.c
  104. $(DO_CC)
  105. $(OBJDIR)/p_weapon.o : p_weapon.c
  106. $(DO_CC)
  107. $(OBJDIR)/q_shared.o : q_shared.c
  108. $(DO_CC)
  109. $(OBJDIR)/g_ctf.o : g_ctf.c
  110. $(DO_CC)
  111. $(OBJDIR)/p_menu.o : p_menu.c
  112. $(DO_CC)
  113. $(OBJDIR)/g_chase.o : g_chase.c
  114. $(DO_CC)
  115. #############################################################################
  116. # MISC
  117. #############################################################################
  118. clean:
  119. -rm -f $(GAME_OBJS)
  120. depend:
  121. gcc -MM $(GAME_OBJS:.o=.c)