From 2b9cd1bd7e11ad6d1fd04d2cb4c9fd04f93b09ab Mon Sep 17 00:00:00 2001
From: tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>
Date: Tue, 4 Oct 2005 23:54:51 +0000
Subject: * VM game modules now built from the main Makefile

git-svn-id: svn://svn.icculus.org/quake3/trunk@138 edf5b092-35ff-0310-97b2-ce42778d08ea
---
 code/unix/Makefile      | 291 +++++++++++++++++++++++++++---------------------
 code/unix/Makefile.Game | 285 -----------------------------------------------
 2 files changed, 162 insertions(+), 414 deletions(-)
 delete mode 100644 code/unix/Makefile.Game

(limited to 'code/unix')

diff --git a/code/unix/Makefile b/code/unix/Makefile
index d56a0cf..8b3ed9c 100644
--- a/code/unix/Makefile
+++ b/code/unix/Makefile
@@ -194,12 +194,12 @@ ifeq ($(PLATFORM),linux)
       $(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) \
       $(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) \
       $(B)/missionpack/ui$(ARCH).$(SHLIBEXT) \
-#      $(B)/baseq3/vm/qagame.qvm \
-#      $(B)/baseq3/vm/cgame.qvm \
-#      $(B)/baseq3/vm/ui.qvm \
-#      $(B)/missionpack/vm/qagame.qvm \
-#      $(B)/missionpack/vm/cgame.qvm \
-#      $(B)/missionpack/vm/ui.qvm
+      $(B)/baseq3/vm/cgame.qvm \
+      $(B)/baseq3/vm/qagame.qvm \
+      $(B)/baseq3/vm/ui.qvm \
+      $(B)/missionpack/vm/qagame.qvm \
+      $(B)/missionpack/vm/cgame.qvm \
+      $(B)/missionpack/vm/ui.qvm
 #      $(B)/$(PLATFORM)quake3-smp \
 
   endif
@@ -244,6 +244,8 @@ ifeq ($(PLATFORM),mingw32)
   SHLIBCFLAGS=
   SHLIBLDFLAGS=-shared $(LDFLAGS)
 
+  BINEXT=.exe
+
   LDFLAGS= -mwindows -lwsock32 -lgdi32 -lwinmm -lole32
   GLLDFLAGS=
 
@@ -266,13 +268,13 @@ ifeq ($(PLATFORM),mingw32)
     $(B)/baseq3/ui$(ARCH).$(SHLIBEXT)     \
     $(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) \
     $(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) \
-    $(B)/missionpack/ui$(ARCH).$(SHLIBEXT)
-#    $(B)/baseq3/vm/qagame.qvm \
-#    $(B)/baseq3/vm/cgame.qvm \
-#    $(B)/baseq3/vm/ui.qvm \
-#    $(B)/missionpack/vm/qagame.qvm \
-#    $(B)/missionpack/vm/cgame.qvm \
-#    $(B)/missionpack/vm/ui.qvm
+    $(B)/missionpack/ui$(ARCH).$(SHLIBEXT) \
+    $(B)/baseq3/vm/cgame.qvm \
+    $(B)/baseq3/vm/qagame.qvm \
+    $(B)/baseq3/vm/ui.qvm \
+    $(B)/missionpack/vm/qagame.qvm \
+    $(B)/missionpack/vm/cgame.qvm \
+    $(B)/missionpack/vm/ui.qvm
 
 else # ifeq mingw32
 
@@ -325,12 +327,19 @@ ifeq ($(PLATFORM),freebsd)
   else
     TARGETS=\
       $(B)/$(PLATFORM)quake3 \
+      $(B)/$(PLATFORM)q3ded \
       $(B)/baseq3/cgame$(ARCH).$(SHLIBEXT) \
       $(B)/baseq3/qagame$(ARCH).$(SHLIBEXT) \
       $(B)/baseq3/ui$(ARCH).$(SHLIBEXT)     \
       $(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) \
       $(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) \
-      $(B)/missionpack/ui$(ARCH).$(SHLIBEXT)
+      $(B)/missionpack/ui$(ARCH).$(SHLIBEXT) \
+      $(B)/baseq3/vm/cgame.qvm \
+      $(B)/baseq3/vm/qagame.qvm \
+      $(B)/baseq3/vm/ui.qvm \
+      $(B)/missionpack/vm/qagame.qvm \
+      $(B)/missionpack/vm/cgame.qvm \
+      $(B)/missionpack/vm/ui.qvm
   endif
 
 else # ifeq freebsd
@@ -357,8 +366,8 @@ ifeq ($(PLATFORM),irix)
   LDFLAGS=-ldl -lm
   GLLDFLAGS=-L/usr/X11/$(LIB) -lGL -lX11 -lXext -lm
 
-  TARGETS=$(B)/sgiquake3 \
-    $(B)/q3ded
+  TARGETS=$(B)/$(PLATFORM)quake3 \
+    $(B)/$(PLATFORM)q3ded
 
 else # ifeq IRIX
 
@@ -404,9 +413,25 @@ DO_AS=$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
 DO_DED_CC=$(CC) -DDEDICATED -DC_ONLY $(CFLAGS) -o $@ -c $<
 DO_WINDRES=$(WINDRES) -i $< -o $@
 
-#DO_LCC=$(LCC) -o $@ -S -Wf-target=bytecode -Wf-g -DQ3_VM -I$(CGDIR) -I$(GDIR)  -I$(UIDIR)  $<
+#############################################################################
+# QVM BUILD TOOLS
+#############################################################################
+
+Q3LCC=../tools/q3lcc$(BINEXT)
+Q3ASM=../tools/q3asm$(BINEXT)
+
+$(Q3LCC):
+	$(MAKE) -C ../tools/lcc install
+
+$(Q3ASM):
+	$(MAKE) -C ../tools/asm install
+
+DO_Q3LCC=$(Q3LCC) -o $@ -S -DQ3_VM -I$(CGDIR) -I$(GDIR) -I$(UIDIR) $<
+
+#############################################################################
+# MAIN TARGETS
+#############################################################################
 
-#### DEFAULT TARGET
 default:build_release
 
 debug: build_debug
@@ -1054,41 +1079,13 @@ $(B)/ded/vm_none.o : $(CMDIR)/vm_none.c; $(DO_DED_CC)
 $(B)/ded/$(VM_PPC).o : $(CMDIR)/$(VM_PPC).c; $(DO_DED_CC)
 
 
-#############################################################################
-## QVM
-#############################################################################
-
-$(B)/baseq3/vm/cgame.qvm:
-	cd $(CGDIR) && ./cgame.sh
-	mv /tmp/quake3/baseq3/vm/cgame.qvm $@
-
-$(B)/baseq3/vm/ui.qvm:
-	cd $(Q3UIDIR) && ./q3_ui.sh
-	mv /tmp/quake3/baseq3/vm/ui.qvm $@
-
-$(B)/baseq3/vm/qagame.qvm:
-	cd $(GDIR) && ./game.sh
-	mv /tmp/quake3/baseq3/vm/qagame.qvm $@
-
-$(B)/missionpack/vm/cgame.qvm:
-	cd $(CGDIR) && ./cgame_ta.sh
-	mv /tmp/quake3/missionpack/vm/cgame.qvm $@
-
-$(B)/missionpack/vm/qagame.qvm:
-	cd $(GDIR) && ./game_ta.sh
-	mv /tmp/quake3/missionpack/vm/qagame.qvm $@
-
-$(B)/missionpack/vm/ui.qvm:
-	cd $(UIDIR) && ./ui.sh
-	mv /tmp/quake3/missionpack/vm/ui.qvm $@
-
-
 
 #############################################################################
 ## BASEQ3 CGAME
 #############################################################################
 
-Q3CGOBJ = \
+Q3CGOBJ_ = \
+  $(B)/baseq3/cgame/cg_main.o \
   $(B)/baseq3/game/bg_misc.o \
   $(B)/baseq3/game/bg_pmove.o \
   $(B)/baseq3/game/bg_slidemove.o \
@@ -1100,7 +1097,6 @@ Q3CGOBJ = \
   $(B)/baseq3/cgame/cg_event.o \
   $(B)/baseq3/cgame/cg_info.o \
   $(B)/baseq3/cgame/cg_localents.o \
-  $(B)/baseq3/cgame/cg_main.o \
   $(B)/baseq3/cgame/cg_marks.o \
   $(B)/baseq3/cgame/cg_players.o \
   $(B)/baseq3/cgame/cg_playerstate.o \
@@ -1108,20 +1104,26 @@ Q3CGOBJ = \
   $(B)/baseq3/cgame/cg_scoreboard.o \
   $(B)/baseq3/cgame/cg_servercmds.o \
   $(B)/baseq3/cgame/cg_snapshot.o \
-  $(B)/baseq3/cgame/cg_syscalls.o \
   $(B)/baseq3/cgame/cg_view.o \
   $(B)/baseq3/cgame/cg_weapons.o \
   $(B)/baseq3/game/q_math.o \
   $(B)/baseq3/game/q_shared.o
 
+Q3CGOBJ = $(Q3CGOBJ_) $(B)/baseq3/cgame/cg_syscalls.o
+Q3CGVMOBJ = $(Q3CGOBJ_:%.o=%.asm) $(B)/baseq3/game/bg_lib.asm
+
 $(B)/baseq3/cgame$(ARCH).$(SHLIBEXT) : $(Q3CGOBJ)
 	$(CC)  $(SHLIBLDFLAGS) -o $@ $(Q3CGOBJ)
 
+$(B)/baseq3/vm/cgame.qvm: $(Q3CGVMOBJ) $(CGDIR)/cg_syscalls.asm $(Q3ASM)
+	$(Q3ASM) -o $@ $(Q3CGVMOBJ) $(CGDIR)/cg_syscalls.asm
+
 #############################################################################
 ## MISSIONPACK CGAME
 #############################################################################
 
-MPCGOBJ = \
+MPCGOBJ_ = \
+  $(B)/missionpack/cgame/cg_main.o \
   $(B)/missionpack/game/bg_misc.o \
   $(B)/missionpack/game/bg_pmove.o \
   $(B)/missionpack/game/bg_slidemove.o \
@@ -1134,7 +1136,6 @@ MPCGOBJ = \
   $(B)/missionpack/cgame/cg_event.o \
   $(B)/missionpack/cgame/cg_info.o \
   $(B)/missionpack/cgame/cg_localents.o \
-  $(B)/missionpack/cgame/cg_main.o \
   $(B)/missionpack/cgame/cg_marks.o \
   $(B)/missionpack/cgame/cg_players.o \
   $(B)/missionpack/cgame/cg_playerstate.o \
@@ -1142,23 +1143,29 @@ MPCGOBJ = \
   $(B)/missionpack/cgame/cg_scoreboard.o \
   $(B)/missionpack/cgame/cg_servercmds.o \
   $(B)/missionpack/cgame/cg_snapshot.o \
-  $(B)/missionpack/cgame/cg_syscalls.o \
   $(B)/missionpack/cgame/cg_view.o \
   $(B)/missionpack/cgame/cg_weapons.o \
   $(B)/missionpack/game/q_math.o \
   $(B)/missionpack/game/q_shared.o \
   $(B)/missionpack/ui/ui_shared.o
 
+MPCGOBJ = $(MPCGOBJ_) $(B)/missionpack/cgame/cg_syscalls.o
+MPCGVMOBJ = $(MPCGOBJ_:%.o=%.asm) $(B)/missionpack/game/bg_lib.asm
+
 $(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) : $(MPCGOBJ)
 	$(CC) $(SHLIBLDFLAGS) -o $@ $(MPCGOBJ)
 
+$(B)/missionpack/vm/cgame.qvm: $(MPCGVMOBJ) $(CGDIR)/cg_syscalls.asm $(Q3ASM)
+	$(Q3ASM) -o $@ $(MPCGVMOBJ) $(CGDIR)/cg_syscalls.asm
+
 
 
 #############################################################################
 ## BASEQ3 GAME
 #############################################################################
 
-Q3GOBJ = \
+Q3GOBJ_ = \
+  $(B)/baseq3/game/g_main.o \
   $(B)/baseq3/game/ai_chat.o \
   $(B)/baseq3/game/ai_cmd.o \
   $(B)/baseq3/game/ai_dmnet.o \
@@ -1176,7 +1183,6 @@ Q3GOBJ = \
   $(B)/baseq3/game/g_cmds.o \
   $(B)/baseq3/game/g_combat.o \
   $(B)/baseq3/game/g_items.o \
-  $(B)/baseq3/game/g_main.o \
   $(B)/baseq3/game/g_mem.o \
   $(B)/baseq3/game/g_misc.o \
   $(B)/baseq3/game/g_missile.o \
@@ -1184,7 +1190,6 @@ Q3GOBJ = \
   $(B)/baseq3/game/g_session.o \
   $(B)/baseq3/game/g_spawn.o \
   $(B)/baseq3/game/g_svcmds.o \
-  $(B)/baseq3/game/g_syscalls.o \
   $(B)/baseq3/game/g_target.o \
   $(B)/baseq3/game/g_team.o \
   $(B)/baseq3/game/g_trigger.o \
@@ -1194,14 +1199,21 @@ Q3GOBJ = \
   $(B)/baseq3/game/q_math.o \
   $(B)/baseq3/game/q_shared.o
 
+Q3GOBJ = $(Q3GOBJ_) $(B)/baseq3/game/g_syscalls.o
+Q3GVMOBJ = $(Q3GOBJ_:%.o=%.asm) $(B)/baseq3/game/bg_lib.asm
+
 $(B)/baseq3/qagame$(ARCH).$(SHLIBEXT) : $(Q3GOBJ)
 	$(CC)  $(SHLIBLDFLAGS) -o $@ $(Q3GOBJ)
 
+$(B)/baseq3/vm/qagame.qvm: $(Q3GVMOBJ) $(GDIR)/g_syscalls.asm $(Q3ASM)
+	$(Q3ASM) -o $@ $(Q3GVMOBJ) $(GDIR)/g_syscalls.asm
+
 #############################################################################
 ## MISSIONPACK GAME
 #############################################################################
 
-MPGOBJ = \
+MPGOBJ_ = \
+  $(B)/missionpack/game/g_main.o \
   $(B)/missionpack/game/ai_chat.o \
   $(B)/missionpack/game/ai_cmd.o \
   $(B)/missionpack/game/ai_dmnet.o \
@@ -1219,7 +1231,6 @@ MPGOBJ = \
   $(B)/missionpack/game/g_cmds.o \
   $(B)/missionpack/game/g_combat.o \
   $(B)/missionpack/game/g_items.o \
-  $(B)/missionpack/game/g_main.o \
   $(B)/missionpack/game/g_mem.o \
   $(B)/missionpack/game/g_misc.o \
   $(B)/missionpack/game/g_missile.o \
@@ -1227,7 +1238,6 @@ MPGOBJ = \
   $(B)/missionpack/game/g_session.o \
   $(B)/missionpack/game/g_spawn.o \
   $(B)/missionpack/game/g_svcmds.o \
-  $(B)/missionpack/game/g_syscalls.o \
   $(B)/missionpack/game/g_target.o \
   $(B)/missionpack/game/g_team.o \
   $(B)/missionpack/game/g_trigger.o \
@@ -1237,74 +1247,84 @@ MPGOBJ = \
   $(B)/missionpack/game/q_math.o \
   $(B)/missionpack/game/q_shared.o
 
+MPGOBJ = $(MPGOBJ_) $(B)/missionpack/game/g_syscalls.o
+MPGVMOBJ = $(MPGOBJ_:%.o=%.asm) $(B)/missionpack/game/bg_lib.asm
+
 $(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) : $(MPGOBJ)
 	$(CC) $(SHLIBLDFLAGS) -o $@ $(MPGOBJ)
 
+$(B)/missionpack/vm/qagame.qvm: $(MPGVMOBJ) $(GDIR)/g_syscalls.asm $(Q3ASM)
+	$(Q3ASM) -o $@ $(MPGVMOBJ) $(GDIR)/g_syscalls.asm
+
 
 
 #############################################################################
 ## BASEQ3 UI
 #############################################################################
 
-Q3UIOBJ = \
-	$(B)/baseq3/game/bg_misc.o \
-	$(B)/baseq3/ui/ui_addbots.o \
-	$(B)/baseq3/ui/ui_atoms.o \
-	$(B)/baseq3/ui/ui_cdkey.o \
-	$(B)/baseq3/ui/ui_cinematics.o \
-	$(B)/baseq3/ui/ui_confirm.o \
-	$(B)/baseq3/ui/ui_connect.o \
-	$(B)/baseq3/ui/ui_controls2.o \
-	$(B)/baseq3/ui/ui_credits.o \
-	$(B)/baseq3/ui/ui_demo2.o \
-	$(B)/baseq3/ui/ui_display.o \
-	$(B)/baseq3/ui/ui_gameinfo.o \
-	$(B)/baseq3/ui/ui_ingame.o \
-	$(B)/baseq3/ui/ui_loadconfig.o \
-	$(B)/baseq3/ui/ui_main.o \
-	$(B)/baseq3/ui/ui_menu.o \
-	$(B)/baseq3/ui/ui_mfield.o \
-	$(B)/baseq3/ui/ui_mods.o \
-	$(B)/baseq3/ui/ui_network.o \
-	$(B)/baseq3/ui/ui_options.o \
-	$(B)/baseq3/ui/ui_playermodel.o \
-	$(B)/baseq3/ui/ui_players.o \
-	$(B)/baseq3/ui/ui_playersettings.o \
-	$(B)/baseq3/ui/ui_preferences.o \
-	$(B)/baseq3/ui/ui_qmenu.o \
-	$(B)/baseq3/ui/ui_removebots.o \
-	$(B)/baseq3/ui/ui_saveconfig.o \
-	$(B)/baseq3/ui/ui_serverinfo.o \
-	$(B)/baseq3/ui/ui_servers2.o \
-	$(B)/baseq3/ui/ui_setup.o \
-	$(B)/baseq3/ui/ui_sound.o \
-	$(B)/baseq3/ui/ui_sparena.o \
-	$(B)/baseq3/ui/ui_specifyserver.o \
-	$(B)/baseq3/ui/ui_splevel.o \
-	$(B)/baseq3/ui/ui_sppostgame.o \
-	$(B)/baseq3/ui/ui_spskill.o \
-	$(B)/baseq3/ui/ui_startserver.o \
-	$(B)/missionpack/ui/ui_syscalls.o \
-	$(B)/baseq3/ui/ui_team.o \
-	$(B)/baseq3/ui/ui_teamorders.o \
-	$(B)/baseq3/ui/ui_video.o \
-	\
-	$(B)/baseq3/game/q_math.o \
-	$(B)/baseq3/game/q_shared.o
+Q3UIOBJ_ = \
+  $(B)/baseq3/ui/ui_main.o \
+  $(B)/baseq3/game/bg_misc.o \
+  $(B)/baseq3/ui/ui_addbots.o \
+  $(B)/baseq3/ui/ui_atoms.o \
+  $(B)/baseq3/ui/ui_cdkey.o \
+  $(B)/baseq3/ui/ui_cinematics.o \
+  $(B)/baseq3/ui/ui_confirm.o \
+  $(B)/baseq3/ui/ui_connect.o \
+  $(B)/baseq3/ui/ui_controls2.o \
+  $(B)/baseq3/ui/ui_credits.o \
+  $(B)/baseq3/ui/ui_demo2.o \
+  $(B)/baseq3/ui/ui_display.o \
+  $(B)/baseq3/ui/ui_gameinfo.o \
+  $(B)/baseq3/ui/ui_ingame.o \
+  $(B)/baseq3/ui/ui_loadconfig.o \
+  $(B)/baseq3/ui/ui_menu.o \
+  $(B)/baseq3/ui/ui_mfield.o \
+  $(B)/baseq3/ui/ui_mods.o \
+  $(B)/baseq3/ui/ui_network.o \
+  $(B)/baseq3/ui/ui_options.o \
+  $(B)/baseq3/ui/ui_playermodel.o \
+  $(B)/baseq3/ui/ui_players.o \
+  $(B)/baseq3/ui/ui_playersettings.o \
+  $(B)/baseq3/ui/ui_preferences.o \
+  $(B)/baseq3/ui/ui_qmenu.o \
+  $(B)/baseq3/ui/ui_removebots.o \
+  $(B)/baseq3/ui/ui_saveconfig.o \
+  $(B)/baseq3/ui/ui_serverinfo.o \
+  $(B)/baseq3/ui/ui_servers2.o \
+  $(B)/baseq3/ui/ui_setup.o \
+  $(B)/baseq3/ui/ui_sound.o \
+  $(B)/baseq3/ui/ui_sparena.o \
+  $(B)/baseq3/ui/ui_specifyserver.o \
+  $(B)/baseq3/ui/ui_splevel.o \
+  $(B)/baseq3/ui/ui_sppostgame.o \
+  $(B)/baseq3/ui/ui_spskill.o \
+  $(B)/baseq3/ui/ui_startserver.o \
+  $(B)/baseq3/ui/ui_team.o \
+  $(B)/baseq3/ui/ui_teamorders.o \
+  $(B)/baseq3/ui/ui_video.o \
+  \
+  $(B)/baseq3/game/q_math.o \
+  $(B)/baseq3/game/q_shared.o
+
+Q3UIOBJ = $(Q3UIOBJ_) $(B)/missionpack/ui/ui_syscalls.o
+Q3UIVMOBJ = $(Q3UIOBJ_:%.o=%.asm) $(B)/baseq3/game/bg_lib.asm
 
 $(B)/baseq3/ui$(ARCH).$(SHLIBEXT) : $(Q3UIOBJ)
 	$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3UIOBJ)
 
+$(B)/baseq3/vm/ui.qvm: $(Q3UIVMOBJ) $(UIDIR)/ui_syscalls.asm $(Q3ASM)
+	$(Q3ASM) -o $@ $(Q3UIVMOBJ) $(UIDIR)/ui_syscalls.asm
+
 #############################################################################
 ## MISSIONPACK UI
 #############################################################################
 
-MPUIOBJ = \
+MPUIOBJ_ = \
+  $(B)/missionpack/ui/ui_main.o \
   $(B)/missionpack/ui/ui_atoms.o \
   $(B)/missionpack/ui/ui_gameinfo.o \
-  $(B)/missionpack/ui/ui_main.o \
   $(B)/missionpack/ui/ui_players.o \
-  $(B)/missionpack/ui/ui_syscalls.o \
   $(B)/missionpack/ui/ui_util.o \
   $(B)/missionpack/ui/ui_shared.o \
   \
@@ -1313,9 +1333,15 @@ MPUIOBJ = \
   $(B)/missionpack/game/q_math.o \
   $(B)/missionpack/game/q_shared.o
 
+MPUIOBJ = $(MPUIOBJ_) $(B)/missionpack/ui/ui_syscalls.o
+MPUIVMOBJ = $(MPUIOBJ_:%.o=%.asm) $(B)/baseq3/game/bg_lib.asm
+
 $(B)/missionpack/ui$(ARCH).$(SHLIBEXT) : $(MPUIOBJ)
 	$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(MPUIOBJ)
 
+$(B)/missionpack/vm/ui.qvm: $(MPUIVMOBJ) $(UIDIR)/ui_syscalls.asm $(Q3ASM)
+	$(Q3ASM) -o $@ $(MPUIVMOBJ) $(UIDIR)/ui_syscalls.asm
+
 
 
 #############################################################################
@@ -1325,21 +1351,41 @@ $(B)/missionpack/ui$(ARCH).$(SHLIBEXT) : $(MPUIOBJ)
 $(B)/baseq3/cgame/%.o: $(CGDIR)/%.c
 	$(DO_SHLIB_CC)
 
+$(B)/baseq3/cgame/%.asm: $(CGDIR)/%.c $(Q3LCC) 
+	$(DO_Q3LCC)
+
 $(B)/missionpack/cgame/%.o: $(CGDIR)/%.c
 	$(DO_SHLIB_CC) -DMISSIONPACK
 
+$(B)/missionpack/cgame/%.asm: $(CGDIR)/%.c $(Q3LCC)
+	$(DO_Q3LCC) -DMISSIONPACK
+
+
 $(B)/baseq3/game/%.o: $(GDIR)/%.c
 	$(DO_SHLIB_CC)
 
+$(B)/baseq3/game/%.asm: $(GDIR)/%.c $(Q3LCC)
+	$(DO_Q3LCC)
+
 $(B)/missionpack/game/%.o: $(GDIR)/%.c
 	$(DO_SHLIB_CC) -DMISSIONPACK
 
+$(B)/missionpack/game/%.asm: $(GDIR)/%.c $(Q3LCC)
+	$(DO_Q3LCC) -DMISSIONPACK
+
+
 $(B)/baseq3/ui/%.o: $(Q3UIDIR)/%.c
 	$(DO_SHLIB_CC)
 
+$(B)/baseq3/ui/%.asm: $(Q3UIDIR)/%.c $(Q3LCC)
+	$(DO_Q3LCC)
+
 $(B)/missionpack/ui/%.o: $(UIDIR)/%.c
 	$(DO_SHLIB_CC) -DMISSIONPACK
 
+$(B)/missionpack/ui/%.asm: $(UIDIR)/%.c $(Q3LCC)
+	$(DO_Q3LCC) -DMISSIONPACK
+
 
 
 #############################################################################
@@ -1367,31 +1413,14 @@ copyfiles:
 	install -s -m 0755 $(BR)/missionpack/ui$(ARCH).$(SHLIBEXT) \
 					$(COPYDIR)/missionpack/.
 
-# TTimo: FIXME: doesn't clean the binary and .so
-
 clean:clean-debug clean-release
 
-clean2: clean-bins
-	rm -f $(Q3OBJ) $(Q3POBJ) $(Q3POBJ_SMP) $(Q3DOBJ) $(MPGOBJ) $(Q3GOBJ) $(Q3CGOBJ) $(MPCGOBJ) $(Q3UIOBJ) $(MPUIOBJ)
-	rm -f $(CGDIR)/vm/*.asm
-	rm -f $(GDIR)/vm/*.asm
-	rm -f $(UIDIR)/vm/*.asm
-	rm -f $(Q3UIDIR)/vm/*.asm
-
-# TTimo: linuxq3ded linuxquake3 linuxquake3-smp .. hardcoded the names .. maybe not such a good thing
-# FIXME: also, removing the *.so is crappy .. I just want to avoid rm -rf debugi386-glibc to save the symlinks to pk3's for testing
-clean-bins:
-	if [ -d $(B) ];then (find $(B) -name '*.so' -exec rm {} \;)fi
-	rm -f $(B)/linuxq3ded
-	rm -f $(B)/linuxquake3
-	rm -f $(B)/linuxquake3-smp
-	rm -f $(B)/baseq3/vm/cgame.qvm
-	rm -f $(B)/baseq3/vm/ui.qvm
-	rm -f $(B)/baseq3/vm/qagame.qvm
-	rm -f $(B)/missionpack/vm/cgame.qvm
-	rm -f $(B)/missionpack/vm/qagame.qvm
-	rm -f $(B)/missionpack/vm/ui.qvm
+clean2:
 	if [ -d $(B) ];then (find $(B) -name '*.d' -exec rm {} \;)fi
+	rm -f $(Q3OBJ) $(Q3POBJ) $(Q3POBJ_SMP) $(Q3DOBJ) \
+		$(MPGOBJ) $(Q3GOBJ) $(Q3CGOBJ) $(MPCGOBJ) $(Q3UIOBJ) $(MPUIOBJ) \
+		$(MPGVMOBJ) $(Q3GVMOBJ) $(Q3CGVMOBJ) $(MPCGVMOBJ) $(Q3UIVMOBJ) $(MPUIVMOBJ)
+	rm -f $(TARGETS)
 
 clean-debug:
 	$(MAKE) clean2 B=$(BD) CFLAGS="$(DEBUG_CFLAGS)"
@@ -1399,6 +1428,10 @@ clean-debug:
 clean-release:
 	$(MAKE) clean2 B=$(BR) CFLAGS="$(DEBUG_CFLAGS)"
 
+distclean: clean
+	$(MAKE) -C ../tools/asm clean uninstall
+	$(MAKE) -C ../tools/lcc clean uninstall
+
 #############################################################################
 # DEPENDENCIES
 #############################################################################
diff --git a/code/unix/Makefile.Game b/code/unix/Makefile.Game
deleted file mode 100644
index 8f460ec..0000000
--- a/code/unix/Makefile.Game
+++ /dev/null
@@ -1,285 +0,0 @@
-#
-# Quake3 Unix Game Makefile
-#
-# GNU Make required
-#
-
-###
-### These paths are where you probably want to change things
-###
-
-#The main Quake3 directory
-BDIR=..
-
-#This is the game dir
-GAMEDIR=baseq3
-
-#Where the source is, assumed to be same directory as this Makefile
-SRCDIR=.
-
-#Location of binaries
-BINDIR=../bin
-LCC=$(BINDIR)/lcc # -lccdir=$(BINDIR)/
-Q3ASM=$(BINDIR)/q3asm
-
-
-#############################################################################
-##
-## You shouldn't have to touch anything below here
-##
-#############################################################################
-
-GDIR=$(SRCDIR)/game
-CGDIR=$(SRCDIR)/cgame
-UIDIR=$(SRCDIR)/ui
-
-LCCFLAGS=-DQ3_VM -S -Wf-target=bytecode -Wf-g -I..\cgame -I..\game -I..\ui
-
-DO_LCC=$(LCC) $(LCCFLAGS) -o $@ -c $<
-
-TARGETS=\
-	$(BDIR)/$(GAMEDIR)/vm/cgame.qvm \
-	$(BDIR)/$(GAMEDIR)/vm/qagame.qvm \
-	$(BDIR)/$(GAMEDIR)/vm/ui.qvm
-
-default: makedir $(TARGETS)
-
-makedir:
-	@-mkdir $(GDIR)/vm
-	@-mkdir $(CGDIR)/vm
-	@-mkdir $(UIDIR)/vm
-
-#############################################################################
-# GAME VM
-#############################################################################
-
-##NOTE:  g_main must be first.  Control passes to first function in the vm
-
-GVMASM = \
-	$(GDIR)/vm/g_main.asm \
-	$(GDIR)/vm/bg_misc.asm \
-	$(GDIR)/vm/bg_lib.asm \
-	$(GDIR)/vm/bg_pmove.asm \
-	$(GDIR)/vm/bg_slidemove.asm \
-	$(GDIR)/vm/q_math.asm \
-	$(GDIR)/vm/q_shared.asm \
-	$(GDIR)/vm/ai_dmnet.asm \
-	$(GDIR)/vm/ai_dmq3.asm \
-	$(GDIR)/vm/ai_team.asm \
-	$(GDIR)/vm/ai_main.asm \
-	$(GDIR)/vm/ai_chat.asm \
-	$(GDIR)/vm/ai_cmd.asm \
-	$(GDIR)/vm/g_active.asm \
-	$(GDIR)/vm/g_arenas.asm \
-	$(GDIR)/vm/g_bot.asm \
-	$(GDIR)/vm/g_client.asm \
-	$(GDIR)/vm/g_cmds.asm \
-	$(GDIR)/vm/g_combat.asm \
-	$(GDIR)/vm/g_items.asm \
-	$(GDIR)/vm/g_mem.asm \
-	$(GDIR)/vm/g_misc.asm \
-	$(GDIR)/vm/g_missile.asm \
-	$(GDIR)/vm/g_mover.asm \
-	$(GDIR)/vm/g_session.asm \
-	$(GDIR)/vm/g_spawn.asm \
-	$(GDIR)/vm/g_svcmds.asm \
-	$(GDIR)/vm/g_target.asm \
-	$(GDIR)/vm/g_team.asm \
-	$(GDIR)/vm/g_trigger.asm \
-	$(GDIR)/vm/g_utils.asm \
-	$(GDIR)/vm/g_weapon.asm
-
-$(BDIR)/$(GAMEDIR)/vm/qagame.qvm : $(GVMASM)
-	$(Q3ASM) -o $@ $(GVMASM) $(SRCDIR)/game/g_syscalls.asm
-
-$(GDIR)/vm/ai_chat.asm : $(GDIR)/ai_chat.c; $(DO_LCC) 
-$(GDIR)/vm/ai_cmd.asm : $(GDIR)/ai_cmd.c; $(DO_LCC) 
-$(GDIR)/vm/ai_dmnet.asm : $(GDIR)/ai_dmnet.c; $(DO_LCC) 
-$(GDIR)/vm/ai_dmq3.asm : $(GDIR)/ai_dmq3.c; $(DO_LCC) 
-$(GDIR)/vm/ai_main.asm : $(GDIR)/ai_main.c; $(DO_LCC) 
-$(GDIR)/vm/ai_team.asm : $(GDIR)/ai_team.c; $(DO_LCC) 
-$(GDIR)/vm/bg_lib.asm : $(GDIR)/bg_lib.c; $(DO_LCC) 
-$(GDIR)/vm/bg_misc.asm : $(GDIR)/bg_misc.c; $(DO_LCC) 
-$(GDIR)/vm/bg_pmove.asm : $(GDIR)/bg_pmove.c; $(DO_LCC) 
-$(GDIR)/vm/bg_slidemove.asm : $(GDIR)/bg_slidemove.c; $(DO_LCC) 
-$(GDIR)/vm/g_active.asm : $(GDIR)/g_active.c; $(DO_LCC) 
-$(GDIR)/vm/g_arenas.asm : $(GDIR)/g_arenas.c; $(DO_LCC) 
-$(GDIR)/vm/g_bot.asm : $(GDIR)/g_bot.c; $(DO_LCC) 
-$(GDIR)/vm/g_client.asm : $(GDIR)/g_client.c; $(DO_LCC) 
-$(GDIR)/vm/g_cmds.asm : $(GDIR)/g_cmds.c; $(DO_LCC) 
-$(GDIR)/vm/g_combat.asm : $(GDIR)/g_combat.c; $(DO_LCC) 
-$(GDIR)/vm/g_items.asm : $(GDIR)/g_items.c; $(DO_LCC) 
-$(GDIR)/vm/g_main.asm : $(GDIR)/g_main.c; $(DO_LCC) 
-$(GDIR)/vm/g_mem.asm : $(GDIR)/g_mem.c; $(DO_LCC) 
-$(GDIR)/vm/g_misc.asm : $(GDIR)/g_misc.c; $(DO_LCC) 
-$(GDIR)/vm/g_missile.asm : $(GDIR)/g_missile.c; $(DO_LCC) 
-$(GDIR)/vm/g_mover.asm : $(GDIR)/g_mover.c; $(DO_LCC) 
-$(GDIR)/vm/g_session.asm : $(GDIR)/g_session.c; $(DO_LCC) 
-$(GDIR)/vm/g_spawn.asm : $(GDIR)/g_spawn.c; $(DO_LCC) 
-$(GDIR)/vm/g_svcmds.asm : $(GDIR)/g_svcmds.c; $(DO_LCC) 
-$(GDIR)/vm/g_target.asm : $(GDIR)/g_target.c; $(DO_LCC) 
-$(GDIR)/vm/g_team.asm : $(GDIR)/g_team.c; $(DO_LCC) 
-$(GDIR)/vm/g_trigger.asm : $(GDIR)/g_trigger.c; $(DO_LCC) 
-$(GDIR)/vm/g_utils.asm : $(GDIR)/g_utils.c; $(DO_LCC) 
-$(GDIR)/vm/g_weapon.asm : $(GDIR)/g_weapon.c; $(DO_LCC) 
-$(GDIR)/vm/q_math.asm : $(GDIR)/q_math.c; $(DO_LCC) 
-$(GDIR)/vm/q_shared.asm : $(GDIR)/q_shared.c; $(DO_LCC) 
-
-$(BDIR)/$(GAMEDIR)/vm/cgame.qvm : 
-	echo cgame.qvm disabled
-
-$(BDIR)/$(GAMEDIR)/vm/ui.qvm : 
-	echo ui.qvm disabled
-
-#############################################################################
-# CGAME
-#############################################################################
-
-CGOBJ = \
-	$(SRCDIR)/cgame/bg_lib.o \
-	$(SRCDIR)/cgame/bg_misc.o \
-	$(SRCDIR)/cgame/bg_pmove.o \
-	$(SRCDIR)/cgame/bg_slidemove.o \
-	$(SRCDIR)/cgame/cg_consolecmds.o \
-	$(SRCDIR)/cgame/cg_draw.o \
-	$(SRCDIR)/cgame/cg_drawtools.o \
-	$(SRCDIR)/cgame/cg_effects.o \
-	$(SRCDIR)/cgame/cg_ents.o \
-	$(SRCDIR)/cgame/cg_event.o \
-	$(SRCDIR)/cgame/cg_info.o \
-	$(SRCDIR)/cgame/cg_localents.o \
-	$(SRCDIR)/cgame/cg_main.o \
-	$(SRCDIR)/cgame/cg_marks.o \
-	$(SRCDIR)/cgame/cg_players.o \
-	$(SRCDIR)/cgame/cg_playerstate.o \
-	$(SRCDIR)/cgame/cg_predict.o \
-	$(SRCDIR)/cgame/cg_scoreboard.o \
-	$(SRCDIR)/cgame/cg_servercmds.o \
-	$(SRCDIR)/cgame/cg_snapshot.o \
-	$(SRCDIR)/cgame/cg_view.o \
-	$(SRCDIR)/cgame/cg_weapons.o \
-	$(SRCDIR)/cgame/q_math.o \
-	$(SRCDIR)/cgame/q_shared.o
-
-$(SRCDIR)/cgame$(ARCH).$(SHLIBEXT) : $(CGOBJ)
-	$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(CGOBJ)
-
-$(SRCDIR)/cgame/bg_lib.o : $(GDIR)/bg_lib.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/bg_misc.o : $(GDIR)/bg_misc.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/bg_pmove.o : $(GDIR)/bg_pmove.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/bg_slidemove.o : $(GDIR)/bg_slidemove.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/cg_consolecmds.o : $(CGDIR)/cg_consolecmds.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/cg_draw.o : $(CGDIR)/cg_draw.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/cg_drawtools.o : $(CGDIR)/cg_drawtools.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/cg_effects.o : $(CGDIR)/cg_effects.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/cg_ents.o : $(CGDIR)/cg_ents.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/cg_event.o : $(CGDIR)/cg_event.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/cg_info.o : $(CGDIR)/cg_info.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/cg_localents.o : $(CGDIR)/cg_localents.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/cg_main.o : $(CGDIR)/cg_main.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/cg_marks.o : $(CGDIR)/cg_marks.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/cg_players.o : $(CGDIR)/cg_players.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/cg_playerstate.o : $(CGDIR)/cg_playerstate.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/cg_predict.o : $(CGDIR)/cg_predict.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/cg_scoreboard.o : $(CGDIR)/cg_scoreboard.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/cg_servercmds.o : $(CGDIR)/cg_servercmds.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/cg_snapshot.o : $(CGDIR)/cg_snapshot.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/cg_view.o : $(CGDIR)/cg_view.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/cg_weapons.o : $(CGDIR)/cg_weapons.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/q_math.o : $(GDIR)/q_math.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/cgame/q_shared.o : $(GDIR)/q_shared.c; $(DO_SHLIB_CC) 
-
-#############################################################################
-# UI
-#############################################################################
-
-UIOBJ = \
-	$(SRCDIR)/ui/bg_lib.o \
-	$(SRCDIR)/ui/bg_misc.o \
-	$(SRCDIR)/ui/ui_addbots.o \
-	$(SRCDIR)/ui/ui_atoms.o \
-	$(SRCDIR)/ui/ui_cinematics.o \
-	$(SRCDIR)/ui/ui_confirm.o \
-	$(SRCDIR)/ui/ui_connect.o \
-	$(SRCDIR)/ui/ui_controls2.o \
-	$(SRCDIR)/ui/ui_credits.o \
-	$(SRCDIR)/ui/ui_demo2.o \
-	$(SRCDIR)/ui/ui_display.o \
-	$(SRCDIR)/ui/ui_gameinfo.o \
-	$(SRCDIR)/ui/ui_ingame.o \
-	$(SRCDIR)/ui/ui_loadconfig.o \
-	$(SRCDIR)/ui/ui_main.o \
-	$(SRCDIR)/ui/ui_menu.o \
-	$(SRCDIR)/ui/ui_mfield.o \
-	$(SRCDIR)/ui/ui_network.o \
-	$(SRCDIR)/ui/ui_playermodel.o \
-	$(SRCDIR)/ui/ui_players.o \
-	$(SRCDIR)/ui/ui_playersettings.o \
-	$(SRCDIR)/ui/ui_preferences.o \
-	$(SRCDIR)/ui/ui_qmenu.o \
-	$(SRCDIR)/ui/ui_saveconfig.o \
-	$(SRCDIR)/ui/ui_serverinfo.o \
-	$(SRCDIR)/ui/ui_servers2.o \
-	$(SRCDIR)/ui/ui_setup.o \
-	$(SRCDIR)/ui/ui_sound.o \
-	$(SRCDIR)/ui/ui_sparena.o \
-	$(SRCDIR)/ui/ui_specifyserver.o \
-	$(SRCDIR)/ui/ui_splevel.o \
-	$(SRCDIR)/ui/ui_sppostgame.o \
-	$(SRCDIR)/ui/ui_spskill.o \
-	$(SRCDIR)/ui/ui_startserver.o \
-	$(SRCDIR)/ui/ui_team.o \
-	$(SRCDIR)/ui/ui_video.o \
-	\
-	$(SRCDIR)/ui/q_math.o \
-	$(SRCDIR)/ui/q_shared.o
-
-$(SRCDIR)/ui$(ARCH).$(SHLIBEXT) : $(UIOBJ)
-	$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(UIOBJ)
-
-$(SRCDIR)/ui/bg_lib.o : $(GDIR)/bg_lib.c; $(DO_CC) 
-$(SRCDIR)/ui/bg_misc.o : $(GDIR)/bg_misc.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_addbots.o : $(UIDIR)/ui_addbots.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_atoms.o : $(UIDIR)/ui_atoms.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_cinematics.o : $(UIDIR)/ui_cinematics.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_confirm.o : $(UIDIR)/ui_confirm.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_connect.o : $(UIDIR)/ui_connect.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_controls2.o : $(UIDIR)/ui_controls2.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_credits.o : $(UIDIR)/ui_credits.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_demo2.o : $(UIDIR)/ui_demo2.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_display.o : $(UIDIR)/ui_display.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_gameinfo.o : $(UIDIR)/ui_gameinfo.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_ingame.o : $(UIDIR)/ui_ingame.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_loadconfig.o : $(UIDIR)/ui_loadconfig.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_main.o : $(UIDIR)/ui_main.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_menu.o : $(UIDIR)/ui_menu.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_mfield.o : $(UIDIR)/ui_mfield.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_network.o : $(UIDIR)/ui_network.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_playermodel.o : $(UIDIR)/ui_playermodel.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_players.o : $(UIDIR)/ui_players.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_playersettings.o : $(UIDIR)/ui_playersettings.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_preferences.o : $(UIDIR)/ui_preferences.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_qmenu.o : $(UIDIR)/ui_qmenu.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_quit.o : $(UIDIR)/ui_quit.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_saveconfig.o : $(UIDIR)/ui_saveconfig.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_serverinfo.o : $(UIDIR)/ui_serverinfo.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_servers2.o : $(UIDIR)/ui_servers2.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_setup.o : $(UIDIR)/ui_setup.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_sound.o : $(UIDIR)/ui_sound.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_sparena.o : $(UIDIR)/ui_sparena.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_specifyserver.o : $(UIDIR)/ui_specifyserver.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_splevel.o : $(UIDIR)/ui_splevel.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_sppostgame.o : $(UIDIR)/ui_sppostgame.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_spskill.o : $(UIDIR)/ui_spskill.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_startserver.o : $(UIDIR)/ui_startserver.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_team.o : $(UIDIR)/ui_team.c; $(DO_CC) 
-$(SRCDIR)/ui/ui_video.o : $(UIDIR)/ui_video.c; $(DO_CC) 
-$(SRCDIR)/ui/q_math.o : $(GDIR)/q_math.c; $(DO_SHLIB_CC) 
-$(SRCDIR)/ui/q_shared.o : $(GDIR)/q_shared.c; $(DO_SHLIB_CC) 
-
-#############################################################################
-# MISC
-#############################################################################
-
-clean:
-	rm -f $(GVMASM)
-- 
cgit v1.2.3