update for new progs loader api and the makefile for the option of static

linking
This commit is contained in:
Bill Currie 2002-01-30 17:41:16 +00:00
parent e5e157a804
commit b7cfb95a64
2 changed files with 15 additions and 11 deletions

View file

@ -4,6 +4,7 @@ MAKEDEPS=$(CC) -MM $(CPPFLAGS) $< | sed -e 's/$*\.o:*/$*\.o $@:/g' > $@
CFLAGS+=-Wall -Werror -g -O2 CFLAGS+=-Wall -Werror -g -O2
CPPFLAGS+= CPPFLAGS+=
#LDFLAGS=-static
LIBS= LIBS=
vpath %.a vpath %.a
@ -18,7 +19,7 @@ DEP=$(patsubst %.o,%.d,$(OBJ))
all: $(EXE) $(EXE).dat all: $(EXE) $(EXE).dat
$(EXE): $(OBJ) $(LIBS) $(EXE): $(OBJ) $(LIBS)
$(CC) $(LDFLAGS) -o $@ $^ -lQFgamecode -lQFutil $(CC) $(LDFLAGS) -o $@ $^ -lQFgamecode -lQFutil -lz -lm
$(EXE).dat: progs.src *.qc $(EXE).dat: progs.src *.qc
qfcc --warn=error --code=debug qfcc --warn=error --code=debug

View file

@ -57,7 +57,7 @@ int
main () main ()
{ {
func_t main_func; func_t main_func;
FILE *f; VFile *f;
int len; int len;
int i; int i;
@ -90,20 +90,23 @@ main ()
progs.no_exec_limit = 1; progs.no_exec_limit = 1;
progs.progs_name = "qwaq.dat"; progs.progs_name = "qwaq.dat";
f = fopen (progs.progs_name, "rb"); f = Qopen (progs.progs_name, "rb");
if (f) { if (f) {
fseek (f, 0, SEEK_END); Qseek (f, 0, SEEK_END);
len = ftell (f); len = Qtell (f);
fseek (f, 0, SEEK_SET); Qseek (f, 0, SEEK_SET);
progs.progs = Hunk_AllocName (len, "qwaq.dat");
fread (progs.progs, 1, len, f);
fclose (f);
com_filesize = len; com_filesize = len;
if (progs.progs) PR_LoadProgsFile (&progs, f, len, 0, 1024 * 1024);
PR_LoadProgs (&progs, progs.progs_name); Qclose (f);
} }
if (!progs.progs) if (!progs.progs)
Sys_Error ("couldn't load %s\n", "qwaq.dat"); Sys_Error ("couldn't load %s\n", "qwaq.dat");
if (!PR_ResolveGlobals (&progs))
PR_Error (&progs, "unable to load %s", progs.progs_name);
PR_LoadStrings (&progs);
PR_LoadDebug (&progs);
PR_Check_Opcodes (&progs);
PR_RelocateBuiltins (&progs); PR_RelocateBuiltins (&progs);
*progs.edicts = PR_InitEdicts (&progs, MAX_EDICTS); *progs.edicts = PR_InitEdicts (&progs, MAX_EDICTS);