mirror of
https://github.com/UberGames/ioef.git
synced 2024-11-24 05:01:40 +00:00
* Split off q_platform.h from q_shared.h
* Removed lcc PATH hack and replaced with something slightly less hacky * Removed all platform specific hostfiles from lcc and replaced with bytecode.c (from ankon) * Turned lcc option "-S" on permanently * Improved q3cpp so that it recursively adds include dirs to its list
This commit is contained in:
parent
48683c91a8
commit
87cd6f8a93
15 changed files with 452 additions and 715 deletions
326
code/qcommon/q_platform.h
Normal file
326
code/qcommon/q_platform.h
Normal file
|
@ -0,0 +1,326 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//
|
||||
#ifndef __Q_PLATFORM_H
|
||||
#define __Q_PLATFORM_H
|
||||
|
||||
// this is the define for determining if we have an asm version of a C function
|
||||
#if (defined _M_IX86 || defined __i386__) && !defined __sun && !defined Q3_VM
|
||||
#define id386 1
|
||||
#else
|
||||
#define id386 0
|
||||
#endif
|
||||
|
||||
#if (defined(powerc) || defined(powerpc) || defined(ppc) || defined(__ppc) || defined(__ppc__)) && !defined(C_ONLY)
|
||||
#define idppc 1
|
||||
#if defined(__VEC__)
|
||||
#define idppc_altivec 1
|
||||
#else
|
||||
#define idppc_altivec 0
|
||||
#endif
|
||||
#else
|
||||
#define idppc 0
|
||||
#define idppc_altivec 0
|
||||
#endif
|
||||
|
||||
// for windows fastcall option
|
||||
|
||||
#define QDECL
|
||||
|
||||
short ShortSwap (short l);
|
||||
int LongSwap (int l);
|
||||
float FloatSwap (const float *f);
|
||||
|
||||
//======================= WIN32 DEFINES =================================
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#undef QDECL
|
||||
#define QDECL __cdecl
|
||||
|
||||
// buildstring will be incorporated into the version string
|
||||
#ifdef _MSC_VER
|
||||
#ifdef NDEBUG
|
||||
#ifdef _M_IX86
|
||||
#define CPUSTRING "win-x86"
|
||||
#elif defined _M_ALPHA
|
||||
#define CPUSTRING "win-AXP"
|
||||
#endif
|
||||
#else
|
||||
#ifdef _M_IX86
|
||||
#define CPUSTRING "win-x86-debug"
|
||||
#elif defined _M_ALPHA
|
||||
#define CPUSTRING "win-AXP-debug"
|
||||
#endif
|
||||
#endif
|
||||
#elif defined __MINGW32__
|
||||
#ifdef NDEBUG
|
||||
#ifdef __i386__
|
||||
#define CPUSTRING "mingw-x86"
|
||||
#endif
|
||||
#else
|
||||
#ifdef __i386__
|
||||
#define CPUSTRING "mingw-x86-debug"
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define ID_INLINE __inline
|
||||
|
||||
static ID_INLINE short BigShort( short l) { return ShortSwap(l); }
|
||||
#define LittleShort
|
||||
static ID_INLINE int BigLong(int l) { return LongSwap(l); }
|
||||
#define LittleLong
|
||||
static ID_INLINE float BigFloat(const float l) { return FloatSwap(&l); }
|
||||
#define LittleFloat
|
||||
|
||||
#define PATH_SEP '\\'
|
||||
|
||||
#endif
|
||||
|
||||
//======================= MAC OS X DEFINES =====================
|
||||
|
||||
#if defined(MACOS_X)
|
||||
|
||||
#define __cdecl
|
||||
#define __declspec(x)
|
||||
#define stricmp strcasecmp
|
||||
#define ID_INLINE inline
|
||||
|
||||
#ifdef __ppc__
|
||||
#define CPUSTRING "MacOSX-ppc"
|
||||
#elif defined __i386__
|
||||
#define CPUSTRING "MacOSX-i386"
|
||||
#else
|
||||
#define CPUSTRING "MacOSX-other"
|
||||
#endif
|
||||
|
||||
#define PATH_SEP '/'
|
||||
|
||||
#define __rlwimi(out, in, shift, maskBegin, maskEnd) \
|
||||
asm("rlwimi %0,%1,%2,%3,%4" : "=r" (out) : "r" (in), \
|
||||
"i" (shift), "i" (maskBegin), "i" (maskEnd))
|
||||
#define __dcbt(addr, offset) asm("dcbt %0,%1" : : "b" (addr), "r" (offset))
|
||||
|
||||
static inline unsigned int __lwbrx(register void *addr, register int offset) {
|
||||
register unsigned int word;
|
||||
|
||||
asm("lwbrx %0,%2,%1" : "=r" (word) : "r" (addr), "b" (offset));
|
||||
return word;
|
||||
}
|
||||
|
||||
static inline unsigned short __lhbrx(register void *addr, register int offset) {
|
||||
register unsigned short halfword;
|
||||
|
||||
asm("lhbrx %0,%2,%1" : "=r" (halfword) : "r" (addr), "b" (offset));
|
||||
return halfword;
|
||||
}
|
||||
|
||||
static inline float __fctiw(register float f) {
|
||||
register float fi;
|
||||
|
||||
asm("fctiw %0,%1" : "=f" (fi) : "f" (f));
|
||||
|
||||
return fi;
|
||||
}
|
||||
|
||||
#define BigShort
|
||||
static inline short LittleShort(short l) { return ShortSwap(l); }
|
||||
#define BigLong
|
||||
static inline int LittleLong (int l) { return LongSwap(l); }
|
||||
#define BigFloat
|
||||
static inline float LittleFloat (const float l) { return FloatSwap(&l); }
|
||||
|
||||
#endif
|
||||
|
||||
//======================= MAC DEFINES =================================
|
||||
|
||||
#ifdef __MACOS__
|
||||
|
||||
#include <MacTypes.h>
|
||||
#define ID_INLINE inline
|
||||
|
||||
#define CPUSTRING "MacOS-PPC"
|
||||
|
||||
#define PATH_SEP ':'
|
||||
|
||||
void Sys_PumpEvents( void );
|
||||
|
||||
#define BigShort
|
||||
static inline short LittleShort(short l) { return ShortSwap(l); }
|
||||
#define BigLong
|
||||
static inline int LittleLong (int l) { return LongSwap(l); }
|
||||
#define BigFloat
|
||||
static inline float LittleFloat (const float l) { return FloatSwap(&l); }
|
||||
|
||||
#endif
|
||||
|
||||
//======================= LINUX DEFINES =================================
|
||||
|
||||
// the mac compiler can't handle >32k of locals, so we
|
||||
// just waste space and make big arrays static...
|
||||
#ifdef __linux__
|
||||
|
||||
// bk001205 - from Makefile
|
||||
#define stricmp strcasecmp
|
||||
|
||||
#define ID_INLINE inline
|
||||
|
||||
#ifdef __i386__
|
||||
#define CPUSTRING "linux-i386"
|
||||
#elif defined __axp__
|
||||
#define CPUSTRING "linux-alpha"
|
||||
#elif defined __x86_64__
|
||||
#define CPUSTRING "linux-x86_64"
|
||||
#elif defined __powerpc64__
|
||||
#define CPUSTRING "linux-ppc64"
|
||||
#elif defined __powerpc__
|
||||
#define CPUSTRING "linux-ppc"
|
||||
#elif defined __s390__
|
||||
#define CPUSTRING "linux-s390"
|
||||
#elif defined __s390x__
|
||||
#define CPUSTRING "linux-s390x"
|
||||
#elif defined __ia64__
|
||||
#define CPUSTRING "linux-ia64"
|
||||
#else
|
||||
#define CPUSTRING "linux-other"
|
||||
#endif
|
||||
|
||||
#define PATH_SEP '/'
|
||||
|
||||
#if __FLOAT_WORD_ORDER == __LITTLE_ENDIAN
|
||||
inline static short BigShort( short l) { return ShortSwap(l); }
|
||||
#define LittleShort
|
||||
inline static int BigLong(int l) { return LongSwap(l); }
|
||||
#define LittleLong
|
||||
inline static float BigFloat(const float l) { return FloatSwap(&l); }
|
||||
#define LittleFloat
|
||||
#else
|
||||
#define BigShort
|
||||
inline static short LittleShort(short l) { return ShortSwap(l); }
|
||||
#define BigLong
|
||||
inline static int LittleLong (int l) { return LongSwap(l); }
|
||||
#define BigFloat
|
||||
inline static float LittleFloat (const float l) { return FloatSwap(&l); }
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//======================= FreeBSD DEFINES =====================
|
||||
#ifdef __FreeBSD__ // rb010123
|
||||
|
||||
#define stricmp strcasecmp
|
||||
|
||||
#define ID_INLINE inline
|
||||
|
||||
#ifdef __i386__
|
||||
#define CPUSTRING "freebsd-i386"
|
||||
#elif defined __axp__
|
||||
#define CPUSTRING "freebsd-alpha"
|
||||
#else
|
||||
#define CPUSTRING "freebsd-other"
|
||||
#endif
|
||||
|
||||
#define PATH_SEP '/'
|
||||
|
||||
#if !idppc
|
||||
static short BigShort( short l) { return ShortSwap(l); }
|
||||
#define LittleShort
|
||||
static int BigLong(int l) { return LongSwap(l); }
|
||||
#define LittleLong
|
||||
static float BigFloat(const float l) { return FloatSwap(&l); }
|
||||
#define LittleFloat
|
||||
#else
|
||||
#define BigShort
|
||||
static short LittleShort(short l) { return ShortSwap(l); }
|
||||
#define BigLong
|
||||
static int LittleLong (int l) { return LongSwap(l); }
|
||||
#define BigFloat
|
||||
static float LittleFloat (const float l) { return FloatSwap(&l); }
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//======================= SUNOS DEFINES =================================
|
||||
|
||||
#ifdef __sun
|
||||
|
||||
#include <sys/isa_defs.h>
|
||||
#include <sys/byteorder.h>
|
||||
|
||||
// bk001205 - from Makefile
|
||||
#define stricmp strcasecmp
|
||||
|
||||
#define ID_INLINE inline
|
||||
|
||||
#ifdef __i386__
|
||||
#define CPUSTRING "Solaris-i386"
|
||||
#elif defined __sparc
|
||||
#define CPUSTRING "Solaris-sparc"
|
||||
#endif
|
||||
|
||||
#define PATH_SEP '/'
|
||||
|
||||
#if defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
|
||||
#define BigShort
|
||||
inline static short LittleShort(short l) { return ShortSwap(l); }
|
||||
#define BigLong
|
||||
inline static int LittleLong (int l) { return LongSwap(l); }
|
||||
#define BigFloat
|
||||
inline static float LittleFloat (const float l) { return FloatSwap(&l); }
|
||||
|
||||
#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
|
||||
inline static short BigShort( short l) { return ShortSwap(l); }
|
||||
#define LittleShort
|
||||
inline static int BigLong(int l) { return LongSwap(l); }
|
||||
#define LittleLong
|
||||
inline static float BigFloat(const float l) { return FloatSwap(&l); }
|
||||
#define LittleFloat
|
||||
|
||||
#else
|
||||
#error "Either _BIG_ENDIAN or _LITTLE_ENDIAN must be #defined, but not both."
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef Q3_VM
|
||||
|
||||
//catch missing defines in above blocks
|
||||
#ifndef CPUSTRING
|
||||
#error "CPUSTRING not defined"
|
||||
#endif
|
||||
|
||||
#ifndef ID_INLINE
|
||||
#error "ID_INLINE not defined"
|
||||
#endif
|
||||
|
||||
#ifndef PATH_SEP
|
||||
#error "PATH_SEP not defined"
|
||||
#endif
|
||||
|
||||
#if !defined(BigLong) && !defined(LittleLong)
|
||||
#error "Endianness not defined"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -54,6 +54,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#pragma warning(disable : 4702) // unreachable code
|
||||
#pragma warning(disable : 4711) // selected for automatic inline expansion
|
||||
#pragma warning(disable : 4220) // varargs matches remaining parameters
|
||||
//#pragma intrinsic( memset, memcpy )
|
||||
#endif
|
||||
|
||||
//Ignore __attribute__ on non-gcc platforms
|
||||
|
@ -81,7 +82,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
#ifdef Q3_VM
|
||||
|
||||
#include "bg_lib.h"
|
||||
#include "../game/bg_lib.h"
|
||||
|
||||
#else
|
||||
|
||||
|
@ -97,291 +98,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
//#pragma intrinsic( memset, memcpy )
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// this is the define for determining if we have an asm version of a C function
|
||||
#if (defined _M_IX86 || defined __i386__) && !defined __sun && !defined Q3_VM
|
||||
#define id386 1
|
||||
#else
|
||||
#define id386 0
|
||||
#endif
|
||||
|
||||
#if (defined(powerc) || defined(powerpc) || defined(ppc) || defined(__ppc) || defined(__ppc__)) && !defined(C_ONLY)
|
||||
#define idppc 1
|
||||
#if defined(__VEC__)
|
||||
#define idppc_altivec 1
|
||||
#else
|
||||
#define idppc_altivec 0
|
||||
#endif
|
||||
#else
|
||||
#define idppc 0
|
||||
#define idppc_altivec 0
|
||||
#endif
|
||||
|
||||
// for windows fastcall option
|
||||
|
||||
#define QDECL
|
||||
|
||||
short ShortSwap (short l);
|
||||
int LongSwap (int l);
|
||||
float FloatSwap (const float *f);
|
||||
|
||||
//======================= WIN32 DEFINES =================================
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#undef QDECL
|
||||
#define QDECL __cdecl
|
||||
|
||||
// buildstring will be incorporated into the version string
|
||||
#ifdef _MSC_VER
|
||||
#ifdef NDEBUG
|
||||
#ifdef _M_IX86
|
||||
#define CPUSTRING "win-x86"
|
||||
#elif defined _M_ALPHA
|
||||
#define CPUSTRING "win-AXP"
|
||||
#endif
|
||||
#else
|
||||
#ifdef _M_IX86
|
||||
#define CPUSTRING "win-x86-debug"
|
||||
#elif defined _M_ALPHA
|
||||
#define CPUSTRING "win-AXP-debug"
|
||||
#endif
|
||||
#endif
|
||||
#elif defined __MINGW32__
|
||||
#ifdef NDEBUG
|
||||
#ifdef __i386__
|
||||
#define CPUSTRING "mingw-x86"
|
||||
#endif
|
||||
#else
|
||||
#ifdef __i386__
|
||||
#define CPUSTRING "mingw-x86-debug"
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define ID_INLINE __inline
|
||||
|
||||
static ID_INLINE short BigShort( short l) { return ShortSwap(l); }
|
||||
#define LittleShort
|
||||
static ID_INLINE int BigLong(int l) { return LongSwap(l); }
|
||||
#define LittleLong
|
||||
static ID_INLINE float BigFloat(const float l) { return FloatSwap(&l); }
|
||||
#define LittleFloat
|
||||
|
||||
#define PATH_SEP '\\'
|
||||
|
||||
#endif
|
||||
|
||||
//======================= MAC OS X DEFINES =====================
|
||||
|
||||
#if defined(MACOS_X)
|
||||
|
||||
#define __cdecl
|
||||
#define __declspec(x)
|
||||
#define stricmp strcasecmp
|
||||
#define ID_INLINE inline
|
||||
|
||||
#ifdef __ppc__
|
||||
#define CPUSTRING "MacOSX-ppc"
|
||||
#elif defined __i386__
|
||||
#define CPUSTRING "MacOSX-i386"
|
||||
#else
|
||||
#define CPUSTRING "MacOSX-other"
|
||||
#endif
|
||||
|
||||
#define PATH_SEP '/'
|
||||
|
||||
#define __rlwimi(out, in, shift, maskBegin, maskEnd) asm("rlwimi %0,%1,%2,%3,%4" : "=r" (out) : "r" (in), "i" (shift), "i" (maskBegin), "i" (maskEnd))
|
||||
#define __dcbt(addr, offset) asm("dcbt %0,%1" : : "b" (addr), "r" (offset))
|
||||
|
||||
static inline unsigned int __lwbrx(register void *addr, register int offset) {
|
||||
register unsigned int word;
|
||||
|
||||
asm("lwbrx %0,%2,%1" : "=r" (word) : "r" (addr), "b" (offset));
|
||||
return word;
|
||||
}
|
||||
|
||||
static inline unsigned short __lhbrx(register void *addr, register int offset) {
|
||||
register unsigned short halfword;
|
||||
|
||||
asm("lhbrx %0,%2,%1" : "=r" (halfword) : "r" (addr), "b" (offset));
|
||||
return halfword;
|
||||
}
|
||||
|
||||
static inline float __fctiw(register float f) {
|
||||
register float fi;
|
||||
|
||||
asm("fctiw %0,%1" : "=f" (fi) : "f" (f));
|
||||
|
||||
return fi;
|
||||
}
|
||||
|
||||
#define BigShort
|
||||
static inline short LittleShort(short l) { return ShortSwap(l); }
|
||||
#define BigLong
|
||||
static inline int LittleLong (int l) { return LongSwap(l); }
|
||||
#define BigFloat
|
||||
static inline float LittleFloat (const float l) { return FloatSwap(&l); }
|
||||
|
||||
#endif
|
||||
|
||||
//======================= MAC DEFINES =================================
|
||||
|
||||
#ifdef __MACOS__
|
||||
|
||||
#include <MacTypes.h>
|
||||
#define ID_INLINE inline
|
||||
|
||||
#define CPUSTRING "MacOS-PPC"
|
||||
|
||||
#define PATH_SEP ':'
|
||||
|
||||
void Sys_PumpEvents( void );
|
||||
|
||||
#define BigShort
|
||||
static inline short LittleShort(short l) { return ShortSwap(l); }
|
||||
#define BigLong
|
||||
static inline int LittleLong (int l) { return LongSwap(l); }
|
||||
#define BigFloat
|
||||
static inline float LittleFloat (const float l) { return FloatSwap(&l); }
|
||||
|
||||
#endif
|
||||
|
||||
//======================= LINUX DEFINES =================================
|
||||
|
||||
// the mac compiler can't handle >32k of locals, so we
|
||||
// just waste space and make big arrays static...
|
||||
#ifdef __linux__
|
||||
|
||||
// bk001205 - from Makefile
|
||||
#define stricmp strcasecmp
|
||||
|
||||
#define ID_INLINE inline
|
||||
|
||||
#ifdef __i386__
|
||||
#define CPUSTRING "linux-i386"
|
||||
#elif defined __axp__
|
||||
#define CPUSTRING "linux-alpha"
|
||||
#elif defined __x86_64__
|
||||
#define CPUSTRING "linux-x86_64"
|
||||
#elif defined __powerpc64__
|
||||
#define CPUSTRING "linux-ppc64"
|
||||
#elif defined __powerpc__
|
||||
#define CPUSTRING "linux-ppc"
|
||||
#elif defined __s390__
|
||||
#define CPUSTRING "linux-s390"
|
||||
#elif defined __s390x__
|
||||
#define CPUSTRING "linux-s390x"
|
||||
#elif defined __ia64__
|
||||
#define CPUSTRING "linux-ia64"
|
||||
#else
|
||||
#define CPUSTRING "linux-other"
|
||||
#endif
|
||||
|
||||
#define PATH_SEP '/'
|
||||
|
||||
#if __FLOAT_WORD_ORDER == __LITTLE_ENDIAN
|
||||
inline static short BigShort( short l) { return ShortSwap(l); }
|
||||
#define LittleShort
|
||||
inline static int BigLong(int l) { return LongSwap(l); }
|
||||
#define LittleLong
|
||||
inline static float BigFloat(const float l) { return FloatSwap(&l); }
|
||||
#define LittleFloat
|
||||
#else
|
||||
#define BigShort
|
||||
inline static short LittleShort(short l) { return ShortSwap(l); }
|
||||
#define BigLong
|
||||
inline static int LittleLong (int l) { return LongSwap(l); }
|
||||
#define BigFloat
|
||||
inline static float LittleFloat (const float l) { return FloatSwap(&l); }
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//======================= FreeBSD DEFINES =====================
|
||||
#ifdef __FreeBSD__ // rb010123
|
||||
|
||||
#define stricmp strcasecmp
|
||||
|
||||
#define ID_INLINE inline
|
||||
|
||||
#ifdef __i386__
|
||||
#define CPUSTRING "freebsd-i386"
|
||||
#elif defined __axp__
|
||||
#define CPUSTRING "freebsd-alpha"
|
||||
#else
|
||||
#define CPUSTRING "freebsd-other"
|
||||
#endif
|
||||
|
||||
#define PATH_SEP '/'
|
||||
|
||||
// bk010116 - omitted Q3STATIC (see Linux above), broken target
|
||||
|
||||
#if !idppc
|
||||
static short BigShort( short l) { return ShortSwap(l); }
|
||||
#define LittleShort
|
||||
static int BigLong(int l) { return LongSwap(l); }
|
||||
#define LittleLong
|
||||
static float BigFloat(const float l) { return FloatSwap(&l); }
|
||||
#define LittleFloat
|
||||
#else
|
||||
#define BigShort
|
||||
static short LittleShort(short l) { return ShortSwap(l); }
|
||||
#define BigLong
|
||||
static int LittleLong (int l) { return LongSwap(l); }
|
||||
#define BigFloat
|
||||
static float LittleFloat (const float l) { return FloatSwap(&l); }
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//======================= SUNOS DEFINES =================================
|
||||
|
||||
#ifdef __sun
|
||||
|
||||
#include <sys/isa_defs.h>
|
||||
#include <sys/byteorder.h>
|
||||
|
||||
// bk001205 - from Makefile
|
||||
#define stricmp strcasecmp
|
||||
|
||||
#define ID_INLINE inline
|
||||
|
||||
#ifdef __i386__
|
||||
#define CPUSTRING "Solaris-i386"
|
||||
#elif defined __sparc
|
||||
#define CPUSTRING "Solaris-sparc"
|
||||
#endif
|
||||
|
||||
#define PATH_SEP '/'
|
||||
|
||||
#if defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
|
||||
#define BigShort
|
||||
inline static short LittleShort(short l) { return ShortSwap(l); }
|
||||
#define BigLong
|
||||
inline static int LittleLong (int l) { return LongSwap(l); }
|
||||
#define BigFloat
|
||||
inline static float LittleFloat (const float l) { return FloatSwap(&l); }
|
||||
|
||||
#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
|
||||
inline static short BigShort( short l) { return ShortSwap(l); }
|
||||
#define LittleShort
|
||||
inline static int BigLong(int l) { return LongSwap(l); }
|
||||
#define LittleLong
|
||||
inline static float BigFloat(const float l) { return FloatSwap(&l); }
|
||||
#define LittleFloat
|
||||
|
||||
#else
|
||||
#error "Either _BIG_ENDIAN or _LITTLE_ENDIAN must be #defined, but not both."
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#include "q_platform.h"
|
||||
|
||||
//=============================================================
|
||||
|
||||
|
|
|
@ -108,6 +108,7 @@ void control(Tokenrow *);
|
|||
void dodefine(Tokenrow *);
|
||||
void doadefine(Tokenrow *, int);
|
||||
void doinclude(Tokenrow *);
|
||||
void appendDirToIncludeList( char *dir );
|
||||
void doif(Tokenrow *, enum kwtype);
|
||||
void expand(Tokenrow *, Nlist *);
|
||||
void builtin(Tokenrow *, int);
|
||||
|
@ -140,6 +141,8 @@ void iniths(void);
|
|||
void setobjname(char *);
|
||||
#define rowlen(tokrow) ((tokrow)->lp - (tokrow)->bp)
|
||||
|
||||
char *basepath( char *fname );
|
||||
|
||||
extern char *outp;
|
||||
extern Token nltoken;
|
||||
extern Source *cursource;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "cpp.h"
|
||||
|
@ -6,6 +7,29 @@ Includelist includelist[NINCLUDE];
|
|||
|
||||
extern char *objname;
|
||||
|
||||
void appendDirToIncludeList( char *dir )
|
||||
{
|
||||
int i;
|
||||
|
||||
//avoid adding it more than once
|
||||
for (i=NINCLUDE-2; i>=0; i--) {
|
||||
if (includelist[i].file &&
|
||||
!strcmp (includelist[i].file, dir)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (i=NINCLUDE-2; i>=0; i--) {
|
||||
if (includelist[i].file==NULL) {
|
||||
includelist[i].always = 1;
|
||||
includelist[i].file = dir;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i<0)
|
||||
error(FATAL, "Too many -I directives");
|
||||
}
|
||||
|
||||
void
|
||||
doinclude(Tokenrow *trp)
|
||||
{
|
||||
|
@ -44,6 +68,9 @@ doinclude(Tokenrow *trp)
|
|||
if (trp->tp < trp->lp || len==0)
|
||||
goto syntax;
|
||||
fname[len] = '\0';
|
||||
|
||||
appendDirToIncludeList( basepath( fname ) );
|
||||
|
||||
if (fname[0]=='/') {
|
||||
fd = open(fname, 0);
|
||||
strcpy(iname, fname);
|
||||
|
|
|
@ -29,15 +29,7 @@ setup(int argc, char **argv)
|
|||
includelist[i].deleted = 1;
|
||||
break;
|
||||
case 'I':
|
||||
for (i=NINCLUDE-2; i>=0; i--) {
|
||||
if (includelist[i].file==NULL) {
|
||||
includelist[i].always = 1;
|
||||
includelist[i].file = optarg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i<0)
|
||||
error(FATAL, "Too many -I directives");
|
||||
appendDirToIncludeList( optarg );
|
||||
break;
|
||||
case 'D':
|
||||
case 'U':
|
||||
|
@ -66,11 +58,7 @@ setup(int argc, char **argv)
|
|||
fp = "<stdin>";
|
||||
fd = 0;
|
||||
if (optind<argc) {
|
||||
if ((fp = strrchr(argv[optind], '/')) != NULL) {
|
||||
int len = fp - argv[optind];
|
||||
dp = (char*)newstring((uchar*)argv[optind], len+1, 0);
|
||||
dp[len] = '\0';
|
||||
}
|
||||
dp = basepath( argv[optind] );
|
||||
fp = (char*)newstring((uchar*)argv[optind], strlen(argv[optind]), 0);
|
||||
if ((fd = open(fp, 0)) <= 0)
|
||||
error(FATAL, "Can't open input file %s", fp);
|
||||
|
@ -89,6 +77,18 @@ setup(int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
char *basepath( char *fname )
|
||||
{
|
||||
char *dp = ".";
|
||||
char *p;
|
||||
if ((p = strrchr(fname, '/')) != NULL) {
|
||||
int dlen = p - fname;
|
||||
dp = (char*)newstring((uchar*)fname, dlen+1, 0);
|
||||
dp[dlen] = '\0';
|
||||
}
|
||||
|
||||
return dp;
|
||||
}
|
||||
|
||||
/* memmove is defined here because some vendors don't provide it at
|
||||
all and others do a terrible job (like calling malloc) */
|
||||
|
|
66
code/tools/lcc/etc/bytecode.c
Normal file
66
code/tools/lcc/etc/bytecode.c
Normal file
|
@ -0,0 +1,66 @@
|
|||
/* quake3 bytecode target */
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "../../../qcommon/q_platform.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define BINEXT ".exe"
|
||||
#else
|
||||
#define BINEXT ""
|
||||
#endif
|
||||
|
||||
char *suffixes[] = { ".c", ".i", ".asm", ".o", ".out", 0 };
|
||||
char inputs[256] = "";
|
||||
char *cpp[] = { "q3cpp" BINEXT,
|
||||
"-D__STDC__=1", "-D__STRICT_ANSI__", "-D__signed__=signed", "-DQ3_VM",
|
||||
"$1", "$2", "$3", 0 };
|
||||
char *include[] = { 0 };
|
||||
char *com[] = { "q3rcc" BINEXT, "-target=bytecode", "$1", "$2", "$3", 0 };
|
||||
char *ld[] = { 0 };
|
||||
char *as[] = { 0 };
|
||||
|
||||
extern char *concat(char *, char *);
|
||||
|
||||
/*
|
||||
===============
|
||||
UpdatePaths
|
||||
|
||||
Updates the paths to q3cpp and q3rcc based on
|
||||
the directory that contains q3lcc
|
||||
===============
|
||||
*/
|
||||
void UpdatePaths( const char *lccBinary )
|
||||
{
|
||||
char basepath[ 1024 ];
|
||||
char *p;
|
||||
|
||||
strncpy( basepath, lccBinary, 1024 );
|
||||
p = strrchr( basepath, PATH_SEP );
|
||||
|
||||
if( p )
|
||||
{
|
||||
*( p + 1 ) = '\0';
|
||||
|
||||
cpp[ 0 ] = concat( basepath, "q3cpp" BINEXT );
|
||||
com[ 0 ] = concat( basepath, "q3rcc" BINEXT );
|
||||
}
|
||||
}
|
||||
|
||||
int option(char *arg) {
|
||||
if (strncmp(arg, "-lccdir=", 8) == 0) {
|
||||
cpp[0] = concat(&arg[8], "/q3cpp" BINEXT);
|
||||
include[0] = concat("-I", concat(&arg[8], "/include"));
|
||||
com[0] = concat(&arg[8], "/q3rcc" BINEXT);
|
||||
} else if (strcmp(arg, "-p") == 0 || strcmp(arg, "-pg") == 0) {
|
||||
fprintf( stderr, "no profiling supported, %s ignored.\n", arg);
|
||||
} else if (strcmp(arg, "-b") == 0)
|
||||
;
|
||||
else if (strcmp(arg, "-g") == 0)
|
||||
fprintf( stderr, "no debugging supported, %s ignored.\n", arg);
|
||||
else if (strncmp(arg, "-ld=", 4) == 0 || strcmp(arg, "-static") == 0) {
|
||||
fprintf( stderr, "no linking supported, %s ignored.\n", arg);
|
||||
} else
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
/* Solaris with GNU Compilers */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
TTimo - 10-18-2001
|
||||
our binaries are named q3lcc q3rcc and q3cpp
|
||||
removed hardcoded paths
|
||||
removed __linux__ preprocessor define (confuses the preprocessor, we are doing bytecode!)
|
||||
*/
|
||||
|
||||
#ifndef LCCDIR
|
||||
#define LCCDIR ""
|
||||
//#define LCCDIR "/usr/local/lib/lcc/"
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define BINEXT ".exe"
|
||||
#else
|
||||
#define BINEXT ""
|
||||
#endif
|
||||
|
||||
char *suffixes[] = { ".c", ".i", ".asm", ".o", ".out", 0 };
|
||||
char inputs[256] = "";
|
||||
// TTimo experimental: do not compile with the __linux__ define, we are doing bytecode!
|
||||
char *cpp[] = { LCCDIR "q3cpp" BINEXT,
|
||||
"-U__GNUC__", "-D_POSIX_SOURCE", "-D__STDC__=1", "-D__STRICT_ANSI__",
|
||||
"-Dunix", "-Di386", "-Dsun",
|
||||
"-D__unix__", "-D__i386__", "-D__signed__=signed",
|
||||
"$1", "$2", "$3", 0 };
|
||||
char *include[] = {"-I" LCCDIR "include", "-I" LCCDIR "gcc/include", "-I/usr/include",
|
||||
"-I" SYSTEM "include", 0 };
|
||||
char *com[] = {LCCDIR "q3rcc" BINEXT, "-target=bytecode", "$1", "$2", "$3", 0 };
|
||||
char *as[] = { "/usr/bin/as", "-o", "$3", "$1", "$2", 0 };
|
||||
// NOTE TTimo I don't think we have any use with the native linkage
|
||||
// our target is always bytecode..
|
||||
char *ld[] = {
|
||||
/* 0 */ "/usr/ccs/bin/ld", "-m", "elf_i386", "-dynamic-linker",
|
||||
/* 4 */ "/lib/ld-linux.so.2", "-o", "$3",
|
||||
/* 7 */ "/usr/lib/crt1.o", "/usr/lib/crti.o",
|
||||
/* 9 */ SYSTEM "crtbegin.o",
|
||||
"$1", "$2",
|
||||
/* 12 */ "-L" LCCDIR,
|
||||
/* 13 */ "-llcc",
|
||||
/* 14 */ "-L" LCCDIR "/gcc", "-lgcc", "-lc", "-lm",
|
||||
/* 18 */ "",
|
||||
/* 19 */ SYSTEM "crtend.o", "/usr/lib/crtn.o",
|
||||
/* 20 */ "-L" SYSTEM,
|
||||
0 };
|
||||
|
||||
extern char *concat(char *, char *);
|
||||
|
||||
int option(char *arg) {
|
||||
if (strncmp(arg, "-lccdir=", 8) == 0) {
|
||||
cpp[0] = concat(&arg[8], "/gcc/cpp");
|
||||
include[0] = concat("-I", concat(&arg[8], "/include"));
|
||||
include[1] = concat("-I", concat(&arg[8], "/gcc/include"));
|
||||
ld[9] = concat(&arg[8], "/gcc/crtbegin.o");
|
||||
ld[12] = concat("-L", &arg[8]);
|
||||
ld[14] = concat("-L", concat(&arg[8], "/gcc"));
|
||||
ld[19] = concat(&arg[8], "/gcc/crtend.o");
|
||||
com[0] = concat(&arg[8], "/rcc");
|
||||
} else if (strcmp(arg, "-p") == 0 || strcmp(arg, "-pg") == 0) {
|
||||
ld[7] = "/usr/lib/gcrt1.o";
|
||||
ld[18] = "-lgmon";
|
||||
} else if (strcmp(arg, "-b") == 0)
|
||||
;
|
||||
else if (strcmp(arg, "-g") == 0)
|
||||
;
|
||||
else if (strncmp(arg, "-ld=", 4) == 0)
|
||||
ld[0] = &arg[4];
|
||||
else if (strcmp(arg, "-static") == 0) {
|
||||
ld[3] = "-static";
|
||||
ld[4] = "";
|
||||
} else
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/* SGI big endian MIPSes running IRIX 5.2 at CS Dept., Princeton University */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#ifndef LCCDIR
|
||||
#define LCCDIR "/usr/local/lib/lcc/"
|
||||
#endif
|
||||
|
||||
char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 };
|
||||
char inputs[256] = "";
|
||||
char *cpp[] = { LCCDIR "cpp", "-D__STDC__=1",
|
||||
"-DLANGUAGE_C",
|
||||
"-DMIPSEB",
|
||||
"-DSYSTYPE_SVR4",
|
||||
"-D_CFE",
|
||||
"-D_LANGUAGE_C",
|
||||
"-D_MIPSEB",
|
||||
"-D_MIPS_FPSET=16",
|
||||
"-D_MIPS_ISA=_MIPS_ISA_MIPS1",
|
||||
"-D_MIPS_SIM=_MIPS_SIM_ABI32",
|
||||
"-D_MIPS_SZINT=32",
|
||||
"-D_MIPS_SZLONG=32",
|
||||
"-D_MIPS_SZPTR=32",
|
||||
"-D_SGI_SOURCE",
|
||||
"-D_SVR4_SOURCE",
|
||||
"-D_SYSTYPE_SVR4",
|
||||
"-D__host_mips",
|
||||
"-D__mips=1",
|
||||
"-D__sgi",
|
||||
"-D__unix",
|
||||
"-Dhost_mips",
|
||||
"-Dmips",
|
||||
"-Dsgi",
|
||||
"-Dunix",
|
||||
"$1", "$2", "$3", 0 };
|
||||
char *com[] = { LCCDIR "rcc", "-target=mips/irix", "$1", "$2", "$3", "", 0 };
|
||||
char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include",
|
||||
"-I/usr/include", 0 };
|
||||
char *as[] = { "/usr/bin/as", "-o", "$3", "$1", "-nocpp", "-KPIC", "$2", 0 };
|
||||
char *ld[] = { "/usr/bin/ld", "-require_dynamic_link", "_rld_new_interface",
|
||||
"-elf", "-_SYSTYPE_SVR4", "-Wx,-G", "0", "-g0", "-KPIC", "-dont_warn_unused",
|
||||
"-o", "$3", "/usr/lib/crt1.o", "-L/usr/local/lib",
|
||||
"$1", "$2", "", "-L" LCCDIR, "-llcc", "-lc", "-lm", "/usr/lib/crtn.o", 0
|
||||
};
|
||||
|
||||
extern char *concat(char *, char *);
|
||||
|
||||
int option(char *arg) {
|
||||
if (strncmp(arg, "-lccdir=", 8) == 0) {
|
||||
cpp[0] = concat(&arg[8], "/cpp");
|
||||
include[0] = concat("-I", concat(&arg[8], "/include"));
|
||||
com[0] = concat(&arg[8], "/rcc");
|
||||
ld[17] = concat("-L", &arg[8]);
|
||||
} else if (strcmp(arg, "-g") == 0)
|
||||
;
|
||||
else if (strcmp(arg, "-p") == 0)
|
||||
ld[12] = "/usr/lib/mcrt1.o";
|
||||
else if (strcmp(arg, "-b") == 0)
|
||||
;
|
||||
else
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
|
@ -25,7 +25,7 @@ struct list { /* circular list nodes: */
|
|||
|
||||
static void *alloc(int);
|
||||
static List append(char *,List);
|
||||
extern char *basepath(char *);
|
||||
extern char *basename(char *);
|
||||
static int callsys(char *[]);
|
||||
extern char *concat(char *, char *);
|
||||
static int compile(char *, char *);
|
||||
|
@ -57,7 +57,7 @@ extern int option(char *);
|
|||
|
||||
static int errcnt; /* number of errors */
|
||||
static int Eflag; /* -E specified */
|
||||
static int Sflag; /* -S specified */
|
||||
static int Sflag = 1; /* -S specified */ //for Q3 we always generate asm
|
||||
static int cflag; /* -c specified */
|
||||
static int verbose; /* incremented for each -v */
|
||||
static List llist[2]; /* loader files, flags */
|
||||
|
@ -73,49 +73,15 @@ char *tempdir = TEMPDIR; /* directory for temporary files */
|
|||
static char *progname;
|
||||
static List lccinputs; /* list of input directories */
|
||||
|
||||
/*
|
||||
===============
|
||||
AddLCCDirToPath
|
||||
|
||||
Append the base path of this file to the PATH so that q3lcc can find q3cpp and
|
||||
q3rcc in its own directory. There are probably (much) cleaner ways of doing
|
||||
this.
|
||||
Tim Angus <tim@ngus.net> 05/09/05
|
||||
===============
|
||||
*/
|
||||
void AddLCCDirToPath( const char *lccBinary )
|
||||
{
|
||||
char basepath[ 1024 ];
|
||||
char path[ 4096 ];
|
||||
char *p;
|
||||
|
||||
strncpy( basepath, lccBinary, 1024 );
|
||||
p = strrchr( basepath, '/' );
|
||||
if( !p )
|
||||
p = strrchr( basepath, '\\' );
|
||||
|
||||
if( p )
|
||||
{
|
||||
*p = '\0';
|
||||
#ifdef _WIN32
|
||||
strncpy( path, "PATH=", 4096 );
|
||||
strncat( path, ";", 4096 );
|
||||
strncat( path, basepath, 4096 );
|
||||
_putenv( path );
|
||||
#else
|
||||
/* Ugly workaround against execvp problem/limitation on Solaris 10 */
|
||||
snprintf( path, 4096, "PATH=%s:%s", basepath, getenv( "PATH" ) );
|
||||
putenv( path );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
extern void UpdatePaths( const char *lccBinary );
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int i, j, nf;
|
||||
|
||||
AddLCCDirToPath( argv[ 0 ] );
|
||||
|
||||
progname = argv[0];
|
||||
|
||||
UpdatePaths( progname );
|
||||
|
||||
ac = argc + 50;
|
||||
av = alloc(ac*sizeof(char *));
|
||||
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
|
||||
|
@ -233,8 +199,8 @@ static List append(char *str, List list) {
|
|||
return p;
|
||||
}
|
||||
|
||||
/* basepath - return base name for name, e.g. /usr/drh/foo.c => foo */
|
||||
char *basepath(char *name) {
|
||||
/* basename - return base name for name, e.g. /usr/drh/foo.c => foo */
|
||||
char *basename(char *name) {
|
||||
char *s, *b, *t = 0;
|
||||
|
||||
for (b = s = name; *s; s++)
|
||||
|
@ -437,7 +403,7 @@ static int filename(char *name, char *base) {
|
|||
static char *stemp, *itemp;
|
||||
|
||||
if (base == 0)
|
||||
base = basepath(name);
|
||||
base = basename(name);
|
||||
switch (suffix(name, suffixes, 4)) {
|
||||
case 0: /* C source files */
|
||||
compose(cpp, plist, append(name, 0), 0);
|
||||
|
@ -719,14 +685,14 @@ static void opt(char *arg) {
|
|||
cflag++;
|
||||
return;
|
||||
case 'N':
|
||||
if (strcmp(basepath(cpp[0]), "gcc-cpp") == 0)
|
||||
if (strcmp(basename(cpp[0]), "gcc-cpp") == 0)
|
||||
plist = append("-nostdinc", plist);
|
||||
include[0] = 0;
|
||||
ilist = 0;
|
||||
return;
|
||||
case 'v':
|
||||
if (verbose++ == 0) {
|
||||
if (strcmp(basepath(cpp[0]), "gcc-cpp") == 0)
|
||||
if (strcmp(basename(cpp[0]), "gcc-cpp") == 0)
|
||||
plist = append(arg, plist);
|
||||
clist = append(arg, clist);
|
||||
fprintf(stderr, "%s %s\n", progname, rcsid);
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
/* x86s running Linux */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
TTimo - 10-18-2001
|
||||
our binaries are named q3lcc q3rcc and q3cpp
|
||||
removed hardcoded paths
|
||||
removed __linux__ preprocessor define (confuses the preprocessor, we are doing bytecode!)
|
||||
*/
|
||||
|
||||
#ifndef LCCDIR
|
||||
#define LCCDIR ""
|
||||
//#define LCCDIR "/usr/local/lib/lcc/"
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define BINEXT ".exe"
|
||||
#else
|
||||
#define BINEXT ""
|
||||
#endif
|
||||
|
||||
char *suffixes[] = { ".c", ".i", ".asm", ".o", ".out", 0 };
|
||||
char inputs[256] = "";
|
||||
// TTimo experimental: do not compile with the __linux__ define, we are doing bytecode!
|
||||
char *cpp[] = { LCCDIR "q3cpp" BINEXT,
|
||||
"-U__GNUC__", "-D_POSIX_SOURCE", "-D__STDC__=1", "-D__STRICT_ANSI__",
|
||||
"-Dunix", "-Di386", "-Dlinux",
|
||||
"-D__unix__", "-D__i386__", "-D__signed__=signed",
|
||||
"$1", "$2", "$3", 0 };
|
||||
char *include[] = {"-I" LCCDIR "include", "-I" LCCDIR "gcc/include", "-I/usr/include",
|
||||
"-I" SYSTEM "include", 0 };
|
||||
char *com[] = {LCCDIR "q3rcc" BINEXT, "-target=bytecode", "$1", "$2", "$3", 0 };
|
||||
char *as[] = { "/usr/bin/as", "-o", "$3", "$1", "$2", 0 };
|
||||
// NOTE TTimo I don't think we have any use with the native linkage
|
||||
// our target is always bytecode..
|
||||
char *ld[] = {
|
||||
/* 0 */ "/usr/bin/ld", "-m", "elf_i386", "-dynamic-linker",
|
||||
/* 4 */ "/lib/ld-linux.so.2", "-o", "$3",
|
||||
/* 7 */ "/usr/lib/crt1.o", "/usr/lib/crti.o",
|
||||
/* 9 */ SYSTEM "crtbegin.o",
|
||||
"$1", "$2",
|
||||
/* 12 */ "-L" LCCDIR,
|
||||
/* 13 */ "-llcc",
|
||||
/* 14 */ "-L" LCCDIR "/gcc", "-lgcc", "-lc", "-lm",
|
||||
/* 18 */ "",
|
||||
/* 19 */ SYSTEM "crtend.o", "/usr/lib/crtn.o",
|
||||
/* 20 */ "-L" SYSTEM,
|
||||
0 };
|
||||
|
||||
extern char *concat(char *, char *);
|
||||
|
||||
int option(char *arg) {
|
||||
if (strncmp(arg, "-lccdir=", 8) == 0) {
|
||||
cpp[0] = concat(&arg[8], "/gcc/cpp");
|
||||
include[0] = concat("-I", concat(&arg[8], "/include"));
|
||||
include[1] = concat("-I", concat(&arg[8], "/gcc/include"));
|
||||
ld[9] = concat(&arg[8], "/gcc/crtbegin.o");
|
||||
ld[12] = concat("-L", &arg[8]);
|
||||
ld[14] = concat("-L", concat(&arg[8], "/gcc"));
|
||||
ld[19] = concat(&arg[8], "/gcc/crtend.o");
|
||||
com[0] = concat(&arg[8], "/rcc");
|
||||
} else if (strcmp(arg, "-p") == 0 || strcmp(arg, "-pg") == 0) {
|
||||
ld[7] = "/usr/lib/gcrt1.o";
|
||||
ld[18] = "-lgmon";
|
||||
} else if (strcmp(arg, "-b") == 0)
|
||||
;
|
||||
else if (strcmp(arg, "-g") == 0)
|
||||
;
|
||||
else if (strncmp(arg, "-ld=", 4) == 0)
|
||||
ld[0] = &arg[4];
|
||||
else if (strcmp(arg, "-static") == 0) {
|
||||
ld[3] = "-static";
|
||||
ld[4] = "";
|
||||
} else
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
/* DEC ALPHAs running OSF/1 V3.2A (Rev. 17) at Princeton University */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#ifndef LCCDIR
|
||||
#define LCCDIR "/usr/local/lib/lcc/"
|
||||
#endif
|
||||
|
||||
char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 };
|
||||
char inputs[256] = "";
|
||||
char *cpp[] = {
|
||||
LCCDIR "cpp", "-D__STDC__=1",
|
||||
"-DLANGUAGE_C", "-D__LANGUAGE_C__",
|
||||
"-D_unix", "-D__unix__", "-D_osf", "-D__osf__", "-Dunix",
|
||||
"-Dalpha", "-D_alpha", "-D__alpha",
|
||||
"-D__SYSTYPE_BSD", "-D_SYSTYPE_BSD",
|
||||
"$1", "$2", "$3", 0 };
|
||||
char *com[] = { LCCDIR "rcc", "-target=alpha/osf", "$1", "$2", "$3", "", 0 };
|
||||
char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include",
|
||||
"-I/usr/include", 0 };
|
||||
char *as[] = { "/bin/as", "-o", "$3", "", "$1", "-nocpp", "$2", 0 };
|
||||
char *ld[] = { "/usr/bin/ld", "-o", "$3", "/usr/lib/cmplrs/cc/crt0.o",
|
||||
"$1", "$2", "", "", "-L" LCCDIR, "-llcc", "-lm", "-lc", 0 };
|
||||
|
||||
extern char *concat(char *, char *);
|
||||
extern int access(const char *, int);
|
||||
|
||||
int option(char *arg) {
|
||||
if (strncmp(arg, "-lccdir=", 8) == 0) {
|
||||
cpp[0] = concat(&arg[8], "/cpp");
|
||||
include[0] = concat("-I", concat(&arg[8], "/include"));
|
||||
com[0] = concat(&arg[8], "/rcc");
|
||||
ld[8] = concat("-L", &arg[8]);
|
||||
} else if (strcmp(arg, "-g4") == 0
|
||||
&& access("/u/drh/lib/alpha/rcc", 4) == 0
|
||||
&& access("/u/drh/book/cdb/alpha/osf/cdbld", 4) == 0) {
|
||||
com[0] = "/u/drh/lib/alpha/rcc";
|
||||
com[5] = "-g4";
|
||||
ld[0] = "/u/drh/book/cdb/alpha/osf/cdbld";
|
||||
ld[1] = "-o";
|
||||
ld[2] = "$3";
|
||||
ld[3] = "$1";
|
||||
ld[4] = "$2";
|
||||
ld[5] = 0;
|
||||
} else if (strcmp(arg, "-g") == 0)
|
||||
return 1;
|
||||
else if (strcmp(arg, "-b") == 0)
|
||||
;
|
||||
else
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
/* SPARCs running Solaris 2.5.1 at CS Dept., Princeton University */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#ifndef LCCDIR
|
||||
#define LCCDIR "/usr/local/lib/lcc/"
|
||||
#endif
|
||||
#ifndef SUNDIR
|
||||
#define SUNDIR "/opt/SUNWspro/SC4.2/lib/"
|
||||
#endif
|
||||
|
||||
char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 };
|
||||
char inputs[256] = "";
|
||||
char *cpp[] = { LCCDIR "cpp",
|
||||
"-D__STDC__=1", "-Dsparc", "-D__sparc__", "-Dsun", "-D__sun__", "-Dunix",
|
||||
"$1", "$2", "$3", 0 };
|
||||
char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include",
|
||||
"-I/usr/include", 0 };
|
||||
char *com[] = { LCCDIR "rcc", "-target=sparc/solaris",
|
||||
"$1", "$2", "$3", 0 };
|
||||
char *as[] = { "/usr/ccs/bin/as", "-Qy", "-s", "-o", "$3", "$1", "$2", 0 };
|
||||
char *ld[] = { "/usr/ccs/bin/ld", "-o", "$3", "$1",
|
||||
SUNDIR "crti.o", SUNDIR "crt1.o",
|
||||
SUNDIR "values-xa.o", "$2", "",
|
||||
"-Y", "P," SUNDIR ":/usr/ccs/lib:/usr/lib", "-Qy",
|
||||
"-L" LCCDIR, "-llcc", "-lm", "-lc", SUNDIR "crtn.o", 0 };
|
||||
|
||||
extern char *concat(char *, char *);
|
||||
|
||||
int option(char *arg) {
|
||||
if (strncmp(arg, "-lccdir=", 8) == 0) {
|
||||
cpp[0] = concat(&arg[8], "/cpp");
|
||||
include[0] = concat("-I", concat(&arg[8], "/include"));
|
||||
ld[12] = concat("-L", &arg[8]);
|
||||
com[0] = concat(&arg[8], "/rcc");
|
||||
} else if (strcmp(arg, "-g") == 0)
|
||||
;
|
||||
else if (strcmp(arg, "-p") == 0) {
|
||||
ld[5] = SUNDIR "mcrt1.o";
|
||||
ld[10] = "P," SUNDIR "libp:/usr/ccs/lib/libp:/usr/lib/libp:"
|
||||
SUNDIR ":/usr/ccs/lib:/usr/lib";
|
||||
} else if (strcmp(arg, "-b") == 0)
|
||||
;
|
||||
else if (strncmp(arg, "-ld=", 4) == 0)
|
||||
ld[0] = &arg[4];
|
||||
else
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/* x86s running MS Windows NT 4.0 */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#ifndef LCCDIR
|
||||
// JDC #define LCCDIR "\\progra~1\\lcc\\4.1\\bin\\"
|
||||
//#define LCCDIR "\\quake3\\source\\lcc\\bin\\" // JDC
|
||||
// TTimo: q3cpp q3rcc & no hardcoded paths
|
||||
#define LCCDIR ""
|
||||
#endif
|
||||
|
||||
char *suffixes[] = { ".c;.C", ".i;.I", ".asm;.ASM;.s;.S", ".obj;.OBJ", ".exe", 0 };
|
||||
char inputs[256] = "";
|
||||
char *cpp[] = { LCCDIR "q3cpp", "-D__STDC__=1", "-Dwin32", "-D_WIN32", "-D_M_IX86",
|
||||
"$1", "$2", "$3", 0 };
|
||||
char *include[] = { "-I" LCCDIR "include", 0 };
|
||||
char *com[] = { LCCDIR "q3rcc", "-target=x86/win32", "$1", "$2", "$3", 0 };
|
||||
char *as[] = { "ml", "-nologo", "-c", "-Cp", "-coff", "-Fo$3", "$1", "$2", 0 };
|
||||
char *ld[] = { "link", "-nologo",
|
||||
"-align:0x1000", "-subsystem:console", "-entry:mainCRTStartup",
|
||||
"$2", "-OUT:$3", "$1", LCCDIR "liblcc.lib", "libc.lib", "kernel32.lib", 0 };
|
||||
|
||||
extern char *concat(char *, char *);
|
||||
extern char *replace(const char *, int, int);
|
||||
|
||||
int option(char *arg) {
|
||||
if (strncmp(arg, "-lccdir=", 8) == 0) {
|
||||
arg = replace(arg + 8, '/', '\\');
|
||||
if (arg[strlen(arg)-1] == '\\')
|
||||
arg[strlen(arg)-1] = '\0';
|
||||
cpp[0] = concat(arg, "\\cpp.exe");
|
||||
include[0] = concat("-I", concat(arg, "\\include"));
|
||||
com[0] = concat(arg, "\\rcc.exe");
|
||||
ld[8] = concat(arg, "\\liblcc.lib");
|
||||
} else if (strcmp(arg, "-b") == 0)
|
||||
;
|
||||
else if (strncmp(arg, "-ld=", 4) == 0)
|
||||
ld[0] = &arg[4];
|
||||
else
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
# $Id: makefile 145 2001-10-17 21:53:10Z timo $
|
||||
PLATFORM=$(shell uname|sed -e s/_.*//|tr A-Z a-z)
|
||||
HOSTFILE=etc/linux.c
|
||||
TEMPDIR=/tmp
|
||||
A=.a
|
||||
O=.o
|
||||
|
@ -27,7 +26,6 @@ BD=$(BUILDDIR)/
|
|||
T=$(TSTDIR)/
|
||||
ifeq ($(PLATFORM),SunOS)
|
||||
INSTALL=ginstall
|
||||
HOSTFILE=etc/gcc-solaris.c
|
||||
else
|
||||
INSTALL=install
|
||||
endif
|
||||
|
@ -148,7 +146,7 @@ $(BD)bprint$(O): etc/bprint.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ etc/bprint.c
|
|||
$(BD)q3lcc$(E): $(BD)q3lcc$(O) $(BD)host$(O); $(LD) $(LDFLAGS) -o $@ $(BD)q3lcc$(O) $(BD)host$(O)
|
||||
|
||||
$(BD)q3lcc$(O): etc/lcc.c; $(CC) $(LCC_CFLAGS) -c -DTEMPDIR=\"$(TEMPDIR)\" -o $@ etc/lcc.c
|
||||
$(BD)host$(O): $(HOSTFILE); $(CC) $(LCC_CFLAGS) -c -DSYSTEM=\"\" -o $@ $(HOSTFILE)
|
||||
$(BD)host$(O): etc/bytecode.c; $(CC) $(LCC_CFLAGS) -c -DSYSTEM=\"\" -o $@ etc/bytecode.c
|
||||
|
||||
LIBOBJS=$(BD)assert$(O) $(BD)bbexit$(O) $(BD)yynull$(O)
|
||||
|
||||
|
|
|
@ -565,7 +565,7 @@ $(Q3LCC):
|
|||
$(Q3ASM):
|
||||
$(MAKE) -C ../tools/asm install
|
||||
|
||||
DO_Q3LCC=$(Q3LCC) -o $@ -S -DQ3_VM -I$(CGDIR) -I$(GDIR) -I$(UIDIR) -I$(CMDIR) $<
|
||||
DO_Q3LCC=$(Q3LCC) -o $@ $<
|
||||
|
||||
#############################################################################
|
||||
# CLIENT/SERVER
|
||||
|
|
Loading…
Reference in a new issue