aboutsummaryrefslogtreecommitdiffstats
path: root/code
diff options
context:
space:
mode:
Diffstat (limited to 'code')
-rw-r--r--code/tools/lcc/etc/gcc-solaris.c73
-rw-r--r--code/unix/Makefile72
2 files changed, 84 insertions, 61 deletions
diff --git a/code/tools/lcc/etc/gcc-solaris.c b/code/tools/lcc/etc/gcc-solaris.c
index 8a47f11..f0e20e9 100644
--- a/code/tools/lcc/etc/gcc-solaris.c
+++ b/code/tools/lcc/etc/gcc-solaris.c
@@ -1,4 +1,4 @@
-/* Solaris 10 sparc */
+/* x86s running Linux */
#include <string.h>
@@ -9,49 +9,70 @@ 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
-#ifndef GCCDIR
-#define GCCDIR "/usr/sfw/bin/"
-#endif
-#ifndef GCCLIB
-#define GCCLIB "/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/"
-#endif
+
+#ifdef _WIN32
+#define BINEXT ".exe"
+#else
#define BINEXT ""
+#endif
-char *suffixes[] = { ".c", ".i", ".asm", ".s", ".o", ".out", 0 };
+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,
- "-D__STDC__=1", "-Dsparc", "-D__sparc__", "-Dsun", "-D__sun__", "-Dunix", "-D__sun",
+ "-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" SYSTEM "include", "-I/usr/include", 0 };
-/* char *com[] = { LCCDIR "q3rcc", "-target=bytecode", "$1", "$2", "$3", 0 }; */
-char *com[] = { LCCDIR "q3rcc", "-target=sparc/solaris", "$1", "$2", "$3", 0 };
-char *as[] = { "/usr/ccs/bin/as", "-o", "$3", "$1", "$2", 0 };
-char *ld[] = { "/usr/ccs/bin/ld", "-o", "$3", "$1",
- GCCLIB "crti.o", GCCLIB "crt1.o",
- GCCLIB "crtbegin.o", "$2", "", "", "-L" LCCDIR, "-llcc",
- "-L" GCCLIB, "-lgcc", "-lm", "-lc", "",
- GCCLIB "crtend.o", GCCLIB "crtn.o", 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) {
+ if (strncmp(arg, "-lccdir=", 8) == 0) {
cpp[0] = concat(&arg[8], "/gcc/cpp");
include[0] = concat("-I", concat(&arg[8], "/include"));
- ld[10] = concat("-L", &arg[8]);
+ 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[8] = "-lgmon";
- } else if (strcmp(arg, "-g") == 0)
+ ld[7] = "/usr/lib/gcrt1.o";
+ ld[18] = "-lgmon";
+ } else if (strcmp(arg, "-b") == 0)
;
- else if (strcmp(arg, "-b") == 0)
+ else if (strcmp(arg, "-g") == 0)
;
- else
+ 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;
}
diff --git a/code/unix/Makefile b/code/unix/Makefile
index 98d487f..32a5016 100644
--- a/code/unix/Makefile
+++ b/code/unix/Makefile
@@ -85,6 +85,10 @@ VERSION=$(shell grep Q3_VERSION ../qcommon/q_shared.h | \
VM_PPC=
LIB=lib
+
+INSTALL=install
+MKDIR=mkdir
+
ifeq ($(PLATFORM),linux)
GLIBC=-glibc
@@ -360,6 +364,8 @@ ifeq ($(PLATFORM),SunOS)
GLIBC= #libc is irrelevant
CC=gcc
CXX=g++
+ INSTALL=ginstall
+ MKDIR=gmkdir
COPYDIR="/usr/local/share/games/quake3"
ifneq (,$(findstring i86pc,$(shell uname -m)))
@@ -528,23 +534,23 @@ all:build_debug build_release
targets: $(TARGETS)
makedirs:
- @if [ ! -d $(B) ];then mkdir $(B);fi
- @if [ ! -d $(B)/client ];then mkdir $(B)/client;fi
- @if [ ! -d $(B)/ded ];then mkdir $(B)/ded;fi
- @if [ ! -d $(B)/ref ];then mkdir $(B)/ref;fi
- @if [ ! -d $(B)/baseq3 ];then mkdir $(B)/baseq3;fi
- @if [ ! -d $(B)/baseq3/cgame ];then mkdir $(B)/baseq3/cgame;fi
- @if [ ! -d $(B)/baseq3/game ];then mkdir $(B)/baseq3/game;fi
- @if [ ! -d $(B)/baseq3/ui ];then mkdir $(B)/baseq3/ui;fi
- @if [ ! -d $(B)/baseq3/qcommon ];then mkdir $(B)/baseq3/qcommon;fi
- @if [ ! -d $(B)/baseq3/vm ];then mkdir $(B)/baseq3/vm;fi
- @if [ ! -d $(B)/missionpack ];then mkdir $(B)/missionpack;fi
- @if [ ! -d $(B)/missionpack/cgame ];then mkdir $(B)/missionpack/cgame;fi
- @if [ ! -d $(B)/missionpack/game ];then mkdir $(B)/missionpack/game;fi
- @if [ ! -d $(B)/missionpack/ui ];then mkdir $(B)/missionpack/ui;fi
- @if [ ! -d $(B)/missionpack/qcommon ];then mkdir $(B)/missionpack/qcommon;fi
- @if [ ! -d $(B)/missionpack/vm ];then mkdir $(B)/missionpack/vm;fi
- @if [ ! -d $(B)/q3static ];then mkdir $(B)/q3static;fi
+ @if [ ! -d $(B) ];then $(MKDIR) $(B);fi
+ @if [ ! -d $(B)/client ];then $(MKDIR) $(B)/client;fi
+ @if [ ! -d $(B)/ded ];then $(MKDIR) $(B)/ded;fi
+ @if [ ! -d $(B)/ref ];then $(MKDIR) $(B)/ref;fi
+ @if [ ! -d $(B)/baseq3 ];then $(MKDIR) $(B)/baseq3;fi
+ @if [ ! -d $(B)/baseq3/cgame ];then $(MKDIR) $(B)/baseq3/cgame;fi
+ @if [ ! -d $(B)/baseq3/game ];then $(MKDIR) $(B)/baseq3/game;fi
+ @if [ ! -d $(B)/baseq3/ui ];then $(MKDIR) $(B)/baseq3/ui;fi
+ @if [ ! -d $(B)/baseq3/qcommon ];then $(MKDIR) $(B)/baseq3/qcommon;fi
+ @if [ ! -d $(B)/baseq3/vm ];then $(MKDIR) $(B)/baseq3/vm;fi
+ @if [ ! -d $(B)/missionpack ];then $(MKDIR) $(B)/missionpack;fi
+ @if [ ! -d $(B)/missionpack/cgame ];then $(MKDIR) $(B)/missionpack/cgame;fi
+ @if [ ! -d $(B)/missionpack/game ];then $(MKDIR) $(B)/missionpack/game;fi
+ @if [ ! -d $(B)/missionpack/ui ];then $(MKDIR) $(B)/missionpack/ui;fi
+ @if [ ! -d $(B)/missionpack/qcommon ];then $(MKDIR) $(B)/missionpack/qcommon;fi
+ @if [ ! -d $(B)/missionpack/vm ];then $(MKDIR) $(B)/missionpack/vm;fi
+ @if [ ! -d $(B)/q3static ];then $(MKDIR) $(B)/q3static;fi
#############################################################################
# QVM BUILD TOOLS
@@ -823,9 +829,7 @@ ifeq ($(PLATFORM),SunOS)
$(B)/client/linux_qgl.o \
$(B)/client/linux_glimp.o \
$(B)/client/linux_snd.o \
- $(B)/client/sdl_snd.o \
- $(B)/client/snd_mixa.o \
- $(B)/client/matha.o \
+ $(B)/client/sdl_snd.o
Q3POBJ_SMP=\
$(B)/client/unix_main.o \
@@ -836,12 +840,10 @@ ifeq ($(PLATFORM),SunOS)
$(B)/client/linux_qgl.o \
$(B)/client/linux_glimp_smp.o \
$(B)/client/linux_snd.o \
- $(B)/client/sdl_snd.o \
- $(B)/client/snd_mixa.o \
- $(B)/client/matha.o
+ $(B)/client/sdl_snd.o
ifeq ($(ARCH),i386)
- Q3POBJ += $(B)/client/ftola.o $(B)/client/snapvectora.o
+ Q3POBJ += $(B)/client/ftola.o $(B)/client/snapvectora.o $(B)/client/snd_mixa.o $(B)/client/matha.o
Q3POBJ_SMP += $(B)/client/ftola.o $(B)/client/snapvectora.o
endif
@@ -1532,22 +1534,22 @@ $(B)/missionpack/qcommon/%.asm: $(CMDIR)/%.c $(Q3LCC)
copyfiles: build_release
@if [ ! -d $(COPYDIR)/baseq3 ]; then echo "You need to set COPYDIR to where you installed Quake III!"; false; fi
- install -s -m 0755 $(BR)/$(PLATFORM)quake3$(BINEXT) $(COPYDIR)/quake3
- #install -s -m 0755 $(BR)/$(PLATFORM)quake3-smp$(BINEXT) $(COPYDIR)/quake3-smp
- install -s -m 0755 $(BR)/$(PLATFORM)q3ded$(BINEXT) $(COPYDIR)/q3ded
- -mkdir -p -m 0755 $(COPYDIR)/baseq3
- install -s -m 0755 $(BR)/baseq3/cgame$(ARCH).$(SHLIBEXT) \
+ $(INSTALL) -s -m 0755 $(BR)/$(PLATFORM)quake3$(BINEXT) $(COPYDIR)/quake3
+ #$(INSTALL) -s -m 0755 $(BR)/$(PLATFORM)quake3-smp$(BINEXT) $(COPYDIR)/quake3-smp
+ $(INSTALL) -s -m 0755 $(BR)/$(PLATFORM)q3ded$(BINEXT) $(COPYDIR)/q3ded
+ -$(MKDIR) -p -m 0755 $(COPYDIR)/baseq3
+ $(INSTALL) -s -m 0755 $(BR)/baseq3/cgame$(ARCH).$(SHLIBEXT) \
$(COPYDIR)/baseq3/.
- install -s -m 0755 $(BR)/baseq3/qagame$(ARCH).$(SHLIBEXT) \
+ $(INSTALL) -s -m 0755 $(BR)/baseq3/qagame$(ARCH).$(SHLIBEXT) \
$(COPYDIR)/baseq3/.
- install -s -m 0755 $(BR)/baseq3/ui$(ARCH).$(SHLIBEXT) \
+ $(INSTALL) -s -m 0755 $(BR)/baseq3/ui$(ARCH).$(SHLIBEXT) \
$(COPYDIR)/baseq3/.
- -mkdir -p -m 0755 $(COPYDIR)/missionpack
- install -s -m 0755 $(BR)/missionpack/cgame$(ARCH).$(SHLIBEXT) \
+ -$(MKDIR) -p -m 0755 $(COPYDIR)/missionpack
+ $(INSTALL) -s -m 0755 $(BR)/missionpack/cgame$(ARCH).$(SHLIBEXT) \
$(COPYDIR)/missionpack/.
- install -s -m 0755 $(BR)/missionpack/qagame$(ARCH).$(SHLIBEXT) \
+ $(INSTALL) -s -m 0755 $(BR)/missionpack/qagame$(ARCH).$(SHLIBEXT) \
$(COPYDIR)/missionpack/.
- install -s -m 0755 $(BR)/missionpack/ui$(ARCH).$(SHLIBEXT) \
+ $(INSTALL) -s -m 0755 $(BR)/missionpack/ui$(ARCH).$(SHLIBEXT) \
$(COPYDIR)/missionpack/.
clean:clean-debug clean-release