Makefile overhaul!

If I broke something, yell at me, /AFTER/ I've had some sleep..
This commit is contained in:
Zephaniah E. Hull 2000-03-06 13:26:42 +00:00
parent 43e95bac41
commit 39e01df55e
8 changed files with 59 additions and 501 deletions

View file

@ -17,7 +17,7 @@ all:
done done
distclean: distclean:
rm -f config.cache config.log config.status Makefile rm -f config.cache config.log config.status Makefile Rules.mk
rm -f common/config.h rm -f common/config.h
rm -f build_rpm quakeforge-*.tar.gz quakeforge.spec rm -f build_rpm quakeforge-*.tar.gz quakeforge.spec
find . -name \*~ | xargs rm -f find . -name \*~ | xargs rm -f

View file

@ -4,62 +4,15 @@
# #
PROJECT_DIR := @top_srcdir@ PROJECT_DIR := @top_srcdir@
PROJECT_ODIR := ..
SRC_DIR := @srcdir@
COMMON_DIR := $(PROJECT_DIR)/common
COMMON_ODIR := $(PROJECT_ODIR)/common
BIN_PREFIX := common BIN_PREFIX := common
SRC_DIR := @srcdir@
MODULE := common
OBJ_PATTERN = $(BUILD_DIR)/sound_lib/%.o $(BUILD_DIR)/common_lib/%.o
DESTDIR := include $(PROJECT_DIR)/Rules.mk
prefix := @prefix@
exec_prefix := @exec_prefix@
bindir := @bindir@
libdir := @libdir@
mandir := @mandir@
TARGET_DIR := $(PROJECT_ODIR)/targets
BUILD_DIR := $(TARGET_DIR)/common
OBJ_PATTERN := $(BUILD_DIR)/sound_lib/%.o $(BUILD_DIR)/common_lib/%.o
SOUND_LIB := sound_lib.a SOUND_LIB := sound_lib.a
LDFLAGS = @LDFLAGS@ -lm
LIBS = @LIBS@
CC = @CC@
INTEL_ARCH = @INTEL_ARCH@
ifneq ($(SRC_DIR),.)
SRC_DIR_INC = -I$(SRC_DIR)
endif
HAS_MGL = @HAS_MGL@
HAS_GGI = @HAS_GGI@
HAS_SVGA = @HAS_SVGA@
HAS_GLIDE = @HAS_GLIDE@
HAS_TDFXGL = @HAS_TDFXGL@
HAS_OGL = @HAS_OGL@
HAS_XIL = @HAS_XIL@
HAS_X11 = @HAS_X11@
HAS_SDL = @HAS_SDL@
MAKE_SURE_DIR = if test -d "$(BUILD_DIR)/$$DIR"; \
then \
true; \
else \
echo "Creating directory $(BUILD_DIR)/$$DIR"; \
mkdir -p $(BUILD_DIR)/$$DIR; \
fi
RELEASE = @RELEASE@
ifeq ($(RELEASE),yes)
OPTFLAGS = @RELEASE_CFLAGS@
else
OPTFLAGS = -g
endif
lib_targets = $(SOUND_LIB) $(CD_LIB) $(COMMON_LIB) lib_targets = $(SOUND_LIB) $(CD_LIB) $(COMMON_LIB)
targets = $(lib_targets) targets = $(lib_targets)
CLEAN_TARGETS = $(patsubst %,clean-%, $(targets)) CLEAN_TARGETS = $(patsubst %,clean-%, $(targets))
@ -71,14 +24,9 @@ all: $(targets)
# Source files # Source files
# #
ifeq ($(INTEL_ARCH),yes) ifeq ($(ASM_ARCH),i386)
# Source file the Intel archictecture only # Source file the Intel archictecture only
SOUND_SRC += snd_mixa.s SOUND_SRC += snd_mixa.s
else
# Source files for non-Intel platforms
endif endif
# System specific source files # System specific source files
@ -118,26 +66,6 @@ QW_NET_SRC = net_udp.c net_com.c mdfour.c
#QW_NET_SRC = net_udp6.c net_com.c mdfour.c #QW_NET_SRC = net_udp6.c net_com.c mdfour.c
########################################################################
#
# Directory specific stuff
#
DEFS = @DEFS@
CFLAGS = @CFLAGS@ $(OPTFLAGS) $(DEFS) -I. \
$(SRC_DIR_INC) -I$(COMMON_ODIR) -I$(COMMON_DIR)
###########################################################################
#
# Compilation rules
#
$(OBJ_PATTERN): $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(OBJ_PATTERN): $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
########################################################################### ###########################################################################
# #
# Specific target rules # Specific target rules
@ -148,10 +76,7 @@ $(OBJ_PATTERN): $(SRC_DIR)/%.s
SOUND_LIB_OBJS = $(patsubst %,$(BUILD_DIR)/sound_lib/%,$(addsuffix \ SOUND_LIB_OBJS = $(patsubst %,$(BUILD_DIR)/sound_lib/%,$(addsuffix \
.@OBJEXT@, $(basename $(SOUND_SRC) .c .s))) .@OBJEXT@, $(basename $(SOUND_SRC) .c .s)))
sound_lib_DIR: $(SOUND_LIB): $(TARGET_DIR)/sound_lib.a
@DIR=sound_lib; $(MAKE_SURE_DIR)
$(SOUND_LIB): sound_lib_DIR $(TARGET_DIR)/sound_lib.a
$(TARGET_DIR)/sound_lib.a: $(SOUND_LIB_OBJS) $(TARGET_DIR)/sound_lib.a: $(SOUND_LIB_OBJS)
ar cru $@ $(SOUND_LIB_OBJS) ar cru $@ $(SOUND_LIB_OBJS)
@ -166,13 +91,10 @@ distclean: clean
rm -f Makefile rm -f Makefile
$(CLEAN_TARGETS): $(CLEAN_TARGETS):
rm -f $(BUILD_DIR)/../$(subst clean-,,$@) rm -f $(TARGET_DIR)/$(subst clean-,,$@)
clean-sound_lib: clean: $(CLEAN_TARGETS)
rm -f $(BUILD_DIR)/$(subst clean-,,$@)/* -rm -rf $(BUILD_DIR)
clean: clean-sound_lib $(CLEAN_TARGETS)
-rmdir $(BUILD_DIR)
install: $(targets) install: $(targets)
$(PROJECT_DIR)/mkinstalldirs $(DESTDIR)/$(bindir) $(PROJECT_DIR)/mkinstalldirs $(DESTDIR)/$(bindir)

View file

@ -303,69 +303,6 @@ EmitBothSkyLayers ( msurface_t *fa ) {
#define SKY_TEX 2000 #define SKY_TEX 2000
#if 0
/*
LoadPCX
*/
void
LoadPCX (QFile *f, byte **pcx_rgb)
{
pcx_t *pcx, pcxbuf;
byte palette[768];
byte *pix;
int x, y;
int dataByte, runLength;
int count;
/*
Parse PCX file
*/
Qread (f, &pcxbuf, sizeof(pcxbuf));
pcx = &pcxbuf;
if (pcx->manufacturer != 0x0a || pcx->version != 5 || pcx->encoding != 1
|| pcx->bits_per_pixel != 8 || pcx->xmax >= 320
|| pcx->ymax >= 256) {
Con_Printf ("Bad PCX file\n");
return;
}
// seek to palette
Qseek (f, -768, SEEK_END);
Qread (f, palette, 768);
Qseek (f, sizeof(pcxbuf) - 4, SEEK_SET);
count = (pcx->xmax+1) * (pcx->ymax+1);
*pcx_rgb = malloc( count * 4);
for (y=0 ; y<=pcx->ymax ; y++) {
pix = *pcx_rgb + 4*y*(pcx->xmax+1);
for (x=0 ; x<=pcx->ymax ; ) {
dataByte = Qgetc(f);
if((dataByte & 0xC0) == 0xC0) {
runLength = dataByte & 0x3F;
dataByte = Qgetc(f);
}
else
runLength = 1;
while(runLength-- > 0) {
pix[0] = palette[dataByte*3];
pix[1] = palette[dataByte*3+1];
pix[2] = palette[dataByte*3+2];
pix[3] = 255;
pix += 4;
x++;
}
}
}
}
#endif
/* /*
TARGA LOADING TARGA LOADING
*/ */

View file

@ -35,7 +35,6 @@
#include <dlfcn.h> #include <dlfcn.h>
#include <sys/param.h> #include <sys/param.h>
#else #else
#define LIBDIR ""
#include "input.h" #include "input.h"
#endif #endif
@ -46,6 +45,9 @@
#include <plugin.h> #include <plugin.h>
#include <cvar.h> #include <cvar.h>
#ifndef LIBDIR
#define LIBDIR
#endif
//cvar_t drv_path = {"drv_path", ".:" LIBDIR "/quakeforge"}; //cvar_t drv_path = {"drv_path", ".:" LIBDIR "/quakeforge"};
cvar_t *fs_drvpath; cvar_t *fs_drvpath;

View file

@ -306,7 +306,7 @@ if test "x$HAS_OGL" != xno; then
if test "x$OGL_INCLUDES" != xauto; then if test "x$OGL_INCLUDES" != xauto; then
OGL_CFLAGS="$OGL_CFLAGS -I$OGL_INCLUDES" OGL_CFLAGS="$OGL_CFLAGS -I$OGL_INCLUDES"
else else
OGL_CFLAGS="$OGL_CFLAGS -I/usr/local/include -I${x_includes:-.}" OGL_CFLAGS="$OGL_CFLAGS -I${x_includes:-.}"
fi fi
save_CPPFLAGS="$CPPFLAGS" save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $OGL_CFLAGS" CPPFLAGS="$CPPFLAGS $OGL_CFLAGS"
@ -546,10 +546,10 @@ case "${target}" in
i?86-*-*) i?86-*-*)
INTEL_ARCH=yes INTEL_ARCH=yes
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_MSG_CHECKING(to see if we should disable x86 optimizations) AC_MSG_CHECKING(to see if we should disable asm optimizations)
AC_ARG_ENABLE(asmopt, AC_ARG_ENABLE(asmopt,
[ --disable-asmopt Disable assembler optimization (on ia32 machines)], [ --disable-asmopt Disable assembler optimization],
NO_ASMOPT=yes, NO_ASMOPT=no ASM_ARCH=none, ASM_ARCH=i386
) )
if test "x$NO_ASMOPT" = xyes; then if test "x$NO_ASMOPT" = xyes; then
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
@ -558,7 +558,7 @@ else
fi fi
;; ;;
*) AC_MSG_RESULT(no) *) AC_MSG_RESULT(no)
NO_ASMOPT=yes ASM_ARCH=none
esac esac
@ -806,7 +806,7 @@ AC_SUBST(SOUND_STYLE)
AC_SUBST(SOUND_LIBS) AC_SUBST(SOUND_LIBS)
AC_SUBST(LIBS) AC_SUBST(LIBS)
AC_SUBST(INTEL_ARCH) AC_SUBST(INTEL_ARCH)
AC_SUBST(NO_ASMOPT) AC_SUBST(ASM_ARCH)
AC_SUBST(NET_LIBS) AC_SUBST(NET_LIBS)
AC_SUBST(SYS_SRC) AC_SUBST(SYS_SRC)
AC_SUBST(QW_CL_SYS_SRC) AC_SUBST(QW_CL_SYS_SRC)
@ -828,6 +828,7 @@ AC_OUTPUT(
uquake/Makefile uquake/Makefile
common/Makefile common/Makefile
Makefile Makefile
Rules.mk
rpm/quakeforge.spec rpm/quakeforge.spec
rpm/build_rpm rpm/build_rpm
, ,

View file

@ -4,58 +4,12 @@
# #
PROJECT_DIR := @top_srcdir@ PROJECT_DIR := @top_srcdir@
PROJECT_ODIR := ..
SRC_DIR := @srcdir@
QW_COMMON_DIR := $(PROJECT_DIR)/qw_common
COMMON_DIR := $(PROJECT_DIR)/common
COMMON_ODIR := $(PROJECT_ODIR)/common
BIN_PREFIX := qw-client BIN_PREFIX := qw-client
SRC_DIR := @srcdir@
MODULE := qw_client
OBJ_PATTERN = $(BUILD_DIR)/common_lib/%.@OBJEXT@ $(BUILD_DIR)/%.@OBJEXT@
DESTDIR := include $(PROJECT_DIR)/Rules.mk
prefix := @prefix@
exec_prefix := @exec_prefix@
bindir := @bindir@
libdir := @libdir@
mandir := @mandir@
TARGET_DIR := $(PROJECT_ODIR)/targets
BUILD_DIR := $(TARGET_DIR)/qw_client
OBJ_PATTERN := $(BUILD_DIR)/common_lib/%.@OBJEXT@ \
$(BUILD_DIR)/%.@OBJEXT@
DEP_PATTERN := $(BUILD_DIR)/%.d $(BUILD_DIR)/common_lib/%.d
GL_OBJ_PATTERN := $(BUILD_DIR)/gl/%.@OBJEXT@
GL_DEP_PATTERN := $(BUILD_DIR)/gl/%.d
LDFLAGS = @LDFLAGS@ @SOUND_LIBS@ @NET_LIBS@ -lm
LIBS = @LIBS@
CC = @CC@
INTEL_ARCH = @INTEL_ARCH@
NO_ASMOPT = @NO_ASMOPT@
GENERATIONS = @GENERATIONS@
ifneq ($(SRC_DIR),.)
SRC_DIR_INC = -I$(SRC_DIR)
endif
HAS_MGL = @HAS_MGL@
HAS_GGI = @HAS_GGI@
HAS_SVGA = @HAS_SVGA@
HAS_GLIDE = @HAS_GLIDE@
HAS_TDFXGL = @HAS_TDFXGL@
HAS_OGL = @HAS_OGL@
HAS_XIL = @HAS_XIL@
HAS_X11 = @HAS_X11@
HAS_SDL = @HAS_SDL@
MAKE_SURE_DIR = if test -d "$(BUILD_DIR)/$$DIR"; \
then \
true; \
else \
echo "Creating directory $(BUILD_DIR)/$$DIR"; \
mkdir -p $(BUILD_DIR)/$$DIR; \
fi
######################################################################## ########################################################################
# #
@ -103,9 +57,8 @@ soft_targets = $(SVGAQUAKE) $(GGIQUAKE) $(SDLQUAKE) $(X11QUAKE) $(MGLQUAKE)
gl_targets = $(GLQUAKE) $(TDFXQUAKE) gl_targets = $(GLQUAKE) $(TDFXQUAKE)
lib_targets = $(COMMON_LIB) lib_targets = $(COMMON_LIB)
targets = $(lib_targets) $(soft_targets) $(gl_targets) targets = $(lib_targets) $(soft_targets) $(gl_targets)
CLEAN_TARGETS = $(patsubst %,clean-%, $(targets)) CLEAN_TARGETS = $(patsubst %,clean-%, $(soft_targets) $(gl_targets))
.PHONY: $(targets) $(CLEAN_TARGETS) clean-soft clean-gl clean-common_lib \ .PHONY: $(targets) $(CLEAN_TARGETS)
clean-client
all: $(targets) all: $(targets)
######################################################################## ########################################################################
@ -114,19 +67,13 @@ all: $(targets)
# #
ifneq ($(NO_ASMOPT),yes) ifneq ($(NO_ASMOPT),yes)
# Source file the Intel archictecture only # Source file the Intel archictecture only
CFLAGS = -Did386=1
CL_ADDITIONAL_GENERAL_SRC = sys_dosa.s math.s worlda.s CL_ADDITIONAL_GENERAL_SRC = sys_dosa.s math.s worlda.s
SWREND_SRC_PLAT = d_draw.s d_draw16.s d_parta.s d_polysa.s d_scana.s \ SWREND_SRC_PLAT = d_draw.s d_draw16.s d_parta.s d_polysa.s d_scana.s \
d_spr8.s d_varsa.s r_aclipa.s r_aliasa.s \ d_spr8.s d_varsa.s r_aclipa.s r_aliasa.s \
r_drawa.s r_edgea.s r_varsa.s surf16.s surf8.s r_drawa.s r_edgea.s r_varsa.s surf16.s surf8.s
else else
# Source files for non-Intel platforms # Source files for non-Intel platforms
CFLAGS = -Did386=0
SWREND_SRC_PLAT = nonintel.c SWREND_SRC_PLAT = nonintel.c
endif endif
@ -187,9 +134,9 @@ CL_COMMON_SRC = $(MISC_SRC) $(CL_GUI_SRC) $(CL_SRC) \
# #
# Directory specific stuff # Directory specific stuff
# #
DEFS = @DEFS@ CFLAGS += -DQUAKEWORLD
CFLAGS += @CFLAGS@ -DQUAKEWORLD -DLIBDIR=\"$(libdir)\" $(OPTFLAGS) $(DEFS) \ INCLUDES += -I$(QW_COMMON_DIR)
-I. $(SRC_DIR_INC) -I$(QW_COMMON_DIR) -I$(COMMON_ODIR) -I$(COMMON_DIR) LDFLAGS += @SOUND_LIBS@
GENERAL_SRC = $(CL_COMMON_SRC) \ GENERAL_SRC = $(CL_COMMON_SRC) \
$(QW_CL_SRC) $(QW_NET_SRC) net_chan.c skin.c pcx.c\ $(QW_CL_SRC) $(QW_NET_SRC) net_chan.c skin.c pcx.c\
@ -197,98 +144,6 @@ GENERAL_SRC = $(CL_COMMON_SRC) \
# FIXME: add dos/win specifc source # FIXME: add dos/win specifc source
###########################################################################
#
# Dependency Rules
#
$(DEP_PATTERN): $(SRC_DIR)/%.c
set -e; $(CC) -M $(CFLAGS) $< \
| sed 's%\($*\)\.@OBJEXT@[ :]*%\1.@OBJEXT@ $@ : %g' > $@; \
[ -s $@ ] || rm -f $@
$(DEP_PATTERN): $(SRC_DIR)/%.s
set -e; $(CC) -M $(CFLAGS) -x assembler-with-cpp $< \
| sed 's%\($*\)\.@OBJEXT@[ :]*%\1.@OBJEXT@ $@ : %g' > $@; \
[ -s $@ ] || rm -f $@
$(DEP_PATTERN): $(COMMON_DIR)/%.c
set -e; $(CC) -M $(CFLAGS) $< \
| sed 's%\($*\)\.@OBJEXT@[ :]*%\1.@OBJEXT@ $@ : %g' > $@; \
[ -s $@ ] || rm -f $@
$(DEP_PATTERN): $(COMMON_DIR)/%.s
set -e; $(CC) -M $(CFLAGS) -x assembler-with-cpp $< \
| sed 's%\($*\)\.@OBJEXT@[ :]*%\1.@OBJEXT@ $@ : %g' > $@; \
[ -s $@ ] || rm -f $@
$(DEP_PATTERN): $(QW_COMMON_DIR)/%.c
set -e; $(CC) -M $(CFLAGS) $< \
| sed 's%\($*\)\.@OBJEXT@[ :]*%\1.@OBJEXT@ $@ : %g' > $@; \
[ -s $@ ] || rm -f $@
$(DEP_PATTERN): $(QW_COMMON_DIR)/%.s
set -e; $(CC) -M $(CFLAGS) -x assembler-with-cpp $< \
| sed 's%\($*\)\.@OBJEXT@[ :]*%\1.@OBJEXT@ $@ : %g' > $@; \
[ -s $@ ] || rm -f $@
$(GL_DEP_PATTERN): $(COMMON_DIR)/%.c
set -e; $(CC) -M $(CFLAGS) $(GL_CFLAGS) $< \
| sed 's%\($*\)\.@OBJEXT@[ :]*%\1.@OBJEXT@ $@ : %g' > $@; \
[ -s $@ ] || rm -f $@
$(GL_DEP_PATTERN): $(COMMON_DIR)/%.s
set -e; $(CC) -M $(CFLAGS) $(GL_CFLAGS) -x assembler-with-cpp $< \
| sed 's%\($*\)\.@OBJEXT@[ :]*%\1.@OBJEXT@ $@ : %g' > $@; \
[ -s $@ ] || rm -f $@
###########################################################################
#
# Compilation rules
#
$(OBJ_PATTERN): $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(OBJ_PATTERN): $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(OBJ_PATTERN): $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(OBJ_PATTERN): $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(OBJ_PATTERN): $(QW_COMMON_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(OBJ_PATTERN): $(QW_COMMON_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(GL_OBJ_PATTERN): $(SRC_DIR)/%.c
$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
$(GL_OBJ_PATTERN): $(SRC_DIR)/%.s
$(CC) $(CFLAGS) $(GL_CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(GL_OBJ_PATTERN): $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
$(GL_OBJ_PATTERN): $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) $(GL_CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(GL_OBJ_PATTERN): $(QW_COMMON_DIR)/%.c
$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
$(GL_OBJ_PATTERN): $(QW_COMMON_DIR)/%.s
$(CC) $(CFLAGS) $(GL_CFLAGS) -x assembler-with-cpp -o $@ -c $<
client_DIR:
@DIR=client; $(MAKE_SURE_DIR)
gl_DIR:
@DIR=gl; $(MAKE_SURE_DIR)
########################################################################### ###########################################################################
# #
# Specific target rules # Specific target rules
@ -301,12 +156,9 @@ ALL_COMMON_LIB_OBJS = $(patsubst %,$(BUILD_DIR)/common_lib/%,$(addsuffix \
ALL_COMMON_LIB_DEPS = $(patsubst %,$(BUILD_DIR)/common_lib/%,$(addsuffix .d,\ ALL_COMMON_LIB_DEPS = $(patsubst %,$(BUILD_DIR)/common_lib/%,$(addsuffix .d,\
$(basename $(GENERAL_SRC) .c .s))) $(basename $(GENERAL_SRC) .c .s)))
$(BUILD_DIR)/common_lib: $(COMMON_LIB): $(BUILD_DIR)/common_lib.a
@DIR=common_lib; $(MAKE_SURE_DIR)
$(COMMON_LIB): $(BUILD_DIR)/common_lib $(BUILD_DIR)/common_lib.a $(BUILD_DIR)/common_lib.a: $(ALL_COMMON_LIB_OBJS)
$(BUILD_DIR)/common_lib.a: $(BUILD_DIR)/common_lib $(ALL_COMMON_LIB_OBJS)
ar cru $@ $(ALL_COMMON_LIB_OBJS) ar cru $@ $(ALL_COMMON_LIB_OBJS)
@RANLIB@ $@ @RANLIB@ $@
@ -456,7 +308,7 @@ ifneq ($(GLQUAKE),)
GLX_GL_SRC = gl_vidglx.c dga_check.c in_x11.c context_x11.c GLX_GL_SRC = gl_vidglx.c dga_check.c in_x11.c context_x11.c
ALL_GL_SRC = $(GL_REND_SRC) $(GLX_GL_SRC) ALL_GL_SRC = $(GL_REND_SRC) $(GLX_GL_SRC)
GL_REND_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\ GL_REND_OBJS = $(patsubst %,$(BUILD_DIR)/%,$(addsuffix .@OBJEXT@,\
$(basename $(GL_REND_SRC) .c .s))) $(basename $(GL_REND_SRC) .c .s)))
GLX_GL_OBJS = $(patsubst %,$(BUILD_DIR)/%,$(addsuffix .@OBJEXT@,\ GLX_GL_OBJS = $(patsubst %,$(BUILD_DIR)/%,$(addsuffix .@OBJEXT@,\
@ -474,7 +326,7 @@ $(BUILD_DIR)/gl_vidglx.@OBJEXT@: $(COMMON_DIR)/gl_vidglx.c
$(BUILD_DIR)/dga_check.@OBJEXT@: $(COMMON_DIR)/dga_check.c $(BUILD_DIR)/dga_check.@OBJEXT@: $(COMMON_DIR)/dga_check.c
$(CC) $(CFLAGS) $(X11_CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) $(X11_CFLAGS) -o $@ -c $<
$(GLQUAKE): gl_DIR $(BUILD_DIR)/../$(GLQUAKE) $(GLQUAKE): $(BUILD_DIR)/../$(GLQUAKE)
$(BUILD_DIR)/../$(GLQUAKE): $(ALL_GL_OBJS) $(BUILD_DIR)/../$(GLQUAKE): $(ALL_GL_OBJS)
$(CC) $(CFLAGS) $(ALL_GL_OBJS) $(GL_LDFLAGS) $(LDFLAGS) $(LIBS) \ $(CC) $(CFLAGS) $(ALL_GL_OBJS) $(GL_LDFLAGS) $(LDFLAGS) $(LIBS) \
@ -489,7 +341,7 @@ ifneq ($(TDFXQUAKE),)
ALL_TDFX_SRC = $(GL_REND_SRC) \ ALL_TDFX_SRC = $(GL_REND_SRC) \
gl_vidlinux_3dfx.c in_svgalib.c gl_vidlinux_3dfx.c in_svgalib.c
ALL_TDFX_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\ ALL_TDFX_OBJS = $(patsubst %,$(BUILD_DIR)/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_TDFX_SRC) .c .s))) \ $(basename $(ALL_TDFX_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a $(TARGET_DIR)/sound_lib.a $(BUILD_DIR)/common_lib.a $(TARGET_DIR)/sound_lib.a
@ -499,7 +351,7 @@ TDFX_LDFLAGS = @SVGA_LIBS@ @TDFXGL_LIBS@
$(BUILD_DIR)/gl_vidlinux_3dfx.@OBJEXT@: $(COMMON_DIR)/gl_vidlinux_3dfx.c $(BUILD_DIR)/gl_vidlinux_3dfx.@OBJEXT@: $(COMMON_DIR)/gl_vidlinux_3dfx.c
$(CC) $(CFLAGS) $(TDFX_CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) $(TDFX_CFLAGS) -o $@ -c $<
$(TDFXQUAKE): gl_DIR $(BUILD_DIR)/../$(TDFXQUAKE) $(TDFXQUAKE): $(BUILD_DIR)/../$(TDFXQUAKE)
$(BUILD_DIR)/../$(TDFXQUAKE): $(ALL_TDFX_OBJS) $(BUILD_DIR)/../$(TDFXQUAKE): $(ALL_TDFX_OBJS)
$(CC) $(CFLAGS) $(ALL_TDFX_OBJS) $(TDFX_LDFLAGS) $(LDFLAGS) $(LIBS) \ $(CC) $(CFLAGS) $(ALL_TDFX_OBJS) $(TDFX_LDFLAGS) $(LDFLAGS) $(LIBS) \
@ -519,11 +371,8 @@ distclean: clean
$(CLEAN_TARGETS): $(CLEAN_TARGETS):
rm -f $(BUILD_DIR)/../$(subst clean-,,$@) rm -f $(BUILD_DIR)/../$(subst clean-,,$@)
clean-soft clean-gl clean-client clean-common_lib: clean: $(CLEAN_TARGETS)
rm -f $(BUILD_DIR)/$(subst clean-,,$@)/* -rm -rf $(BUILD_DIR)/*
clean: clean-client clean-common_lib clean-gl $(CLEAN_TARGETS)
-rm -f $(BUILD_DIR)/*
install: $(targets) install: $(targets)
$(PROJECT_DIR)/mkinstalldirs $(DESTDIR)/$(bindir) $(PROJECT_DIR)/mkinstalldirs $(DESTDIR)/$(bindir)

View file

@ -3,34 +3,13 @@
# Quake general stuff # Quake general stuff
# #
PROJECT_DIR = @top_srcdir@ PROJECT_DIR := @top_srcdir@
PROJECT_ODIR = .. BIN_PREFIX := qw-server
SRC_DIR = @srcdir@ SRC_DIR := @srcdir@
QW_COMMON_DIR = $(PROJECT_DIR)/qw_common MODULE := qw_server
COMMON_DIR = $(PROJECT_DIR)/common OBJ_PATTERN = $(BUILD_DIR)/%.@OBJEXT@
COMMON_ODIR = $(PROJECT_ODIR)/common
BIN_PREFIX = qw-server
DESTDIR =
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
mandir = @mandir@
BUILD_DIR = $(PROJECT_ODIR)/targets/qw_server
LDFLAGS = @LDFLAGS@ @NET_LIBS@ -lm
LIBS = @LIBS@
CC = @CC@
INTEL_ARCH = @INTEL_ARCH@
GENERATIONS = @GENERATIONS@
ifneq ($(SRC_DIR),.)
SRC_DIR_INC = -I$(SRC_DIR)
endif
include $(PROJECT_DIR)/Rules.mk
######################################################################## ########################################################################
# #
@ -58,9 +37,7 @@ QW_GENERAL_SRC = pmove.c pmovetst.c
# #
# Directory specific stuff # Directory specific stuff
# #
CFLAGS = @CFLAGS@ -DQUAKEWORLD -DSERVERONLY $(OPTFLAGS) $(DEFS) -I. \ CFLAGS += -DQUAKEWORLD -DSERVERONLY
$(SRC_DIR_INC) -I$(QW_COMMON_DIR) -I$(COMMON_ODIR) -I$(COMMON_DIR)
DEFS = @DEFS@
SRVQUAKE = qw-server SRVQUAKE = qw-server
targets = $(SRVQUAKE) targets = $(SRVQUAKE)
@ -93,25 +70,7 @@ SRV_CFLAGS = -DSRV -DLIBDIR=\"$(libdir)\" $(X_CFLAGS)
# FIXME: Don't use X_EXTRA_LIBS below # FIXME: Don't use X_EXTRA_LIBS below
SRV_LDFLAGS = @X_EXTRA_LIBS@ SRV_LDFLAGS = @X_EXTRA_LIBS@
srv_DIR: $(SRVQUAKE): $(BUILD_DIR)/../$(SRVQUAKE)
mkdir -p $(BUILD_DIR)
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) $(SRV_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) $(SRV_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/%.o: $(QW_COMMON_DIR)/%.c
$(CC) $(CFLAGS) $(SRV_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/%.o: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(SRVQUAKE): srv_DIR $(BUILD_DIR)/../$(SRVQUAKE)
$(BUILD_DIR)/../$(SRVQUAKE): $(ALL_SRV_OBJS) $(BUILD_DIR)/../$(SRVQUAKE): $(ALL_SRV_OBJS)
$(CC) $(CFLAGS) $(ALL_SRV_OBJS) $(SRV_LDFLAGS) $(LDFLAGS) $(LIBS) \ $(CC) $(CFLAGS) $(ALL_SRV_OBJS) $(SRV_LDFLAGS) $(LDFLAGS) $(LIBS) \
@ -130,7 +89,7 @@ clean-qw-server:
rm -f $(BUILD_DIR)/../qw-server rm -f $(BUILD_DIR)/../qw-server
clean: clean-qw-server clean: clean-qw-server
-rm -f $(BUILD_DIR)/* -rm -rf $(BUILD_DIR)
install: $(targets) install: $(targets)
$(PROJECT_DIR)/mkinstalldirs $(DESTDIR)/$(bindir) $(PROJECT_DIR)/mkinstalldirs $(DESTDIR)/$(bindir)

View file

@ -3,58 +3,13 @@
# Quake general stuff # Quake general stuff
# #
PROJECT_DIR = @top_srcdir@ PROJECT_DIR := @top_srcdir@
PROJECT_ODIR = .. BIN_PREFIX := uquake
SRC_DIR = @srcdir@ SRC_DIR := @srcdir@
COMMON_DIR = $(PROJECT_DIR)/common MODULE := uquake
COMMON_ODIR = $(PROJECT_ODIR)/common OBJ_PATTERN = $(BUILD_DIR)/common_lib/%.@OBJEXT@ $(BUILD_DIR)/%.@OBJEXT@
BIN_PREFIX = uquake
DESTDIR =
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
mandir = @mandir@
TARGET_DIR = $(PROJECT_ODIR)/targets
BUILD_DIR = $(TARGET_DIR)/uquake
LDFLAGS = @LDFLAGS@ @SOUND_LIBS@ @NET_LIBS@ -lm
LIBS = @LIBS@
CC = @CC@
INTEL_ARCH = @INTEL_ARCH@
NO_ASMOPT = @NO_ASMOPT@
GENERATIONS = @GENERATIONS@
ifneq ($(SRC_DIR),.)
SRC_DIR_INC = -I$(SRC_DIR)
endif
HAS_DGA = @HAS_DGA@
HAS_VGA = @HAS_VGA@
HAS_MGL = @HAS_MGL@
HAS_GGI = @HAS_GGI@
HAS_SVGA = @HAS_SVGA@
HAS_GLIDE = @HAS_GLIDE@
HAS_TDFXGL = @HAS_TDFXGL@
HAS_OGL = @HAS_OGL@
HAS_XIL = @HAS_XIL@
HAS_X11 = @HAS_X11@
HAS_SDL = @HAS_SDL@
HAVE_WSOCK = @HAVE_WSOCK@
HAVE_UDP = @HAVE_UDP@
MAKE_SURE_DIR = if test -d "$(BUILD_DIR)/$$DIR"; \
then \
true; \
else \
echo "Creating directory $(BUILD_DIR)/$$DIR"; \
mkdir -p $(BUILD_DIR)/$$DIR; \
fi
include $(PROJECT_DIR)/Rules.mk
######################################################################## ########################################################################
# #
@ -95,19 +50,12 @@ ifeq ($(HAS_SDL),yes)
SDLQUAKE = $(BIN_PREFIX)-sdl SDLQUAKE = $(BIN_PREFIX)-sdl
endif endif
RELEASE = @RELEASE@
ifeq ($(RELEASE),yes)
OPTFLAGS = @RELEASE_CFLAGS@
else
OPTFLAGS = -g
endif
soft_targets = $(X11QUAKE) $(SVGAQUAKE) $(GGIQUAKE) $(SDLQUAKE) $(MGLQUAKE) \ soft_targets = $(X11QUAKE) $(SVGAQUAKE) $(GGIQUAKE) $(SDLQUAKE) $(MGLQUAKE) \
$(VGAQUAKE) $(VGAQUAKE)
gl_targets = $(GLQUAKE) $(TDFXQUAKE) gl_targets = $(GLQUAKE) $(TDFXQUAKE)
lib_targets = $(COMMON_LIB) lib_targets = $(COMMON_LIB)
targets = $(lib_targets) $(gl_targets) $(soft_targets) targets = $(lib_targets) $(gl_targets) $(soft_targets)
CLEAN_TARGETS = $(patsubst %,clean-%, $(targets)) CLEAN_TARGETS = $(patsubst %,clean-%, $(gl_targets) $(soft_targets))
.PHONY: $(targets) $(CLEAN_TARGETS) clean-soft clean-gl .PHONY: $(targets) $(CLEAN_TARGETS) clean-soft clean-gl
all: $(targets) all: $(targets)
@ -117,11 +65,8 @@ all: $(targets)
# Source files # Source files
# #
ifneq ($(NO_ASMOPT),yes) ifeq ($(ASM_ARCH),i386)
# Source file the Intel archictecture only # Source file the Intel archictecture only
CFLAGS = -Did386=1
UQ_GENERAL_SRC = worlda.s UQ_GENERAL_SRC = worlda.s
UQ_SWREND_SRC_PLAT = dosasm.s UQ_SWREND_SRC_PLAT = dosasm.s
CL_ADDITIONAL_GENERAL_SRC = sys_dosa.s math.s CL_ADDITIONAL_GENERAL_SRC = sys_dosa.s math.s
@ -129,10 +74,7 @@ SWREND_SRC_PLAT = d_draw.s d_draw16.s d_parta.s d_polysa.s d_scana.s \
d_spr8.s d_varsa.s r_aclipa.s r_aliasa.s \ d_spr8.s d_varsa.s r_aclipa.s r_aliasa.s \
r_drawa.s r_edgea.s r_varsa.s surf16.s surf8.s r_drawa.s r_edgea.s r_varsa.s surf16.s surf8.s
else else
# Source files for non-Intel platforms # Source files for non-Intel platforms
CFLAGS = -Did386=0
SWREND_SRC_PLAT = nonintel.c SWREND_SRC_PLAT = nonintel.c
endif endif
@ -199,9 +141,8 @@ CL_COMMON_SRC = $(MISC_SRC) $(CL_GUI_SRC) $(CL_SRC) \
# #
# Directory specific stuff # Directory specific stuff
# #
DEFS = @DEFS@ CFLAGS += -DUQUAKE
CFLAGS += @CFLAGS@ -DUQUAKE -DLIBDIR=\"$(libdir)\" $(OPTFLAGS) \ LDFLAGS += @SOUND_LIBS@
$(DEFS) -I. $(SRC_DIR_INC) -I$(COMMON_ODIR) -I$(COMMON_DIR)
GENERAL_SRC = $(CL_COMMON_SRC) \ GENERAL_SRC = $(CL_COMMON_SRC) \
$(SYS_SRC) world.c $(SRV_PR_SRC) \ $(SYS_SRC) world.c $(SRV_PR_SRC) \
@ -210,53 +151,6 @@ GENERAL_SRC = $(CL_COMMON_SRC) \
# FIXME: add dos/win specific source # FIXME: add dos/win specific source
###########################################################################
#
# Compilation rules
#
# Common lib targets.
$(BUILD_DIR)/common_lib/%.@OBJEXT@: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(BUILD_DIR)/common_lib/%.@OBJEXT@: $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/common_lib/%.@OBJEXT@: $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(BUILD_DIR)/common_lib/%.@OBJEXT@: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
# Software targets
$(BUILD_DIR)/%.@OBJEXT@: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(BUILD_DIR)/%.@OBJEXT@: $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/%.@OBJEXT@: $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(BUILD_DIR)/%.@OBJEXT@: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
# GL targets
$(BUILD_DIR)/%.@OBJEXT@: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/%.@OBJEXT@: $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/%.@OBJEXT@: $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/%.@OBJEXT@: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
########################################################################### ###########################################################################
# #
# Specific target rules # Specific target rules
@ -266,10 +160,7 @@ $(BUILD_DIR)/%.@OBJEXT@: $(COMMON_DIR)/%.s
ALL_COMMON_LIB_OBJS = $(patsubst %,$(BUILD_DIR)/common_lib/%,$(addsuffix \ ALL_COMMON_LIB_OBJS = $(patsubst %,$(BUILD_DIR)/common_lib/%,$(addsuffix \
.@OBJEXT@, $(basename $(GENERAL_SRC) .c .s))) .@OBJEXT@, $(basename $(GENERAL_SRC) .c .s)))
common_lib_DIR: $(COMMON_LIB): $(BUILD_DIR)/common_lib.a
@DIR=common_lib; $(MAKE_SURE_DIR)
$(COMMON_LIB): common_lib_DIR $(BUILD_DIR)/common_lib.a
$(BUILD_DIR)/common_lib.a: $(ALL_COMMON_LIB_OBJS) $(BUILD_DIR)/common_lib.a: $(ALL_COMMON_LIB_OBJS)
ar cru $@ $(ALL_COMMON_LIB_OBJS) ar cru $@ $(ALL_COMMON_LIB_OBJS)
@ -510,11 +401,8 @@ distclean: clean
$(CLEAN_TARGETS): $(CLEAN_TARGETS):
rm -f $(BUILD_DIR)/../$(subst clean-,,$@) rm -f $(BUILD_DIR)/../$(subst clean-,,$@)
clean-soft clean-gl clean-common_lib: clean: $(CLEAN_TARGETS)
rm -f $(BUILD_DIR)/$(subst clean-,,$@)/* -rm -rf $(BUILD_DIR)
clean: clean-soft clean-gl clean-common_lib $(CLEAN_TARGETS)
-rm -f $(BUILD_DIR)/*
install: $(targets) install: $(targets)
$(PROJECT_DIR)/mkinstalldirs $(DESTDIR)/$(bindir) $(PROJECT_DIR)/mkinstalldirs $(DESTDIR)/$(bindir)