--- Makefile.orig Sat May 27 13:47:34 2006 +++ Makefile Sat May 27 14:04:12 2006 @@ -9,9 +9,9 @@ # BASEVERSION=1.09 -VERSION=$(BASEVERSION)$(GLIBC) +VERSION=$(BASEVERSION) -BUILD_SDL=YES # quake sdl glx executable (uses SDL for cdrom and sound) +#BUILD_SDL=YES # quake sdl glx executable (uses SDL for cdrom and sound) ifneq (,$(findstring libc6,$(shell if [ -e /lib/libc.so.6 ];then echo libc6;fi))) GLIBC=-glibc @@ -28,32 +28,45 @@ MOUNT_DIR=./src -BUILD_DEBUG_DIR=debug$(ARCH)$(GLIBC) -BUILD_RELEASE_DIR=release$(ARCH)$(GLIBC) +BUILD_DEBUG_DIR=debug +BUILD_RELEASE_DIR=release -CC=gcc +CC?=gcc +ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc/ -e s/sparc64/sparc/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/alpha/axp/) +USE_OPTIMIZED_CFLAGS?=YES -BASE_CFLAGS=-Dstricmp=strcasecmp #-Wall +ifeq ($(ARCH),i386) +USE_X86_ASM?=YES +else +USE_X86_ASM=NO +endif -RELEASE_CFLAGS=$(BASE_CFLAGS) -march=i686 -O2 -ffast-math -funroll-loops \ +BASE_CFLAGS=$(CFLAGS) -Dstricmp=strcasecmp #-Wall + +ifeq ($(strip $(USE_X86_ASM)),YES) +BASE_CFLAGS+=-Did386 +endif + +RELEASE_CFLAGS=$(BASE_CFLAGS) + +ifeq ($(strip $(USE_OPTIMIZED_CFLAGS)),YES) +RELEASE_CFLAGS+=-O2 -ffast-math -funroll-loops \ -fomit-frame-pointer -fexpensive-optimizations -fno-strict-aliasing -DEBUG_CFLAGS=$(BASE_CFLAGS) -g +endif -LDFLAGS=-lm +DEBUG_CFLAGS=$(BASE_CFLAGS) -g -LDFLAGS += -lz -L./src/fmod -Wl,-rpath,. -lfmod +LDFLAGS+=-lm -lz ifeq ($(strip $(BUILD_SDL)),YES) - SDLCFLAGS=$(shell sdl-config --cflags) - SDLLDFLAGS=$(shell sdl-config --libs) - LDFLAGS += \ - -lSDL + SDLCFLAGS=$(shell $(SDL_CONFIG) --cflags) + SDLLDFLAGS=$(shell $(SDL_CONFIG) --libs) BASE_CFLAGS += \ -D_SDL_BIN endif -GLLDFLAGS=-L/usr/X11R6/lib -L/usr/local/lib -lGL -lX11 -lXext -ldl -lXxf86dga -lXxf86vm -GLCFLAGS=-DGLQUAKE -I/usr/include -I/usr/X11R6/include +GLLDFLAGS=-L$(LOCALBASE)/lib -lGL -lX11 -lXext -lXxf86dga -lXxf86vm +GLCFLAGS=-DGLQUAKE -I$(LOCALBASE)/include DO_CC=$(CC) $(CFLAGS) -o $@ -c $< DO_DEBUG_CC=$(CC) $(DEBUG_CFLAGS) -o $@ -c $< @@ -70,10 +83,10 @@ ############################################################################# - TARGETS=$(BUILDDIR)/nehahra.glx + TARGETS=$(BUILDDIR)/nehahra ifeq ($(strip $(BUILD_SDL)),YES) - TARGETS +=$(BUILDDIR)/nehahra-sdl.glx + TARGETS +=$(BUILDDIR)/nehahra-sdl endif all: @@ -165,12 +178,15 @@ $(BUILDDIR)/glquake/sys_linux.o \ $(BUILDDIR)/glquake/snd_dma.o \ $(BUILDDIR)/glquake/snd_mem.o \ - $(BUILDDIR)/glquake/snd_mix.o \ - \ + $(BUILDDIR)/glquake/snd_mix.o + +ifeq ($(strip $(USE_X86_ASM)),YES) +GLQUAKE_OBJS+= \ $(BUILDDIR)/glquake/math.o \ $(BUILDDIR)/glquake/worlda.o \ $(BUILDDIR)/glquake/snd_mixa.o \ $(BUILDDIR)/glquake/sys_dosa.o +endif GLQUAKE_LNX_OBJS = \ $(BUILDDIR)/glquake/cd_linux.o \ @@ -182,10 +198,10 @@ GLX_OBJS=$(BUILDDIR)/glquake/gl_vidlinuxglx.o -$(BUILDDIR)/nehahra.glx : $(GLQUAKE_OBJS) $(GLQUAKE_LNX_OBJS) $(GLX_OBJS) +$(BUILDDIR)/nehahra : $(GLQUAKE_OBJS) $(GLQUAKE_LNX_OBJS) $(GLX_OBJS) $(CC) $(CFLAGS) -o $@ $(GLQUAKE_OBJS) $(GLX_OBJS) $(GLQUAKE_LNX_OBJS) $(GLLDFLAGS) $(LDFLAGS) -$(BUILDDIR)/nehahra-sdl.glx : $(GLQUAKE_OBJS) $(GLQUAKE_SDL_OBJS) $(GLX_OBJS) +$(BUILDDIR)/nehahra-sdl : $(GLQUAKE_OBJS) $(GLQUAKE_SDL_OBJS) $(GLX_OBJS) $(CC) $(CFLAGS) -o $@ $(GLQUAKE_OBJS) $(GLX_OBJS) $(GLQUAKE_SDL_OBJS) $(GLLDFLAGS) $(LDFLAGS) $(SDLLDFLAGS) $(BUILDDIR)/glquake/cl_demo.o : $(MOUNT_DIR)/cl_demo.c