summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2007-07-21 22:52:39 +0000
committerTim Angus <tim@ngus.net>2007-07-21 22:52:39 +0000
commitbfef94ce3a4f415043c0e7b97e222a3e9ee14b8d (patch)
tree0169bfb821f1e92d7c5d2d38dff60cd0a5bca714
parent32685fe5624f4f7a722ebf27388b24711e772ff1 (diff)
* Merge of ioq3-r1119
-rw-r--r--Makefile124
-rw-r--r--src/qcommon/vm_ppc.c13
-rw-r--r--src/unix/unix_main.c14
-rw-r--r--src/unix/unix_net.c4
4 files changed, 90 insertions, 65 deletions
diff --git a/Makefile b/Makefile
index 5e12bf23..e5157e08 100644
--- a/Makefile
+++ b/Makefile
@@ -338,9 +338,6 @@ ifeq ($(PLATFORM),darwin)
ifeq ($(ARCH),ppc)
OPTIMIZE += -faltivec -O3
- # Carbon is required on PPC only to make a call to MakeDataExecutable
- # in the PPC vm (should be a better non-Carbon way).
- LDFLAGS += -framework Carbon
endif
ifeq ($(ARCH),x86)
OPTIMIZE += -march=prescott -mfpmath=sse
@@ -612,6 +609,7 @@ else # ifeq IRIX
ifeq ($(PLATFORM),sunos)
+ CC=gcc
INSTALL=ginstall
MKDIR=gmkdir
COPYDIR="/usr/local/share/games/tremulous"
@@ -725,8 +723,7 @@ ifneq ($(BUILD_GAME_QVM),0)
TARGETS += \
$(B)/base/vm/cgame.qvm \
$(B)/base/vm/game.qvm \
- $(B)/base/vm/ui.qvm \
- qvmdeps
+ $(B)/base/vm/ui.qvm
endif
endif
@@ -743,55 +740,93 @@ ifeq ($(USE_LOCAL_HEADERS),1)
endif
ifeq ($(GENERATE_DEPENDENCIES),1)
- DEPEND_CFLAGS=-MMD
+ BASE_CFLAGS += -MMD
endif
ifeq ($(USE_SVN),1)
BASE_CFLAGS += -DSVN_VERSION=\\\"$(SVN_VERSION)\\\"
endif
-DO_CC = @echo "CC $<"; \
- $(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -o $@ -c $<
-DO_SMP_CC = @echo "SMP_CC $<"; \
- $(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -DSMP -o $@ -c $<
-DO_BOT_CC = @echo "BOT_CC $<"; \
- $(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) $(BOTCFLAGS) -DBOTLIB -o $@ -c $<
-DO_SHLIB_CC = @echo "SHLIB_CC $<"; \
- $(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
-DO_AS = @echo "AS $<"; \
- $(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
-DO_DED_CC = @echo "DED_CC $<"; \
- $(CC) $(NOTSHLIBCFLAGS) -DDEDICATED $(CFLAGS) -o $@ -c $<
-DO_WINDRES = @echo "WINDRES $<"; \
- $(WINDRES) -i $< -o $@
+define DO_CC
+@echo "CC $<"
+@$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -o $@ -c $<
+endef
+
+define DO_SMP_CC
+@echo "SMP_CC $<"
+@$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -DSMP -o $@ -c $<
+endef
+
+define DO_BOT_CC
+@echo "BOT_CC $<"
+@$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) $(BOTCFLAGS) -DBOTLIB -o $@ -c $<
+endef
+
+ifeq ($(GENERATE_DEPENDENCIES),1)
+ DO_QVM_DEP=cat $(@:%.o=%.d) | sed -e 's/\.o/\.asm/g' >> $(@:%.o=%.d)
+endif
+
+define DO_SHLIB_CC
+@echo "SHLIB_CC $<"
+@$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
+@$(DO_QVM_DEP)
+endef
+
+define DO_AS
+@echo "AS $<"
+@$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+endef
+
+define DO_DED_CC
+@echo "DED_CC $<"
+@$(CC) $(NOTSHLIBCFLAGS) -DDEDICATED $(CFLAGS) -o $@ -c $<
+endef
+
+define DO_WINDRES
+@echo "WINDRES $<"
+@$(WINDRES) -i $< -o $@
+endef
+
#############################################################################
# MAIN TARGETS
#############################################################################
-default: build_release
-
-debug: build_debug
-release: build_release
+default: release
+all: debug release
-build_debug: tools
- $(MAKE) makedirs targets B=$(BD) \
- CFLAGS="$(CFLAGS) $(DEBUG_CFLAGS) $(DEPEND_CFLAGS)"
+debug:
+ @$(MAKE) targets B=$(BD) CFLAGS="$(CFLAGS) $(DEBUG_CFLAGS)"
ifeq ($(BUILD_MASTER_SERVER),1)
$(MAKE) -C $(MASTERDIR) debug
endif
-build_release: tools
- $(MAKE) makedirs targets B=$(BR) \
- CFLAGS="$(CFLAGS) $(RELEASE_CFLAGS) $(DEPEND_CFLAGS)"
+release:
+ @$(MAKE) targets B=$(BR) CFLAGS="$(CFLAGS) $(RELEASE_CFLAGS)"
ifeq ($(BUILD_MASTER_SERVER),1)
$(MAKE) -C $(MASTERDIR) release
endif
-# Build both debug and release builds
-all: build_debug build_release
-
-targets: $(TARGETS)
+# Create the build directories and tools, print out
+# an informational message, then start building
+targets: makedirs tools
+ @echo ""
+ @echo "Building Tremulous in $(B):"
+ @echo " CC: $(CC)"
+ @echo ""
+ @echo " CFLAGS:"
+ @for i in $(CFLAGS); \
+ do \
+ echo " $$i"; \
+ done
+ @echo ""
+ @echo " Output:"
+ @for i in $(TARGETS); \
+ do \
+ echo " $$i"; \
+ done
+ @echo ""
+ @$(MAKE) $(TARGETS)
makedirs:
@if [ ! -d $(BUILD_DIR) ];then $(MKDIR) $(BUILD_DIR);fi
@@ -822,8 +857,10 @@ tools:
$(MAKE) -C $(TOOLSDIR)/asm install
endif
-DO_Q3LCC = @echo "Q3LCC $<"; \
- $(Q3LCC) -o $@ $<
+define DO_Q3LCC
+@echo "Q3LCC $<"
+@$(Q3LCC) -o $@ $<
+endef
#############################################################################
# CLIENT/SERVER
@@ -1339,10 +1376,10 @@ clean2:
@rm -f $(TARGETS)
clean-debug:
- @$(MAKE) clean2 B=$(BD) CFLAGS="$(DEBUG_CFLAGS)"
+ @$(MAKE) clean2 B=$(BD)
clean-release:
- @$(MAKE) clean2 B=$(BR) CFLAGS="$(RELEASE_CFLAGS)"
+ @$(MAKE) clean2 B=$(BR)
toolsclean:
@$(MAKE) -C $(TOOLSDIR)/asm clean uninstall
@@ -1351,7 +1388,7 @@ toolsclean:
distclean: clean toolsclean
@rm -rf $(BUILD_DIR)
-installer: build_release
+installer: release
@$(MAKE) VERSION=$(VERSION) -C $(LOKISETUPDIR)
dist:
@@ -1366,13 +1403,10 @@ dist:
D_FILES=$(shell find . -name '*.d')
-$(B)/base/vm/vm.d: $(GOBJ) $(CGOBJ) $(UIOBJ)
- @cat $(^:%.o=%.d) | sed -e 's/\.o/\.asm/g' > $@
-
-qvmdeps: $(B)/base/vm/vm.d
-
ifneq ($(strip $(D_FILES)),)
include $(D_FILES)
endif
-.PHONY: release debug clean distclean copyfiles installer dist
+.PHONY: all clean clean2 clean-debug clean-release copyfiles \
+ debug default dist distclean installer makedirs release \
+ targets tools toolsclean
diff --git a/src/qcommon/vm_ppc.c b/src/qcommon/vm_ppc.c
index 79fc506f..460fe425 100644
--- a/src/qcommon/vm_ppc.c
+++ b/src/qcommon/vm_ppc.c
@@ -24,10 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// ppc dynamic compiler
#include "vm_local.h"
-
-#ifdef MACOS_X
-#include <CoreServices/CoreServices.h>
-#endif
+#include <sys/mman.h>
#define DEBUG_VM 0
@@ -1726,12 +1723,8 @@ void VM_Compile( vm_t *vm, vmHeader_t *header ) {
// go back over it in place now to fixup reletive jump targets
buf = (unsigned *)vm->codeBase;
} else if ( pass == 1 ) {
- #ifdef MACOS_X
- // On Mac OS X, the following library routine clears the instruction cache for generated code
- MakeDataExecutable(vm->codeBase, vm->codeLength);
- #else
- #warning Need to clear the instruction cache for generated code
- #endif
+ // clear the instruction cache for generated code
+ msync(vm->codeBase, vm->codeLength, MS_INVALIDATE);
}
}
if(0)
diff --git a/src/unix/unix_main.c b/src/unix/unix_main.c
index e399140c..86d97a1d 100644
--- a/src/unix/unix_main.c
+++ b/src/unix/unix_main.c
@@ -73,7 +73,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#if idppc_altivec
#ifdef MACOS_X
- #include <Carbon/Carbon.h>
+ #include <sys/sysctl.h>
#endif
#endif
@@ -384,11 +384,13 @@ qboolean Sys_DetectAltivec( void )
#if idppc_altivec
#ifdef MACOS_X
- long feat = 0;
- OSErr err = Gestalt(gestaltPowerPCProcessorFeatures, &feat);
- if ((err==noErr) && ((1 << gestaltPowerPCHasVectorInstructions) & feat)) {
- altivec = qtrue;
- }
+ int selectors[2] = { CTL_HW, HW_VECTORUNIT };
+ int hasVectorUnit = 0;
+ size_t length = sizeof(hasVectorUnit);
+ int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
+
+ if( 0 == error )
+ altivec = (hasVectorUnit != 0);
#else
void (*handler)(int sig);
handler = signal(SIGILL, illegal_instruction);
diff --git a/src/unix/unix_net.c b/src/unix/unix_net.c
index 31d27c8d..86706673 100644
--- a/src/unix/unix_net.c
+++ b/src/unix/unix_net.c
@@ -383,8 +383,6 @@ void NET_GetLocalAddress( void ) {
int interfaceSocket;
int family;
- Com_Printf("NET_GetLocalAddress: Querying for network interfaces\n");
-
// Set this early so we can just return if there is an error
numIP = 0;
@@ -406,7 +404,6 @@ void NET_GetLocalAddress( void ) {
return;
}
-
linkInterface = (struct ifreq *) ifc.ifc_buf;
while ((char *) linkInterface < &ifc.ifc_buf[ifc.ifc_len]) {
unsigned int nameLength;
@@ -470,7 +467,6 @@ void NET_GetLocalAddress( void ) {
}
linkInterface = IFR_NEXT(linkInterface);
}
- Com_Printf("NET_GetLocalAddress: DONE querying for network interfaces\n");
close(interfaceSocket);
}