Makefile.Linux.i386 (3697B)
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 34 ARCH=i386 35 CC=gcc 36 BASE_CFLAGS=-Dstricmp=strcasecmp 37 38 #use these cflags to optimize it 39 CFLAGS=$(BASE_CFLAGS) -m486 -O6 -ffast-math -funroll-loops \ 40 -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \ 41 -malign-jumps=2 -malign-functions=2 42 #use these when debugging 43 #CFLAGS=$(BASE_CFLAGS) -g 44 45 OBJDIR=linux 46 47 LDFLAGS=-ldl -lm 48 SHLIBEXT=so 49 SHLIBCFLAGS=-fPIC 50 SHLIBLDFLAGS=-shared 51 52 DO_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $< 53 54 ############################################################################# 55 # SETUP AND BUILD 56 # GAME 57 ############################################################################# 58 59 GAME_OBJS = \ 60 $(OBJDIR)/g_ai.o $(OBJDIR)/p_client.o $(OBJDIR)/g_svcmds.o $(OBJDIR)/g_cmds.o \ 61 $(OBJDIR)/g_combat.o $(OBJDIR)/g_func.o $(OBJDIR)/g_items.o \ 62 $(OBJDIR)/g_main.o $(OBJDIR)/g_misc.o $(OBJDIR)/g_monster.o $(OBJDIR)/g_phys.o \ 63 $(OBJDIR)/g_save.o $(OBJDIR)/g_spawn.o \ 64 $(OBJDIR)/g_target.o $(OBJDIR)/g_trigger.o $(OBJDIR)/g_utils.o $(OBJDIR)/g_weapon.o \ 65 $(OBJDIR)/m_move.o \ 66 $(OBJDIR)/p_hud.o $(OBJDIR)/p_trail.o $(OBJDIR)/p_view.o $(OBJDIR)/p_weapon.o \ 67 $(OBJDIR)/q_shared.o $(OBJDIR)/g_ctf.o $(OBJDIR)/p_menu.o $(OBJDIR)/g_chase.o 68 69 game$(ARCH).$(SHLIBEXT) : $(GAME_OBJS) 70 $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS) 71 72 $(OBJDIR)/g_ai.o : g_ai.c 73 $(DO_CC) 74 75 $(OBJDIR)/p_client.o : p_client.c 76 $(DO_CC) 77 78 $(OBJDIR)/g_svcmds.o : g_svcmds.c 79 $(DO_CC) 80 81 $(OBJDIR)/g_cmds.o : g_cmds.c 82 $(DO_CC) 83 84 $(OBJDIR)/g_combat.o : g_combat.c 85 $(DO_CC) 86 87 $(OBJDIR)/g_func.o : g_func.c 88 $(DO_CC) 89 90 $(OBJDIR)/g_items.o : g_items.c 91 $(DO_CC) 92 93 $(OBJDIR)/g_main.o : g_main.c 94 $(DO_CC) 95 96 $(OBJDIR)/g_misc.o : g_misc.c 97 $(DO_CC) 98 99 $(OBJDIR)/g_monster.o : g_monster.c 100 $(DO_CC) 101 102 $(OBJDIR)/g_phys.o : g_phys.c 103 $(DO_CC) 104 105 $(OBJDIR)/g_save.o : g_save.c 106 $(DO_CC) 107 108 $(OBJDIR)/g_spawn.o : g_spawn.c 109 $(DO_CC) 110 111 $(OBJDIR)/g_target.o : g_target.c 112 $(DO_CC) 113 114 $(OBJDIR)/g_trigger.o : g_trigger.c 115 $(DO_CC) 116 117 $(OBJDIR)/g_utils.o : g_utils.c 118 $(DO_CC) 119 120 $(OBJDIR)/g_weapon.o : g_weapon.c 121 $(DO_CC) 122 123 $(OBJDIR)/m_move.o : m_move.c 124 $(DO_CC) 125 126 $(OBJDIR)/p_hud.o : p_hud.c 127 $(DO_CC) 128 129 $(OBJDIR)/p_trail.o : p_trail.c 130 $(DO_CC) 131 132 $(OBJDIR)/p_view.o : p_view.c 133 $(DO_CC) 134 135 $(OBJDIR)/p_weapon.o : p_weapon.c 136 $(DO_CC) 137 138 $(OBJDIR)/q_shared.o : q_shared.c 139 $(DO_CC) 140 141 $(OBJDIR)/g_ctf.o : g_ctf.c 142 $(DO_CC) 143 144 $(OBJDIR)/p_menu.o : p_menu.c 145 $(DO_CC) 146 147 $(OBJDIR)/g_chase.o : g_chase.c 148 $(DO_CC) 149 150 ############################################################################# 151 # MISC 152 ############################################################################# 153 154 clean: 155 -rm -f $(GAME_OBJS) 156 157 depend: 158 gcc -MM $(GAME_OBJS:.o=.c) 159