summaryrefslogtreecommitdiff
path: root/Makefile
blob: 9e8dffb8055b3cd1fc4ea9dd3c433b5d31b6836a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# --
# -- Makefile for building Q3A qvms on Linux
# -- 
# -- Copyleft under the GPL by Yumpee
# -- yumpee@freeshell.org
# -- http://freeshell.org/~yumpee
# -- with additions/modifications by Timbo
# -- tma@dcs.ed.ac.uk


# -- Default definitions, can be over-ridden by commandline options
CPP=/usr/games/quake3/tools/q3cpp
CPP_FLAGS=-DQ3_VM
INCLUDES=-Icgame -Igame -Iui

RCC=/usr/games/quake3/tools/q3rcc
RCC_FLAGS=-target=bytecode -g

Q3ASM=/usr/games/quake3/tools/q3asm
Q3ASM_FLAGS=

CC=gcc
CC_DEPEND_FLAGS=-MM

SED=sed

Q3ADIR=/usr/games/quake3
MOD=tremulous


# -- Object files of each QVM
VM_CGAME_OBJ=    cgame/vm/cg_main.asm		\
                 cgame/vm/cg_mem.asm	\
                 cgame/vm/cg_consolecmds.asm	\
                 cgame/vm/cg_draw.asm		\
                 cgame/vm/cg_drawtools.asm	\
                 cgame/vm/cg_effects.asm	\
                 cgame/vm/cg_ents.asm		\
                 cgame/vm/cg_event.asm		\
                 cgame/vm/cg_info.asm		\
                 cgame/vm/cg_localents.asm	\
	               cgame/vm/cg_marks.asm		\
                 cgame/vm/cg_players.asm	\
                 cgame/vm/cg_playerstate.asm	\
                 cgame/vm/cg_predict.asm	\
                 cgame/vm/cg_scoreboard.asm	\
                 cgame/vm/cg_servercmds.asm	\
                 cgame/vm/cg_snapshot.asm	\
                 cgame/vm/cg_view.asm		\
                 cgame/vm/cg_weapons.asm	\
                 cgame/vm/cg_creep.asm	\
                 cgame/vm/cg_lightmap.asm \
                 cgame/vm/cg_scanner.asm \
                 game/vm/bg_misc.asm		\
                 game/vm/bg_pmove.asm		\
                 game/vm/bg_slidemove.asm	\
                 game/vm/bg_lib.asm		\
                 game/vm/q_math.asm		\
                 game/vm/q_shared.asm


VM_GAME_OBJ=    game/vm/g_main.asm		\
                game/vm/bg_misc.asm		\
                game/vm/bg_lib.asm		\
                game/vm/bg_pmove.asm		\
                game/vm/bg_slidemove.asm	\
                game/vm/q_math.asm		\
                game/vm/q_shared.asm		\
                game/vm/g_active.asm		\
                game/vm/g_arenas.asm		\
                game/vm/g_client.asm		\
                game/vm/g_cmds.asm		\
                game/vm/g_combat.asm		\
                game/vm/g_items.asm		\
                game/vm/g_buildable.asm		\
                game/vm/g_creep.asm		\
                game/vm/g_mem.asm		\
                game/vm/g_misc.asm		\
                game/vm/g_missile.asm		\
                game/vm/g_mover.asm		\
                game/vm/g_session.asm		\
                game/vm/g_spawn.asm		\
                game/vm/g_svcmds.asm		\
                game/vm/g_target.asm		\
                game/vm/g_team.asm		\
                game/vm/g_trigger.asm		\
                game/vm/g_utils.asm		\
                game/vm/g_weapon.asm

VM_UI_OBJ=	ui/vm/ui_main.asm		\
            ui/vm/ui_mods.asm		\
            ui/vm/ui_gameinfo.asm		\
            ui/vm/ui_atoms.asm		\
            ui/vm/ui_cinematics.asm		\
            ui/vm/ui_connect.asm		\
            ui/vm/ui_controls2.asm		\
            ui/vm/ui_demo2.asm		\
            ui/vm/ui_mfield.asm		\
            ui/vm/ui_credits.asm		\
            ui/vm/ui_menu.asm		\
            ui/vm/ui_ingame.asm		\
            ui/vm/ui_confirm.asm		\
            ui/vm/ui_setup.asm		\
            ui/vm/ui_options.asm		\
            ui/vm/ui_display.asm		\
            ui/vm/ui_sound.asm		\
            ui/vm/ui_network.asm		\
            ui/vm/ui_playermodel.asm	\
            ui/vm/ui_players.asm		\
            ui/vm/ui_playersettings.asm	\
            ui/vm/ui_preferences.asm	\
            ui/vm/ui_qmenu.asm		\
            ui/vm/ui_serverinfo.asm		\
            ui/vm/ui_servers2.asm		\
            ui/vm/ui_sparena.asm		\
            ui/vm/ui_specifyserver.asm	\
            ui/vm/ui_sppostgame.asm		\
            ui/vm/ui_splevel.asm		\
            ui/vm/ui_spskill.asm		\
            ui/vm/ui_startserver.asm	\
            ui/vm/ui_team.asm		\
            ui/vm/ui_video.asm		\
            ui/vm/ui_addbots.asm		\
            ui/vm/ui_removebots.asm		\
            ui/vm/ui_teamorders.asm		\
            ui/vm/ui_dynamicmenu.asm		\
            ui/vm/ui_loadconfig.asm		\
            ui/vm/ui_saveconfig.asm		\
            ui/vm/ui_cdkey.asm		\
            game/vm/bg_misc.asm		\
            game/vm/bg_lib.asm		\
            game/vm/q_math.asm		\
            game/vm/q_shared.asm


# -- Makefile's main targets
all: cgame game ui

install: cgame game ui
	-mkdir -p $(Q3ADIR)/$(MOD)/vm
	-cp cgame/vm/cgame.qvm $(Q3ADIR)/$(MOD)/vm 
	-cp game/vm/qagame.qvm $(Q3ADIR)/$(MOD)/vm 
	-cp ui/vm/ui.qvm $(Q3ADIR)/$(MOD)/vm 

cgame: cgame/vm/cgame.qvm

game: game/vm/qagame.qvm

ui: ui/vm/ui.qvm


# -- Rules for compiling each QVM
cgame/vm/cgame.qvm: $(VM_CGAME_OBJ)
	 $(Q3ASM) $(Q3ASM_FLAGS) $^ cgame/cg_syscalls.asm
	-mv q3asm.qvm cgame/vm/cgame.qvm
	-mv q3asm.map cgame/vm/cgame.map

game/vm/qagame.qvm: $(VM_GAME_OBJ)
	 $(Q3ASM) $(Q3ASM_FLAGS) $^ game/g_syscalls.asm
	-mv q3asm.qvm game/vm/qagame.qvm
	-mv q3asm.map game/vm/qagame.map

ui/vm/ui.qvm: $(VM_UI_OBJ)
	 $(Q3ASM) $(Q3ASM_FLAGS) $^ ui/ui_syscalls.asm
	-mv q3asm.qvm ui/vm/ui.qvm
	-mv q3asm.map ui/vm/ui.map


# -- Rules for compiling single files
cgame/vm/%.asm: cgame/%.c
	$(CPP) $(CPP_FLAGS) $(INCLUDES) $< cgame/vm/$*.i
	$(RCC) $(RCC_FLAGS) cgame/vm/$*.i $@
	-rm cgame/vm/$*.i

game/vm/%.asm: game/%.c
	$(CPP) $(CPP_FLAGS) $(INCLUDES) $< game/vm/$*.i
	$(RCC) $(RCC_FLAGS) game/vm/$*.i $@
	-rm game/vm/$*.i

ui/vm/%.asm: ui/%.c
	$(CPP) $(CPP_FLAGS) $(INCLUDES) $< ui/vm/$*.i
	$(RCC) $(RCC_FLAGS) ui/vm/$*.i $@
	-rm ui/vm/$*.i


# -- Dependency rules (made automatically in file Q3A.depend)
depend:
	-echo > Q3A.depend
	-$(CC) $(CC_DEPEND_FLAGS) -Igame -Icgame -Iui cgame/*.c | $(SED) -e 's/\.o/.asm/g' -e 's/^\(.*asm\)/cgame\/vm\/\1/g' >> Q3A.depend
	-$(CC) $(CC_DEPEND_FLAGS) -Igame -Icgame -Iui game/*.c | $(SED) -e 's/\.o/.asm/g' -e 's/^\(.*asm\)/game\/vm\/\1/g' >> Q3A.depend
	-$(CC) $(CC_DEPEND_FLAGS) -Igame -Icgame -Iui ui/*.c | $(SED) -e 's/\.o/.asm/g' -e 's/^\(.*asm\)/ui\/vm\/\1/g' >> Q3A.depend

include Q3A.depend


# -- Clean up object files
clean: clean_cgame clean_game clean_ui

clean_cgame:
	-rm $(VM_CGAME_OBJ)
	-rm cgame/cm/cgame.qvm

clean_game:
	-rm $(VM_GAME_OBJ)
	-rm game/vm/qagame.qvm

clean_ui:
	-rm $(VM_UI_OBJ)
	-rm ui/vm/ui.qvm

# -- EOF