Merged the makefile targets as much as is safe to do without a serious

code alteration.  Cut my build time from 20 minutes down to about 5 from
an autoconf-clean tree.
This commit is contained in:
Joseph Carter 2000-01-05 19:10:52 +00:00
parent b68f84619e
commit 4ebf133971
6 changed files with 329 additions and 513 deletions

View file

@ -42,7 +42,6 @@ configure: configure.in acconfig.h
Makefile: Makefile.in configure \ Makefile: Makefile.in configure \
qw_client/Makefile qw_server/Makefile uquake/Makefile qw_client/Makefile qw_server/Makefile uquake/Makefile
./configure
qw_client/Makefile: qw_client/Makefile.in configure qw_client/Makefile: qw_client/Makefile.in configure
./configure ./configure

View file

@ -114,7 +114,12 @@ void CDAudio_Update()
int CDAudio_Init() int CDAudio_Init()
{ {
if((cls.state == ca_dedicated) || COM_CheckParm("-nocdaudio")) #ifndef QUAKEWORLD
if (cls.state == ca_dedicated)
return -1;
#endif
if (COM_CheckParm("-nocdaudio"))
return -1; return -1;
cd_id = SDL_CDOpen(0); cd_id = SDL_CDOpen(0);

View file

@ -17,10 +17,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#if defined(__linux__)
#if defined(SDL)
# include "cd_sdl.c"
#elif defined(__linux__)
# include "cd_linux.c" # include "cd_linux.c"
#elif defined(_WIN32) #elif defined(_WIN32)
# include "cd_win.c" # include "cd_win.c"

View file

@ -23,10 +23,8 @@ extern cvar_t v_gamma;
extern byte gammatable[256]; // palette is sent through this extern byte gammatable[256]; // palette is sent through this
extern byte ramps[3][256]; extern byte ramps[3][256];
//#ifdef GLQUAKE
extern float v_blend[4]; extern float v_blend[4];
extern cvar_t lcd_x; extern cvar_t lcd_x;
//#endif
void V_Init (void); void V_Init (void);
void V_RenderView (void); void V_RenderView (void);

View file

@ -87,28 +87,22 @@ else
OPTFLAGS = -g OPTFLAGS = -g
endif endif
targets = $(MGLQUAKE) $(GGIQUAKE) $(SVGAQUAKE) $(GLQUAKE) $(TDFXQUAKE) $(X11QUAKE) $(SDLQUAKE) soft_targets = $(X11QUAKE) $(SVGAQUAKE) $(GGIQUAKE) $(SDLQUAKE)
gl_targets = $(GLQUAKE) $(TDFXQUAKE) $(MGLQUAKE)
targets = $(gl_targets) $(soft_targets)
CLEAN_TARGETS = $(patsubst %,clean-%, $(targets)) CLEAN_TARGETS = $(patsubst %,clean-%, $(targets))
.PHONY: $(targets) ($CLEAN_TARGETS) .PHONY: $(targets) $(CLEAN_TARGETS) clean-soft clean-gl
x: Makefile
@echo binaries: $(targets)
@echo other targets: distclean
@echo all: makes all targets - $(targets)
all: $(targets) all: $(targets)
######################################################################## ########################################################################
# #
# Source files # Source files
# #
# **** Note - two apps may appear to share source, but they may just share
# source file *names*
ifeq ($(INTEL_ARCH),yes) ifeq ($(INTEL_ARCH),yes)
# Source file the Intel archictecture only # Source file the Intel archictecture only
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
@ -117,16 +111,17 @@ SWREND_SRC_PLAT = d_draw.s d_draw16.s d_parta.s d_polysa.s d_scana.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
XTRA_SND_SRC = snd_mixa.s XTRA_SND_SRC = snd_mixa.s
else else
# Source files for non-Intel platforms # Source files for non-Intel platforms
SWREND_SRC_PLAT = nonintel.c SWREND_SRC_PLAT = nonintel.c
endif endif
#
# System specific source files # System specific source files
#
CD_AUDIO_SRC = cd_wrapper.c CD_AUDIO_SRC = cd_wrapper.c
# sound # Sound source
SND_STYLE = @SND_STYLE@ SND_STYLE = @SND_STYLE@
SND_SRC = snd_null.c SND_SRC = snd_null.c
@ -149,64 +144,52 @@ endif
SND_SRC += snd_mem.c snd_mix.c $(XTRA_SND_SRC) SND_SRC += snd_mem.c snd_mix.c $(XTRA_SND_SRC)
X11_VID_SRC = @X11_VID_SRC@
QW_X11_VID_SRC = vid_x.c
SYS_SRC = @SYS_SRC@ SYS_SRC = @SYS_SRC@
QW_CL_SYS_SRC = @QW_CL_SYS_SRC@
QW_SRV_SYS_SRC = @QW_SRV_SYS_SRC@
#
# Networking source files # Networking source files
# # FIXME: Should not assume UNIX
QW_NET_SRC = net_udp.c net_com.c mdfour.c QW_NET_SRC = net_udp.c net_com.c mdfour.c
#
# Common source files # Common source files
#
MISC_SRC = common.c crc.c cvar.c cmd.c mathlib.c register_check.c wad.c zone.c
# MISC_SRC = common.c crc.c cvar.c cmd.c mathlib.c register_check.c \
# Rendering source files wad.c zone.c
#
# GL renderer source
# OpenGL
GL_REND_SRC = gl_screen.c gl_model.c gl_draw.c gl_mesh.c gl_refrag.c \ GL_REND_SRC = gl_screen.c gl_model.c gl_draw.c gl_mesh.c gl_refrag.c \
gl_rlight.c gl_rmain.c gl_rmisc.c gl_rsurf.c gl_warp.c nonintel.c gl_rlight.c gl_rmain.c gl_rmisc.c gl_rsurf.c gl_warp.c \
nonintel.c gl_ngraph.c
# gl_rlight.c gl_rmain.c gl_rmisc.c gl_rsurf.c gl_test.c gl_warp.c # gl_rlight.c gl_rmain.c gl_rmisc.c gl_rsurf.c gl_test.c gl_warp.c
QW_GL_REND_SRC = gl_ngraph.c
# Software source # Software renderer source
SW_REND_SRC = screen.c $(SWREND_SRC_PLAT) draw.c \ SW_REND_SRC = screen.c $(SWREND_SRC_PLAT) draw.c \
d_edge.c d_fill.c d_init.c d_modech.c d_part.c d_polyse.c d_scan.c \ d_edge.c d_fill.c d_init.c d_modech.c d_part.c d_polyse.c d_scan.c \
d_sky.c d_sprite.c d_surf.c d_vars.c d_zpoint.c r_aclip.c r_alias.c \ d_sky.c d_sprite.c d_surf.c d_vars.c d_zpoint.c r_aclip.c r_alias.c \
r_bsp.c r_draw.c r_edge.c r_efrag.c r_light.c r_main.c r_misc.c \ r_bsp.c r_draw.c r_edge.c r_efrag.c r_light.c r_main.c r_misc.c \
r_sky.c r_sprite.c r_surf.c r_vars.c r_sky.c r_sprite.c r_surf.c r_vars.c
#
# Client source files # Client source files
#
CL_SRC = cl_demo.c cl_input.c cl_main.c cl_parse.c cl_tent.c CL_SRC = cl_demo.c cl_input.c cl_main.c cl_parse.c cl_tent.c
QW_CL_SRC = cl_cam.c cl_ents.c cl_pred.c QW_CL_SRC = cl_cam.c cl_ents.c cl_pred.c
CL_GUI_SRC= console.c sbar.c view.c keys.c menu.c CL_GUI_SRC= console.c sbar.c view.c keys.c menu.c
#
# Server source files # Server source files
#
# Server-related source used by all
SRV_SRC = sv_main.c sv_user.c sv_move.c sv_phys.c SRV_SRC = sv_main.c sv_user.c sv_move.c sv_phys.c
# Server-related source used just by QW server
QW_SRV_SRC = sv_ccmds.c sv_ents.c sv_init.c sv_send.c sv_nchan.c world.c QW_SRV_SRC = sv_ccmds.c sv_ents.c sv_init.c sv_send.c sv_nchan.c world.c
# Server-related source used just by UQ
UQ_SRV_SRC = host.c host_cmd.c $(SRV_SRC)
SRV_PR_SRC = pr_cmds.c pr_edict.c pr_exec.c SRV_PR_SRC = pr_cmds.c pr_edict.c pr_exec.c
QW_GENERAL_SRC = pmove.c pmovetst.c QW_GENERAL_SRC = pmove.c pmovetst.c
# Source common to both UQ and QW-client # Source common to QW/UQuake
CL_COMMON_SRC = $(MISC_SRC) $(CL_GUI_SRC) $(CL_SRC) \ CL_COMMON_SRC = $(MISC_SRC) $(CL_GUI_SRC) $(CL_SRC) \
$(CL_ADDITIONAL_GENERAL_SRC) $(SND_SRC) $(CD_AUDIO_SRC) r_part.c $(CL_ADDITIONAL_GENERAL_SRC) $(SND_SRC) r_part.c
######################################################################## ########################################################################
# #
@ -215,187 +198,180 @@ CL_COMMON_SRC = $(MISC_SRC) $(CL_GUI_SRC) $(CL_SRC) \
DEFS = @DEFS@ DEFS = @DEFS@
CFLAGS = @CFLAGS@ -Wall -DQUAKEWORLD $(OPTFLAGS) $(DEFS) -I. \ CFLAGS = @CFLAGS@ -Wall -DQUAKEWORLD $(OPTFLAGS) $(DEFS) -I. \
$(SRC_DIR_INC) -I$(QW_COMMON_DIR) -I$(COMMON_ODIR) -I$(COMMON_DIR) $(SRC_DIR_INC) -I$(QW_COMMON_DIR) -I$(COMMON_ODIR) -I$(COMMON_DIR)
ALL_X11_SRC = $(GENERAL_SRC) $(SW_REND_SRC) $(QW_X11_VID_SRC) model.c
ALL_GL_SRC = $(GENERAL_SRC) $(GL_REND_SRC) $(GL_VID_SRC) $(QW_GL_REND_SRC)
ALL_TDFX_SRC = $(GENERAL_SRC) $(GL_REND_SRC) $(TDFX_VID_SRC) $(QW_GL_REND_SRC)
GENERAL_SRC = $(CL_COMMON_SRC) \ GENERAL_SRC = $(CL_COMMON_SRC) \
$(QW_CL_SRC) $(QW_NET_SRC) net_chan.c skin.c \ $(QW_CL_SRC) $(QW_NET_SRC) net_chan.c skin.c \
$(QW_CL_SYS_SRC) \ $(SYS_SRC) $(QW_GENERAL_SRC)
$(QW_GENERAL_SRC)
# XXX - add dos/win specifc source # FIXME: add dos/win specifc source
########################################################################### ###########################################################################
# #
# Compilation rules # Compilation rules
# #
# Software targets
soft_DIR:
@DIR=soft; $(MAKE_SURE_DIR)
$(BUILD_DIR)/soft/%.@OBJEXT@: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(BUILD_DIR)/soft/%.@OBJEXT@: $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/soft/%.@OBJEXT@: $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(BUILD_DIR)/soft/%.@OBJEXT@: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/soft/%.o: $(QW_COMMON_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
# GL targets
gl_DIR:
@DIR=gl; $(MAKE_SURE_DIR)
$(BUILD_DIR)/gl/%.@OBJEXT@: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/gl/%.@OBJEXT@: $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/gl/%.@OBJEXT@: $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/gl/%.@OBJEXT@: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/gl/%.o: $(QW_COMMON_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
########################################################################### ###########################################################################
# #
# qw-client-x11 # Specific target rules
# #
# X11 Software target
ifneq ($(X11QUAKE),) ifneq ($(X11QUAKE),)
# Map the list of source files into a list of object files ALL_X11_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) @X11_VID_SRC@\
OBJSquake-x11 = $(patsubst %,$(BUILD_DIR)/x11/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_X11_SRC) .c .s))) model.c
ALL_X11_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_X11_SRC) .c .s)))
X11_CFLAGS = -DX11 @X_CFLAGS@ X11_CFLAGS = -DX11 @X_CFLAGS@
X11_LDFLAGS = @X_LIBS@ -lX11 @X11_SHM_LIB@ @X_EXTRA_LIBS@ X11_LDFLAGS = @X_LIBS@ -lX11 @X11_SHM_LIB@ @X_EXTRA_LIBS@
# This can be thought of as a macro that makes sure that the x11 # FIXME: This rule is pathological because of the seperate sunx driver,
# sub-directory is created # either merge it into vid_x.c or make a seperate sun target. In either
x11_DIR: # case, find the moro^wpeople responsible for this and other stupidities
@DIR=x11; $(MAKE_SURE_DIR) # in Solaris and "educate" them.
$(BUILD_DIR)/soft/$(addsuffix .@OBJEXT@,$(basename @X11_VID_SRC@ .c)):\
$(BUILD_DIR)/x11/%.o: $(SRC_DIR)/%.c $(COMMON_DIR)/@X11_VID_SRC@
$(MAKE_SURE_x11_DIR)
$(CC) $(CFLAGS) $(X11_CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) $(X11_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/x11/%.o: $(SRC_DIR)/%.s $(X11QUAKE): soft_DIR $(BUILD_DIR)/../$(X11QUAKE)
$(MAKE_SURE_x11_DIR)
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/x11/%.o: $(COMMON_DIR)/%.c $(BUILD_DIR)/../$(X11QUAKE): $(ALL_X11_OBJS)
$(MAKE_SURE_x11_DIR) $(CC) $(CFLAGS) $(ALL_X11_OBJS) $(X11_LDFLAGS) $(LDFLAGS) \
$(CC) $(CFLAGS) $(X11_CFLAGS) -o $@ -c $< -o $(BUILD_DIR)/../$(X11QUAKE)
ifneq ($(QW_COMMON_DIR),)
$(BUILD_DIR)/x11/%.o: $(QW_COMMON_DIR)/%.c
$(MAKE_SURE_x11_DIR)
$(CC) $(CFLAGS) $(X11_CFLAGS) -o $@ -c $<
endif endif
$(BUILD_DIR)/x11/%.o: $(COMMON_DIR)/%.s # SVGALib software target
$(MAKE_SURE_x11_DIR)
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(X11QUAKE): x11_DIR $(BUILD_DIR)/../$(X11QUAKE)
$(BUILD_DIR)/../$(X11QUAKE): $(OBJSquake-x11)
$(CC) $(CFLAGS) $(OBJSquake-x11) $(X11_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(X11QUAKE)
# XXX - Can this be automated?
clean-$(X11QUAKE):
rm -rf $(BUILD_DIR)/x11
endif
###########################################################################
#
# qw-client-svga
#
ifneq ($(SVGAQUAKE),) ifneq ($(SVGAQUAKE),)
ALL_SVGA_SRC = $(GENERAL_SRC) $(SW_REND_SRC) $(SVGA_VID_SRC) model.c ALL_SVGA_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) vid_svgalib.c\
OBJSquake-svga= $(patsubst %,$(BUILD_DIR)/svga/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_SVGA_SRC) .c .s))) d_copy.s model.c
ALL_SVGA_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_SVGA_SRC) .c .s)))
SVGA_CFLAGS = @SVGA_CFLAGS@ SVGA_CFLAGS = @SVGA_CFLAGS@
SVGA_LDFLAGS = @SVGA_LIBS@ SVGA_LDFLAGS = @SVGA_LIBS@
SVGA_VID_SRC = vid_svgalib.c d_copy.s
# This can be thought of as a macro that makes sure that the x11
# sub-directory is created
svga_DIR:
@DIR=svga; $(MAKE_SURE_DIR)
# Not sure why this -O is needed, but it is... # Not sure why this -O is needed, but it is...
$(BUILD_DIR)/svga/vid_svgalib.o: $(COMMON_DIR)/vid_svgalib.c $(BUILD_DIR)/soft/vid_svgalib.@OBJEXT@: $(COMMON_DIR)/vid_svgalib.c
$(MAKE_SURE_svga_DIR)
$(CC) -O $(CFLAGS) $(SVGA_CFLAGS) -o $@ -c $< $(CC) -O $(CFLAGS) $(SVGA_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/svga/%.o: $(SRC_DIR)/%.c $(BUILD_DIR)/soft/d_copy.@OBJEXT@: $(COMMON_DIR)/d_copy.s
$(MAKE_SURE_svga_DIR)
$(CC) $(CFLAGS) $(SVGA_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/svga/%.o: $(SRC_DIR)/%.s
$(MAKE_SURE_svga_DIR)
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< $(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/svga/%.o: $(COMMON_DIR)/%.c $(SVGAQUAKE): soft_DIR $(BUILD_DIR)/../$(SVGAQUAKE)
$(MAKE_SURE_svga_DIR)
$(CC) $(CFLAGS) $(SVGA_CFLAGS) -o $@ -c $< $(BUILD_DIR)/../$(SVGAQUAKE): $(ALL_SVGA_OBJS)
$(CC) $(CFLAGS) $(ALL_SVGA_OBJS) $(SVGA_LDFLAGS) $(LDFLAGS)\
-o $(BUILD_DIR)/../$(SVGAQUAKE)
ifneq ($(QW_COMMON_DIR),)
$(BUILD_DIR)/svga/%.o: $(QW_COMMON_DIR)/%.c
$(MAKE_SURE_svga_DIR)
$(CC) $(CFLAGS) $(SVGA_CFLAGS) -o $@ -c $<
endif endif
$(BUILD_DIR)/svga/%.o: $(COMMON_DIR)/%.s # GGI software target
$(MAKE_SURE_svga_DIR)
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(SVGAQUAKE): svga_DIR $(BUILD_DIR)/../$(SVGAQUAKE)
$(BUILD_DIR)/../$(SVGAQUAKE): $(OBJSquake-svga)
$(CC) $(CFLAGS) $(OBJSquake-svga) $(SVGA_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(SVGAQUAKE)
# XXX - Can this be automated?
clean-$(SVGAQUAKE):
rm -rf $(BUILD_DIR)/svga
endif
###########################################################################
#
# qw-client-ggi
#
ifneq ($(GGIQUAKE),) ifneq ($(GGIQUAKE),)
# Map the list of source files into a list of object files # Map the list of source files into a list of object files
ALL_GGI_SRC = $(GENERAL_SRC) $(SW_REND_SRC) $(GGI_VID_SRC) model.c ALL_GGI_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) vid_ggi.c\
OBJSquake-ggi = $(patsubst %,$(BUILD_DIR)/ggi/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_GGI_SRC) .c .s))) model.c
ALL_GGI_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_GGI_SRC) .c .s)))
GGI_SRC = vid_ggi.c
GGI_CFLAGS = -DGGI @GGI_CFLAGS@ GGI_CFLAGS = -DGGI @GGI_CFLAGS@
GGI_LDFLAGS = @GGI_LIBS@ GGI_LDFLAGS = @GGI_LIBS@
GGI_VID_SRC = vid_ggi.c
# This can be thought of as a macro that makes sure that the ggi $(BUILD_DIR)/soft/vid_ggi.@OBJEXT@: $(COMMON_DIR)/vid_ggi.c
# sub-directory is created
ggi_DIR:
@DIR=ggi; $(MAKE_SURE_DIR)
$(BUILD_DIR)/ggi/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) $(GGI_CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) $(GGI_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/ggi/%.o: $(SRC_DIR)/%.s $(GGIQUAKE): soft_DIR $(BUILD_DIR)/../$(GGIQUAKE)
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/ggi/%.o: $(COMMON_DIR)/%.c $(BUILD_DIR)/../$(GGIQUAKE): $(ALL_GGI_OBJS)
$(CC) $(CFLAGS) $(GGI_CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) $(ALL_GGI_OBJS) $(GGI_LDFLAGS) $(LDFLAGS) \
-o $(BUILD_DIR)/../$(GGIQUAKE)
ifneq ($(QW_COMMON_DIR),)
$(BUILD_DIR)/ggi/%.o: $(QW_COMMON_DIR)/%.c
$(CC) $(CFLAGS) $(GGI_CFLAGS) -o $@ -c $<
endif endif
$(BUILD_DIR)/ggi/%.o: $(COMMON_DIR)/%.s # SDL software target
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(GGIQUAKE): ggi_DIR $(BUILD_DIR)/../$(GGIQUAKE) ifneq ($(SDLQUAKE),)
ALL_SDL_SRC = $(GENERAL_SRC) $(SW_REND_SRC) $(SDL_SRC) vid_sdl.c cd_sdl.c\
model.c
ALL_SDL_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_SDL_SRC) .c .s)))
SDL_CFLAGS = @SDL_CFLAGS@ -DSDL
SDL_LDFLAGS = @SDL_LIBS@
$(BUILD_DIR)/soft/vid_sdl.@OBJEXT@: $(COMMON_DIR)/vid_sdl.c
$(CC) $(CFLAGS) $(SDL_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/soft/cd_sdl.@OBJEXT@: $(COMMON_DIR)/cd_sdl.c
$(CC) $(CFLAGS) $(SDL_CFLAGS) -o $@ -c $<
$(SDLQUAKE): soft_DIR $(BUILD_DIR)/../$(SDLQUAKE)
$(BUILD_DIR)/../$(SDLQUAKE): $(ALL_SDL_OBJS)
$(CC) $(CFLAGS) $(ALL_SDL_OBJS) $(SDL_LDFLAGS) $(LDFLAGS) \
-o $(BUILD_DIR)/../$(SDLQUAKE)
$(BUILD_DIR)/../$(GGIQUAKE): $(OBJSquake-ggi)
$(CC) $(CFLAGS) $(OBJSquake-ggi) $(GGI_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(GGIQUAKE)
# XXX - Can this be automated?
clean-$(GGIQUAKE):
rm -rf $(BUILD_DIR)/ggi
endif endif
# mingw32 GL target
# FIXME: Rewrite this entire section!
###########################################################################
#
# qw-client-mgl
#
ifneq ($(MGLQUAKE),) ifneq ($(MGLQUAKE),)
# Map the list of source files into a list of object files # Map the list of source files into a list of object files
ALL_MGL_SRC = $(GENERAL_SRC) $(SW_REND_SRC) $(MGL_VID_SRC) model.c ALL_MGL_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) $(MGL_VID_SRC)\
model.c
OBJSquake-mgl = $(patsubst %,$(BUILD_DIR)/mgl/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_MGL_SRC) .c .s))) OBJSquake-mgl = $(patsubst %,$(BUILD_DIR)/mgl/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_MGL_SRC) .c .s)))
MGL_CFLAGS = -DMGL @MGL_CFLAGS@ MGL_CFLAGS = -DMGL @MGL_CFLAGS@
MGL_LDFLAGS = @MGL_LIBS@ -lm MGL_LDFLAGS = @MGL_LIBS@ -lm
MGL_VID_SRC = vid_win.c in_win.c MGL_VID_SRC = vid_win.c in_win.c conproc.c
# This can be thought of as a macro that makes sure that the mgl
# sub-directory is created
# XXX - can we avoid doing every compile?
MAKE_SURE_mgl_DIR = @DIR=mgl; $(MAKE_SURE_DIR) MAKE_SURE_mgl_DIR = @DIR=mgl; $(MAKE_SURE_DIR)
$(BUILD_DIR)/mgl/%.o: $(SRC_DIR)/%.c $(BUILD_DIR)/mgl/%.o: $(SRC_DIR)/%.c
@ -410,12 +386,6 @@ $(BUILD_DIR)/mgl/%.o: $(COMMON_DIR)/%.c
$(MAKE_SURE_mgl_DIR) $(MAKE_SURE_mgl_DIR)
$(CC) $(CFLAGS) $(MGL_CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) $(MGL_CFLAGS) -o $@ -c $<
ifneq ($(QW_COMMON_DIR),)
$(BUILD_DIR)/mgl/%.o: $(QW_COMMON_DIR)/%.c
$(MAKE_SURE_mgl_DIR)
$(CC) $(CFLAGS) $(MGL_CFLAGS) -o $@ -c $<
endif
$(BUILD_DIR)/mgl/%.o: $(COMMON_DIR)/%.s $(BUILD_DIR)/mgl/%.o: $(COMMON_DIR)/%.s
$(MAKE_SURE_mgl_DIR) $(MAKE_SURE_mgl_DIR)
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $< $(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
@ -424,156 +394,69 @@ $(MGLQUAKE): $(BUILD_DIR)/../$(MGLQUAKE)
$(BUILD_DIR)/../$(MGLQUAKE): $(OBJSquake-mgl) $(BUILD_DIR)/../$(MGLQUAKE): $(OBJSquake-mgl)
$(CC) $(CFLAGS) $(OBJSquake-mgl) $(MGL_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(MGLQUAKE) $(CC) $(CFLAGS) $(OBJSquake-mgl) $(MGL_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(MGLQUAKE)
# XXX - Can this be automated?
clean-$(MGLQUAKE):
rm -rf $(BUILD_DIR)/mgl
endif endif
# X11 GL target
###########################################################################
#
# qw-client-gl
#
ifneq ($(GLQUAKE),) ifneq ($(GLQUAKE),)
OBJSquake-gl = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_GL_SRC) .c .s))) ALL_GL_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(GL_REND_SRC) gl_vidlinuxglx.c
ALL_GL_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_GL_SRC) .c .s)))
GL_CFLAGS = -DGLQUAKE @OGL_CFLAGS@ GL_CFLAGS = -DGLQUAKE @OGL_CFLAGS@
GL_LDFLAGS = $(X11_LDFLAGS) @OGL_LIBS@ GL_LDFLAGS = $(X11_LDFLAGS) @OGL_LIBS@
# XXX - is this platform independent?
GL_VID_SRC = gl_vidlinuxglx.c
# This can be thought of as a macro that makes sure that the x11 $(BUILD_DIR)/gl/vid_linuxglx.o: $(COMMON_DIR)/vid_linuxglx.c
# sub-directory is created
gl_DIR:
@DIR=gl; $(MAKE_SURE_DIR)
$(BUILD_DIR)/gl/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/gl/%.o: $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/gl/%.o: $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
ifneq ($(QW_COMMON_DIR),)
$(BUILD_DIR)/gl/%.o: $(QW_COMMON_DIR)/%.c
$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
endif
$(BUILD_DIR)/gl/%.o: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(GLQUAKE): gl_DIR $(BUILD_DIR)/../$(GLQUAKE) $(GLQUAKE): gl_DIR $(BUILD_DIR)/../$(GLQUAKE)
$(BUILD_DIR)/../$(GLQUAKE): $(OBJSquake-gl) $(BUILD_DIR)/../$(GLQUAKE): $(ALL_GL_OBJS)
$(CC) $(CFLAGS) $(OBJSquake-gl) $(GL_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(GLQUAKE) $(CC) $(CFLAGS) $(ALL_GL_OBJS) $(GL_LDFLAGS) $(LDFLAGS) \
-o $(BUILD_DIR)/../$(GLQUAKE)
# XXX - Can this be automated?
clean-$(GLQUAKE):
rm -rf $(BUILD_DIR)/gl
endif endif
########################################################################### # 3Dfx GL MCD target
#
# qw-client-3dfx
#
ifneq ($(TDFXQUAKE),) ifneq ($(TDFXQUAKE),)
OBJSquake-3dfx = $(patsubst %,$(BUILD_DIR)/3dfx/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_TDFX_SRC) .c .s))) ALL_TDFX_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(GL_REND_SRC)\
gl_vidlinux_3dfx.c
ALL_TDFX_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_TDFX_SRC) .c .s)))
TDFX_CFLAGS = -DGLQUAKE @OGL_CFLAGS@ @GLIDE_CFLAGS@ TDFX_CFLAGS = -DGLQUAKE @OGL_CFLAGS@ @GLIDE_CFLAGS@
TDFX_LDFLAGS = @SVGA_LIBS@ @TDFXGL_LIBS@ TDFX_LDFLAGS = @SVGA_LIBS@ @TDFXGL_LIBS@
TDFX_VID_SRC = gl_vidlinux_3dfx.c
# This can be thought of as a macro that makes sure that the x11 $(BUILD_DIR)/gl/gl_vidlinux_3dfx.@OBJEXT@: $(COMMON_DIR)/gl_vidlinux_3dfx.c
# sub-directory is created
3dfx_DIR:
@DIR=3dfx; $(MAKE_SURE_DIR)
$(BUILD_DIR)/3dfx/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) $(TDFX_CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) $(TDFX_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/3dfx/%.o: $(SRC_DIR)/%.s $(TDFXQUAKE): gl_DIR $(BUILD_DIR)/../$(TDFXQUAKE)
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/3dfx/%.o: $(COMMON_DIR)/%.c $(BUILD_DIR)/../$(TDFXQUAKE): $(ALL_TDFX_OBJS)
$(CC) $(CFLAGS) $(TDFX_CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) $(ALL_TDFX_OBJS) $(TDFX_LDFLAGS) $(LDFLAGS) \
-o $(BUILD_DIR)/../$(TDFXQUAKE)
ifneq ($(QW_COMMON_DIR),)
$(BUILD_DIR)/3dfx/%.o: $(QW_COMMON_DIR)/%.c
$(CC) $(CFLAGS) $(TDFX_CFLAGS) -o $@ -c $<
endif
$(BUILD_DIR)/3dfx/%.o: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(TDFXQUAKE): 3dfx_DIR $(BUILD_DIR)/../$(TDFXQUAKE)
$(BUILD_DIR)/../$(TDFXQUAKE): $(OBJSquake-3dfx)
$(CC) $(CFLAGS) $(OBJSquake-3dfx) $(TDFX_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(TDFXQUAKE)
# XXX - Can this be automated?
clean-$(TDFXQUAKE):
rm -rf $(BUILD_DIR)/3dfx
endif endif
########################################################################### ###########################################################################
# #
# qw-client-sdl # Misc targets
# #
ifneq ($(SDLQUAKE),)
ALL_SDL_SRC = $(GENERAL_SRC) $(SW_REND_SRC) $(SDL_VID_SRC) model.c
OBJSquake-sdl= $(patsubst %,$(BUILD_DIR)/sdl/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_SDL_SRC) .c .s)))
SDL_CFLAGS = @SDL_CFLAGS@
SDL_LDFLAGS = @SDL_LIBS@
SDL_VID_SRC = vid_sdl.c
# This can be thought of as a macro that makes sure that the x11
# sub-directory is created
sdl_DIR:
@DIR=sdl; $(MAKE_SURE_DIR)
$(BUILD_DIR)/sdl/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) $(SDL_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/sdl/%.o: $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/sdl/%.o: $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) $(SDL_CFLAGS) -o $@ -c $<
ifneq ($(QW_COMMON_DIR),)
$(BUILD_DIR)/sdl/%.o: $(QW_COMMON_DIR)/%.c
$(CC) $(CFLAGS) $(SDL_CFLAGS) -o $@ -c $<
endif
$(BUILD_DIR)/sdl/%.o: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(SDLQUAKE): sdl_DIR $(BUILD_DIR)/../$(SDLQUAKE)
$(BUILD_DIR)/../$(SDLQUAKE): $(OBJSquake-sdl)
$(CC) $(CFLAGS) $(OBJSquake-sdl) $(SDL_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(SDLQUAKE)
# XXX - Can this be automated?
clean-$(SDLQUAKE):
rm -rf $(BUILD_DIR)/sdl
endif
###########################################################################
#
# cleaning (clean, distclean)
#
distclean: clean distclean: clean
rm -f config.cache config.log config.status Makefile rm -f Makefile
clean: $(CLEAN_TARGETS) $(CLEAN_TARGETS):
for i in $(targets); do \ rm -f $(BUILD_DIR)/../$(subst clean-,,$@)
rm -f $(BUILD_DIR)/../$$i; \
done clean-soft clean-gl:
rm -rf $(BUILD_DIR)/$(subst clean-,,$@)
clean: clean-soft clean-gl $(CLEAN_TARGETS)
-rmdir $(BUILD_DIR) -rmdir $(BUILD_DIR)
install: $(targets) install: $(targets)
@ -585,3 +468,4 @@ install: $(targets)
check: check:
@echo check not implemented @echo check not implemented

View file

@ -86,9 +86,11 @@ else
OPTFLAGS = -g OPTFLAGS = -g
endif endif
targets = $(MGLQUAKE) $(GGIQUAKE) $(SVGAQUAKE) $(GLQUAKE) $(TDFXQUAKE) $(X11QUAKE) $(SDLQUAKE) soft_targets = $(X11QUAKE) $(SVGAQUAKE) $(GGIQUAKE) $(SDLQUAKE)
gl_targets = $(GLQUAKE) $(TDFXQUAKE) $(MGLQUAKE)
targets = $(gl_targets) $(soft_targets)
CLEAN_TARGETS = $(patsubst %,clean-%, $(targets)) CLEAN_TARGETS = $(patsubst %,clean-%, $(targets))
.PHONY: $(targets) ($CLEAN_TARGETS) .PHONY: $(targets) $(CLEAN_TARGETS) clean-soft clean-gl
all: $(targets) all: $(targets)
@ -98,7 +100,9 @@ all: $(targets)
# #
ifeq ($(INTEL_ARCH),yes) ifeq ($(INTEL_ARCH),yes)
# Source file the Intel archictecture only # Source file the Intel archictecture only
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
@ -107,17 +111,17 @@ SWREND_SRC_PLAT = d_draw.s d_draw16.s d_parta.s d_polysa.s d_scana.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
XTRA_SND_SRC = snd_mixa.s XTRA_SND_SRC = snd_mixa.s
else else
# Source files for non-Intel platforms # Source files for non-Intel platforms
SWREND_SRC_PLAT = nonintel.c SWREND_SRC_PLAT = nonintel.c
endif endif
#
# System specific source files # System specific source files
#
CD_AUDIO_SRC = cd_wrapper.c CD_AUDIO_SRC = cd_wrapper.c
# sound # Sound source
SND_STYLE = @SND_STYLE@ SND_STYLE = @SND_STYLE@
SND_SRC = snd_null.c SND_SRC = snd_null.c
@ -140,58 +144,46 @@ endif
SND_SRC += snd_mem.c snd_mix.c $(XTRA_SND_SRC) SND_SRC += snd_mem.c snd_mix.c $(XTRA_SND_SRC)
# x11 vid
X11_VID_SRC = @X11_VID_SRC@
SYS_SRC = @SYS_SRC@ SYS_SRC = @SYS_SRC@
#
# Networking source files # Networking source files
# # FIXME: Should not assume UNIX
# XXX - Should not assume UNIX
NET_SRC = net_bsd.c net_udp.c NET_SRC = net_bsd.c net_udp.c
UQ_NET_SRC = net_dgrm.c net_loop.c net_main.c net_vcr.c $(NET_SRC) UQ_NET_SRC = net_dgrm.c net_loop.c net_main.c net_vcr.c $(NET_SRC)
#
# Common source files # Common source files
#
MISC_SRC = common.c crc.c cvar.c cmd.c mathlib.c register_check.c wad.c zone.c
# MISC_SRC = common.c crc.c cvar.c cmd.c mathlib.c register_check.c \
# Rendering source files wad.c zone.c
#
# GL renderer source
# OpenGL
GL_REND_SRC = gl_screen.c gl_model.c gl_draw.c gl_mesh.c gl_refrag.c \ GL_REND_SRC = gl_screen.c gl_model.c gl_draw.c gl_mesh.c gl_refrag.c \
gl_rlight.c gl_rmain.c gl_rmisc.c gl_rsurf.c gl_test.c gl_warp.c gl_rlight.c gl_rmain.c gl_rmisc.c gl_rsurf.c gl_test.c gl_warp.c
# Software source # Software renderer source
SW_REND_SRC = screen.c $(SWREND_SRC_PLAT) draw.c \ SW_REND_SRC = screen.c $(SWREND_SRC_PLAT) draw.c \
d_edge.c d_fill.c d_init.c d_modech.c d_part.c d_polyse.c d_scan.c \ d_edge.c d_fill.c d_init.c d_modech.c d_part.c d_polyse.c d_scan.c \
d_sky.c d_sprite.c d_surf.c d_vars.c d_zpoint.c r_aclip.c r_alias.c \ d_sky.c d_sprite.c d_surf.c d_vars.c d_zpoint.c r_aclip.c r_alias.c \
r_bsp.c r_draw.c r_edge.c r_efrag.c r_light.c r_main.c r_misc.c \ r_bsp.c r_draw.c r_edge.c r_efrag.c r_light.c r_main.c r_misc.c \
r_sky.c r_sprite.c r_surf.c r_vars.c r_sky.c r_sprite.c r_surf.c r_vars.c
#
# Client source files # Client source files
#
CL_SRC = cl_demo.c cl_input.c cl_main.c cl_parse.c cl_tent.c CL_SRC = cl_demo.c cl_input.c cl_main.c cl_parse.c cl_tent.c
CL_GUI_SRC= console.c sbar.c view.c keys.c menu.c CL_GUI_SRC= console.c sbar.c view.c keys.c menu.c
#
# Server source files # Server source files
#
# Server-related source used by all
SRV_SRC = sv_main.c sv_user.c sv_move.c sv_phys.c SRV_SRC = sv_main.c sv_user.c sv_move.c sv_phys.c
# Server-related source used just by UQ
UQ_SRV_SRC = host.c host_cmd.c $(SRV_SRC) UQ_SRV_SRC = host.c host_cmd.c $(SRV_SRC)
SRV_PR_SRC = pr_cmds.c pr_edict.c pr_exec.c SRV_PR_SRC = pr_cmds.c pr_edict.c pr_exec.c
# Source common to QW/UQuake
# Source common to both UQ and QW-client
CL_COMMON_SRC = $(MISC_SRC) $(CL_GUI_SRC) $(CL_SRC) \ CL_COMMON_SRC = $(MISC_SRC) $(CL_GUI_SRC) $(CL_SRC) \
$(CL_ADDITIONAL_GENERAL_SRC) $(SND_SRC) $(CD_AUDIO_SRC) r_part.c $(CL_ADDITIONAL_GENERAL_SRC) $(SND_SRC) r_part.c
######################################################################## ########################################################################
@ -201,162 +193,175 @@ CL_COMMON_SRC = $(MISC_SRC) $(CL_GUI_SRC) $(CL_SRC) \
DEFS = @DEFS@ DEFS = @DEFS@
CFLAGS = @CFLAGS@ $(OPTFLAGS) $(DEFS) -I. $(SRC_DIR_INC) \ CFLAGS = @CFLAGS@ $(OPTFLAGS) $(DEFS) -I. $(SRC_DIR_INC) \
-I$(COMMON_ODIR) -I$(COMMON_DIR) -I$(COMMON_ODIR) -I$(COMMON_DIR)
ALL_X11_SRC = $(GENERAL_SRC) $(SW_REND_SRC) $(X11_VID_SRC) model.c
ALL_GL_SRC = $(GENERAL_SRC) $(GL_REND_SRC) $(GL_VID_SRC)
ALL_TDFX_SRC = $(GENERAL_SRC) $(GL_REND_SRC) $(TDFX_VID_SRC)
GENERAL_SRC = $(CL_COMMON_SRC) \ GENERAL_SRC = $(CL_COMMON_SRC) \
$(SYS_SRC) chasecam.c world.c $(SRV_PR_SRC) \ $(SYS_SRC) chasecam.c world.c $(SRV_PR_SRC) \
$(UQ_NET_SRC) $(UQ_SRV_SRC) \ $(UQ_NET_SRC) $(UQ_SRV_SRC) \
$(UQ_GENERAL_SRC) $(UQ_SWREND_SRC_PLAT) $(UQ_GENERAL_SRC) $(UQ_SWREND_SRC_PLAT)
# XXX - add dos/win specific source # FIXME: add dos/win specific source
########################################################################### ###########################################################################
# #
# Compilation rules # Compilation rules
# #
# Software targets
soft_DIR:
@DIR=soft; $(MAKE_SURE_DIR)
$(BUILD_DIR)/soft/%.@OBJEXT@: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(BUILD_DIR)/soft/%.@OBJEXT@: $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/soft/%.@OBJEXT@: $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(BUILD_DIR)/soft/%.@OBJEXT@: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
# GL targets
gl_DIR:
@DIR=gl; $(MAKE_SURE_DIR)
$(BUILD_DIR)/gl/%.@OBJEXT@: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/gl/%.@OBJEXT@: $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/gl/%.@OBJEXT@: $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/gl/%.@OBJEXT@: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
########################################################################### ###########################################################################
# #
# quake-x11 # Specific target rules
# #
# X11 software target
ifneq ($(X11QUAKE),) ifneq ($(X11QUAKE),)
# Map the list of source files into a list of object files ALL_X11_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) @X11_VID_SRC@\
OBJSquake-x11 = $(patsubst %,$(BUILD_DIR)/x11/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_X11_SRC) .c .s))) model.c
ALL_X11_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_X11_SRC) .c .s)))
X11_CFLAGS = -DX11 @X_CFLAGS@ X11_CFLAGS = -DX11 @X_CFLAGS@
X11_LDFLAGS = @X_LIBS@ -lX11 @X11_SHM_LIB@ @X_EXTRA_LIBS@ X11_LDFLAGS = @X_LIBS@ -lX11 @X11_SHM_LIB@ @X_EXTRA_LIBS@
# This can be thought of as a macro that makes sure that the x11 # FIXME: This rule is pathological because of the seperate sunx driver,
# sub-directory is created # either merge it into vid_x.c or make a seperate sun target. In either
x11_DIR: # case, find the moro^wpeople responsible for this and other stupidities
DIR=x11; $(MAKE_SURE_DIR) # in Solaris and "educate" them.
$(BUILD_DIR)/soft/$(addsuffix .@OBJEXT@,$(basename @X11_VID_SRC@ .c)):\
$(BUILD_DIR)/x11/%.o: $(SRC_DIR)/%.c $(COMMON_DIR)/@X11_VID_SRC@
$(CC) $(CFLAGS) $(X11_CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) $(X11_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/x11/%.o: $(SRC_DIR)/%.s $(X11QUAKE): soft_DIR $(BUILD_DIR)/../$(X11QUAKE)
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/x11/%.o: $(COMMON_DIR)/%.c $(BUILD_DIR)/../$(X11QUAKE): $(ALL_X11_OBJS)
$(CC) $(CFLAGS) $(X11_CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) $(ALL_X11_OBJS) $(X11_LDFLAGS) $(LDFLAGS) \
-o $(BUILD_DIR)/../$(X11QUAKE)
$(BUILD_DIR)/x11/%.o: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(X11QUAKE): x11_DIR $(BUILD_DIR)/../$(X11QUAKE)
$(BUILD_DIR)/../$(X11QUAKE): $(OBJSquake-x11)
$(CC) $(CFLAGS) $(OBJSquake-x11) $(X11_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(X11QUAKE)
# XXX - Can this be automated?
clean-$(X11QUAKE):
rm -rf $(BUILD_DIR)/x11
endif endif
# SVGALib software target
###########################################################################
#
# quake-svga
#
ifneq ($(SVGAQUAKE),) ifneq ($(SVGAQUAKE),)
ALL_SVGA_SRC = $(GENERAL_SRC) $(SW_REND_SRC) $(SVGA_VID_SRC) model.c ALL_SVGA_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) vid_svgalib.c\
OBJSquake-svga= $(patsubst %,$(BUILD_DIR)/svga/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_SVGA_SRC) .c .s))) d_copy.s model.c
ALL_SVGA_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_SVGA_SRC) .c .s)))
SVGA_CFLAGS = @SVGA_CFLAGS@ SVGA_CFLAGS = @SVGA_CFLAGS@
SVGA_LDFLAGS = @SVGA_LIBS@ SVGA_LDFLAGS = @SVGA_LIBS@
SVGA_VID_SRC = vid_svgalib.c d_copy.s
# This can be thought of as a macro that makes sure that the x11
# sub-directory is created
svga_DIR:
DIR=svga; $(MAKE_SURE_DIR)
# Not sure why this -O is needed, but it is... # Not sure why this -O is needed, but it is...
$(BUILD_DIR)/svga/vid_svgalib.o: $(COMMON_DIR)/vid_svgalib.c $(BUILD_DIR)/soft/vid_svgalib.@OBJEXT@: $(COMMON_DIR)/vid_svgalib.c
$(CC) -O $(CFLAGS) $(SVGA_CFLAGS) -o $@ -c $< $(CC) -O $(CFLAGS) $(SVGA_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/svga/%.o: $(SRC_DIR)/%.c $(BUILD_DIR)/soft/d_copy.@OBJEXT@: $(COMMON_DIR)/d_copy.s
$(CC) $(CFLAGS) $(SVGA_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/svga/%.o: $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< $(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/svga/%.o: $(COMMON_DIR)/%.c $(SVGAQUAKE): soft_DIR $(BUILD_DIR)/../$(SVGAQUAKE)
$(CC) $(CFLAGS) $(SVGA_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/svga/%.o: $(COMMON_DIR)/%.s $(BUILD_DIR)/../$(SVGAQUAKE): $(ALL_SVGA_OBJS)
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< $(CC) $(CFLAGS) $(ALL_SVGA_OBJS) $(SVGA_LDFLAGS) $(LDFLAGS)\
-o $(BUILD_DIR)/../$(SVGAQUAKE)
$(SVGAQUAKE): svga_DIR $(BUILD_DIR)/../$(SVGAQUAKE)
$(BUILD_DIR)/../$(SVGAQUAKE): $(OBJSquake-svga)
$(CC) $(CFLAGS) $(OBJSquake-svga) $(SVGA_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(SVGAQUAKE)
# XXX - Can this be automated?
clean-$(SVGAQUAKE):
rm -rf $(BUILD_DIR)/svga
endif endif
# GGI software target
###########################################################################
#
# quake-ggi
#
ifneq ($(GGIQUAKE),) ifneq ($(GGIQUAKE),)
# Map the list of source files into a list of object files # Map the list of source files into a list of object files
ALL_GGI_SRC = $(GENERAL_SRC) $(SW_REND_SRC) $(GGI_VID_SRC) model.c ALL_GGI_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) vid_ggi.c\
OBJSquake-ggi = $(patsubst %,$(BUILD_DIR)/ggi/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_GGI_SRC) .c .s))) model.c
ALL_GGI_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_GGI_SRC) .c .s)))
GGI_SRC = vid_ggi.c
GGI_CFLAGS = -DGGI @GGI_CFLAGS@ GGI_CFLAGS = -DGGI @GGI_CFLAGS@
GGI_LDFLAGS = @GGI_LIBS@ GGI_LDFLAGS = @GGI_LIBS@
GGI_VID_SRC = vid_ggi.c
# This can be thought of as a macro that makes sure that the ggi $(BUILD_DIR)/soft/vid_ggi.@OBJEXT@: $(COMMON_DIR)/vid_ggi.c
# sub-directory is created
ggi_DIR:
DIR=ggi; $(MAKE_SURE_DIR)
$(BUILD_DIR)/ggi/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) $(GGI_CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) $(GGI_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/ggi/%.o: $(SRC_DIR)/%.s $(GGIQUAKE): soft_DIR $(BUILD_DIR)/../$(GGIQUAKE)
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/ggi/%.o: $(COMMON_DIR)/%.c $(BUILD_DIR)/../$(GGIQUAKE): $(ALL_GGI_OBJS)
$(CC) $(CFLAGS) $(GGI_CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) $(ALL_GGI_OBJS) $(GGI_LDFLAGS) $(LDFLAGS) \
-o $(BUILD_DIR)/../$(GGIQUAKE)
$(BUILD_DIR)/ggi/%.o: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(GGIQUAKE): ggi_DIR $(BUILD_DIR)/../$(GGIQUAKE)
$(BUILD_DIR)/../$(GGIQUAKE): $(OBJSquake-ggi)
$(CC) $(CFLAGS) $(OBJSquake-ggi) $(GGI_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(GGIQUAKE)
# XXX - Can this be automated?
clean-$(GGIQUAKE):
rm -rf $(BUILD_DIR)/ggi
endif endif
# SDL software target
ifneq ($(SDLQUAKE),)
ALL_SDL_SRC = $(GENERAL_SRC) $(SW_REND_SRC) $(SDL_SRC) vid_sdl.c cd_sdl.c\
model.c
ALL_SDL_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_SDL_SRC) .c .s)))
SDL_CFLAGS = @SDL_CFLAGS@ -DSDL
SDL_LDFLAGS = @SDL_LIBS@
$(BUILD_DIR)/soft/vid_sdl.@OBJEXT@: $(COMMON_DIR)/vid_sdl.c
$(CC) $(CFLAGS) $(SDL_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/soft/cd_sdl.@OBJEXT@: $(COMMON_DIR)/cd_sdl.c
$(CC) $(CFLAGS) $(SDL_CFLAGS) -o $@ -c $<
$(SDLQUAKE): soft_DIR $(BUILD_DIR)/../$(SDLQUAKE)
$(BUILD_DIR)/../$(SDLQUAKE): $(ALL_SDL_OBJS)
$(CC) $(CFLAGS) $(ALL_SDL_OBJS) $(SDL_LDFLAGS) $(LDFLAGS) \
-o $(BUILD_DIR)/../$(SDLQUAKE)
endif
# mingw32 GL target
# FIXME: Rewrite this entire section!
###########################################################################
#
# quake-mgl
#
ifneq ($(MGLQUAKE),) ifneq ($(MGLQUAKE),)
# Map the list of source files into a list of object files # Map the list of source files into a list of object files
ALL_MGL_SRC = $(GENERAL_SRC) $(SW_REND_SRC) $(MGL_VID_SRC) model.c ALL_MGL_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) $(MGL_VID_SRC)\
model.c
OBJSquake-mgl = $(patsubst %,$(BUILD_DIR)/mgl/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_MGL_SRC) .c .s))) OBJSquake-mgl = $(patsubst %,$(BUILD_DIR)/mgl/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_MGL_SRC) .c .s)))
MGL_CFLAGS = -DMGL @MGL_CFLAGS@ MGL_CFLAGS = -DMGL @MGL_CFLAGS@
MGL_LDFLAGS = @MGL_LIBS@ -lm MGL_LDFLAGS = @MGL_LIBS@ -lm
MGL_VID_SRC = vid_win.c in_win.c conproc.c MGL_VID_SRC = vid_win.c in_win.c conproc.c
# This can be thought of as a macro that makes sure that the mgl
# sub-directory is created
# XXX - can we avoid doing every compile?
MAKE_SURE_mgl_DIR = @DIR=mgl; $(MAKE_SURE_DIR) MAKE_SURE_mgl_DIR = @DIR=mgl; $(MAKE_SURE_DIR)
$(BUILD_DIR)/mgl/%.o: $(SRC_DIR)/%.c $(BUILD_DIR)/mgl/%.o: $(SRC_DIR)/%.c
@ -379,141 +384,69 @@ $(MGLQUAKE): $(BUILD_DIR)/../$(MGLQUAKE)
$(BUILD_DIR)/../$(MGLQUAKE): $(OBJSquake-mgl) $(BUILD_DIR)/../$(MGLQUAKE): $(OBJSquake-mgl)
$(CC) $(CFLAGS) $(OBJSquake-mgl) $(MGL_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(MGLQUAKE) $(CC) $(CFLAGS) $(OBJSquake-mgl) $(MGL_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(MGLQUAKE)
# XXX - Can this be automated?
clean-$(MGLQUAKE):
rm -rf $(BUILD_DIR)/mgl
endif endif
# X11 GL target
###########################################################################
#
# quake-gl
#
ifneq ($(GLQUAKE),) ifneq ($(GLQUAKE),)
OBJSquake-gl = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_GL_SRC) .c .s))) ALL_GL_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(GL_REND_SRC) gl_vidlinuxglx.c
ALL_GL_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_GL_SRC) .c .s)))
GL_CFLAGS = -DGLQUAKE @OGL_CFLAGS@ GL_CFLAGS = -DGLQUAKE @OGL_CFLAGS@
GL_LDFLAGS = $(X11_LDFLAGS) @OGL_LIBS@ GL_LDFLAGS = $(X11_LDFLAGS) @OGL_LIBS@
# XXX - is this platform independent?
GL_VID_SRC = gl_vidlinuxglx.c
# This can be thought of as a macro that makes sure that the x11 $(BUILD_DIR)/gl/vid_linuxglx.o: $(COMMON_DIR)/vid_linuxglx.c
# sub-directory is created
gl_DIR:
DIR=gl; $(MAKE_SURE_DIR)
$(BUILD_DIR)/gl/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/gl/%.o: $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/gl/%.o: $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/gl/%.o: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(GLQUAKE): gl_DIR $(BUILD_DIR)/../$(GLQUAKE) $(GLQUAKE): gl_DIR $(BUILD_DIR)/../$(GLQUAKE)
$(BUILD_DIR)/../$(GLQUAKE): $(OBJSquake-gl) $(BUILD_DIR)/../$(GLQUAKE): $(ALL_GL_OBJS)
$(CC) $(CFLAGS) $(OBJSquake-gl) $(GL_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(GLQUAKE) $(CC) $(CFLAGS) $(ALL_GL_OBJS) $(GL_LDFLAGS) $(LDFLAGS) \
-o $(BUILD_DIR)/../$(GLQUAKE)
# XXX - Can this be automated?
clean-$(GLQUAKE):
rm -rf $(BUILD_DIR)/gl
endif endif
########################################################################### # 3Dfx GL MCD target
#
# quake-3dfx
#
ifneq ($(TDFXQUAKE),) ifneq ($(TDFXQUAKE),)
OBJSquake-3dfx = $(patsubst %,$(BUILD_DIR)/3dfx/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_TDFX_SRC) .c .s))) ALL_TDFX_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(GL_REND_SRC)\
gl_vidlinux_3dfx.c
ALL_TDFX_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_TDFX_SRC) .c .s)))
TDFX_CFLAGS = -DGLQUAKE @OGL_CFLAGS@ @GLIDE_CFLAGS@ TDFX_CFLAGS = -DGLQUAKE @OGL_CFLAGS@ @GLIDE_CFLAGS@
TDFX_LDFLAGS = @SVGA_LIBS@ @TDFXGL_LIBS@ TDFX_LDFLAGS = @SVGA_LIBS@ @TDFXGL_LIBS@
TDFX_VID_SRC = gl_vidlinux_3dfx.c
# This can be thought of as a macro that makes sure that the x11 $(BUILD_DIR)/gl/gl_vidlinux_3dfx.@OBJEXT@: $(COMMON_DIR)/gl_vidlinux_3dfx.c
# sub-directory is created
3dfx_DIR:
DIR=3dfx; $(MAKE_SURE_DIR)
$(BUILD_DIR)/3dfx/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) $(TDFX_CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) $(TDFX_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/3dfx/%.o: $(SRC_DIR)/%.s $(TDFXQUAKE): gl_DIR $(BUILD_DIR)/../$(TDFXQUAKE)
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/3dfx/%.o: $(COMMON_DIR)/%.c $(BUILD_DIR)/../$(TDFXQUAKE): $(ALL_TDFX_OBJS)
$(CC) $(CFLAGS) $(TDFX_CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) $(ALL_TDFX_OBJS) $(TDFX_LDFLAGS) $(LDFLAGS) \
-o $(BUILD_DIR)/../$(TDFXQUAKE)
$(BUILD_DIR)/3dfx/%.o: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(TDFXQUAKE): 3dfx_DIR $(BUILD_DIR)/../$(TDFXQUAKE)
$(BUILD_DIR)/../$(TDFXQUAKE): $(OBJSquake-3dfx)
$(CC) $(CFLAGS) $(OBJSquake-3dfx) $(TDFX_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(TDFXQUAKE)
# XXX - Can this be automated?
clean-$(TDFXQUAKE):
rm -rf $(BUILD_DIR)/3dfx
endif endif
########################################################################### ###########################################################################
# #
# quake-sdl # Misc targets
# #
ifneq ($(SDLQUAKE),)
ALL_SDL_SRC = $(GENERAL_SRC) $(SW_REND_SRC) $(SDL_VID_SRC) model.c
OBJSquake-sdl= $(patsubst %,$(BUILD_DIR)/sdl/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_SDL_SRC) .c .s)))
SDL_CFLAGS = @SDL_CFLAGS@ -DSDL
SDL_LDFLAGS = @SDL_LIBS@
SDL_VID_SRC = vid_sdl.c
# This can be thought of as a macro that makes sure that the x11
# sub-directory is created
sdl_DIR:
DIR=sdl; $(MAKE_SURE_DIR)
$(BUILD_DIR)/sdl/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) $(SDL_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/sdl/%.o: $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/sdl/%.o: $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) $(SDL_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/sdl/%.o: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
$(SDLQUAKE): sdl_DIR $(BUILD_DIR)/../$(SDLQUAKE)
$(BUILD_DIR)/../$(SDLQUAKE): $(OBJSquake-sdl)
$(CC) $(CFLAGS) $(OBJSquake-sdl) $(SDL_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(SDLQUAKE)
# XXX - Can this be automated?
clean-$(SDLQUAKE):
rm -rf $(BUILD_DIR)/sdl
endif
###########################################################################
#
# cleaning (clean, distclean)
#
distclean: clean distclean: clean
rm -f config.cache config.log config.status Makefile rm -f Makefile
clean: $(CLEAN_TARGETS) $(CLEAN_TARGETS):
for i in $(targets); do \ rm -f $(BUILD_DIR)/../$(subst clean-,,$@)
rm -f $(BUILD_DIR)/../$$i; \
done clean-soft clean-gl:
rm -rf $(BUILD_DIR)/$(subst clean-,,$@)
clean: clean-soft clean-gl $(CLEAN_TARGETS)
-rmdir $(BUILD_DIR) -rmdir $(BUILD_DIR)
install: $(targets) install: $(targets)