From 124eb6e58f2e96ee0d10da77045c4ec5a45e811b Mon Sep 17 00:00:00 2001 From: eviltypeguy Date: Fri, 3 Jun 2005 03:20:59 +0000 Subject: [PATCH] Changes necessary to build and run on Solaris 10 x86 git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5383 d7cf8633-e32d-0410-b094-e92efae38249 --- common.h | 21 +++++++++++++++++++-- makefile | 23 +++++++++++++++++++++++ makefile.inc | 21 ++++++++++++++++++--- 3 files changed, 60 insertions(+), 5 deletions(-) diff --git a/common.h b/common.h index 4cc520e3..599495c6 100644 --- a/common.h +++ b/common.h @@ -33,6 +33,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # define MACOSX #endif +// Create our own define for Solaris +#if defined(__sun__) && defined(__svr4__) +# define SUNOS +#endif + +#ifdef SUNOS +# define FNDELAY O_NDELAY // FNDELAY's equivalent on SunOS is O_NDELAY +# define model_t dp_model_t // Workaround conflict with /usr/include/sys/model.h +#endif //============================================================================ @@ -76,8 +85,16 @@ unsigned short CRC_Block(const qbyte *data, int size); # if defined(WIN32) # define BYTE_ORDER LITTLE_ENDIAN # else -# warning "Unable to determine the CPU endianess. Defaulting to little endian" -# define BYTE_ORDER LITTLE_ENDIAN +# if defined(SUNOS) +# if defined(__i386) || defined(__amd64) +# define BYTE_ORDER LITTLE_ENDIAN +# else +# define BYTE_ORDER BIG_ENDIAN +# endif +# else +# warning "Unable to determine the CPU endianess. Defaulting to little endian" +# define BYTE_ORDER LITTLE_ENDIAN +# endif # endif #endif diff --git a/makefile b/makefile index 62d13e4e..f4c054ab 100644 --- a/makefile +++ b/makefile @@ -14,9 +14,13 @@ ifneq ($(filter %BSD,$(DP_ARCH)),) else ifeq ($(DP_ARCH), Darwin) DP_MAKE_TARGET=macosx +else +ifeq ($(DP_ARCH), SunOS) + DP_MAKE_TARGET=sunos else DP_MAKE_TARGET=linux +endif # ifeq ($(DP_ARCH), SunOS) endif # ifeq ($(DP_ARCH), Darwin) endif # ifneq ($(filter %BSD,$(DP_ARCH)),) endif # ifdef windir @@ -78,6 +82,25 @@ ifeq ($(DP_MAKE_TARGET), macosx) EXE_SDL=$(EXE_UNIXSDL) endif +# SunOS configuration (Solaris) +ifeq ($(DP_MAKE_TARGET), sunos) + OBJ_SOUND=$(OBJ_SUNOSSOUND) + LIB_SOUND=$(LIB_SUNOSSOUND) + OBJ_CD=$(OBJ_SUNOSCD) + + OBJ_CL=$(OBJ_GLX) + + CFLAGS_EXTRA=$(CFLAGS_SUNOS) + + LDFLAGS_CL=$(LDFLAGS_SUNOSCL) + LDFLAGS_SV=$(LDFLAGS_SUNOSSV) + LDFLAGS_SDL=$(LDFLAGS_SUNOSSDL) + + EXE_CL=$(EXE_UNIXCL) + EXE_SV=$(EXE_UNIXSV) + EXE_SDL=$(EXE_UNIXSDL) +endif + # BSD configuration ifeq ($(DP_MAKE_TARGET), bsd) ifeq ($(DP_ARCH),FreeBSD) diff --git a/makefile.inc b/makefile.inc index 31055a99..37fe9225 100644 --- a/makefile.inc +++ b/makefile.inc @@ -186,6 +186,21 @@ LDFLAGS_MACOSXSDL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXSDL) OBJ_AGL= builddate.c sys_linux.o vid_agl.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON) +##### SunOS specific variables ##### + +OBJ_SUNOSSOUND=$(OBJ_OSSSOUND) +LIB_SUNOSSOUND=$(LIB_OSSSOUND) + +# No CD support available +OBJ_SUNOSCD=$(OBJ_NOCD) + +CFLAGS_SUNOS=-I/usr/lib/oss/include -DBSD_COMP + +# Link +LDFLAGS_SUNOSCL=$(LDFLAGS_UNIXCOMMON) -ldl -lsocket -lnsl $(LDFLAGS_UNIXCL) +LDFLAGS_SUNOSSV=$(LDFLAGS_UNIXCOMMON) -ldl -lsocket -lnsl +LDFLAGS_SUNOSSDL=$(LDFLAGS_UNIXCOMMON) -ldl -lsocket -lnsl $(LDFLAGS_UNIXSDL) + ##### BSD specific variables ##### @@ -303,21 +318,21 @@ bin-debug : @echo @echo "========== $(EXE) (debug) ==========" $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \ - CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)"\ + CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)"\ LDFLAGS="$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)" bin-profile : @echo @echo "========== $(EXE) (profile) ==========" $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \ - CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)"\ + CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)"\ LDFLAGS="$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)" bin-release : @echo @echo "========== $(EXE) (release) ==========" $(MAKE) $(EXE) DP_MAKE_TARGET=$(DP_MAKE_TARGET) \ - CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)"\ + CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)"\ LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)" strip $(EXE) -- 2.39.2