From 4ebf133971dae79063db1196d0c9d0446db2c985 Mon Sep 17 00:00:00 2001 From: Joseph Carter Date: Wed, 5 Jan 2000 19:10:52 +0000 Subject: [PATCH] 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. --- Makefile.in | 1 - common/cd_sdl.c | 9 +- common/cd_wrapper.c | 11 +- common/view.h | 2 - qw_client/Makefile.in | 446 ++++++++++++++++-------------------------- uquake/Makefile.in | 373 +++++++++++++++-------------------- 6 files changed, 329 insertions(+), 513 deletions(-) diff --git a/Makefile.in b/Makefile.in index a35a629..ca0b0f8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -42,7 +42,6 @@ configure: configure.in acconfig.h Makefile: Makefile.in configure \ qw_client/Makefile qw_server/Makefile uquake/Makefile - ./configure qw_client/Makefile: qw_client/Makefile.in configure ./configure diff --git a/common/cd_sdl.c b/common/cd_sdl.c index 64eec30..f5a75de 100644 --- a/common/cd_sdl.c +++ b/common/cd_sdl.c @@ -114,9 +114,14 @@ void CDAudio_Update() 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; + cd_id = SDL_CDOpen(0); if(!cd_id) { diff --git a/common/cd_wrapper.c b/common/cd_wrapper.c index 447f0c7..c884112 100644 --- a/common/cd_wrapper.c +++ b/common/cd_wrapper.c @@ -17,13 +17,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#if defined(SDL) -# include "cd_sdl.c" -#elif defined(__linux__) -# include "cd_linux.c" +#if defined(__linux__) +# include "cd_linux.c" #elif defined(_WIN32) -# include "cd_win.c" +# include "cd_win.c" #else -# include "cd_null.c" +# include "cd_null.c" #endif diff --git a/common/view.h b/common/view.h index b546b20..4c88d1e 100644 --- a/common/view.h +++ b/common/view.h @@ -23,10 +23,8 @@ extern cvar_t v_gamma; extern byte gammatable[256]; // palette is sent through this extern byte ramps[3][256]; -//#ifdef GLQUAKE extern float v_blend[4]; extern cvar_t lcd_x; -//#endif void V_Init (void); void V_RenderView (void); diff --git a/qw_client/Makefile.in b/qw_client/Makefile.in index f0596cf..5eeba50 100644 --- a/qw_client/Makefile.in +++ b/qw_client/Makefile.in @@ -87,28 +87,22 @@ else OPTFLAGS = -g 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)) -.PHONY: $(targets) ($CLEAN_TARGETS) - -x: Makefile - @echo binaries: $(targets) - @echo other targets: distclean - @echo all: makes all targets - $(targets) +.PHONY: $(targets) $(CLEAN_TARGETS) clean-soft clean-gl all: $(targets) - - ######################################################################## # # Source files # -# **** Note - two apps may appear to share source, but they may just share -# source file *names* - ifeq ($(INTEL_ARCH),yes) + # Source file the Intel archictecture only + UQ_GENERAL_SRC = worlda.s UQ_SWREND_SRC_PLAT = dosasm.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 XTRA_SND_SRC = snd_mixa.s else + # Source files for non-Intel platforms + SWREND_SRC_PLAT = nonintel.c endif -# # System specific source files -# + CD_AUDIO_SRC = cd_wrapper.c -# sound +# Sound source SND_STYLE = @SND_STYLE@ SND_SRC = snd_null.c @@ -149,64 +144,52 @@ endif 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@ -QW_CL_SYS_SRC = @QW_CL_SYS_SRC@ -QW_SRV_SYS_SRC = @QW_SRV_SYS_SRC@ -# # Networking source files -# +# FIXME: Should not assume UNIX + QW_NET_SRC = net_udp.c net_com.c mdfour.c -# # Common source files -# -MISC_SRC = common.c crc.c cvar.c cmd.c mathlib.c register_check.c wad.c zone.c -# -# Rendering source files -# +MISC_SRC = common.c crc.c cvar.c cmd.c mathlib.c register_check.c \ + 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_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 -QW_GL_REND_SRC = gl_ngraph.c -# Software source +# Software renderer source + 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_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_sky.c r_sprite.c r_surf.c r_vars.c -# # Client source files -# + 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 CL_GUI_SRC= console.c sbar.c view.c keys.c menu.c -# # Server source files -# -# Server-related source used by all + 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 -# 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 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_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@ CFLAGS = @CFLAGS@ -Wall -DQUAKEWORLD $(OPTFLAGS) $(DEFS) -I. \ $(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) \ $(QW_CL_SRC) $(QW_NET_SRC) net_chan.c skin.c \ - $(QW_CL_SYS_SRC) \ - $(QW_GENERAL_SRC) -# XXX - add dos/win specifc source + $(SYS_SRC) $(QW_GENERAL_SRC) + +# FIXME: add dos/win specifc source ########################################################################### # # 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),) -# Map the list of source files into a list of object files -OBJSquake-x11 = $(patsubst %,$(BUILD_DIR)/x11/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_X11_SRC) .c .s))) +ALL_X11_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) @X11_VID_SRC@\ + model.c +ALL_X11_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\ + $(basename $(ALL_X11_SRC) .c .s))) X11_CFLAGS = -DX11 @X_CFLAGS@ 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 -# sub-directory is created -x11_DIR: - @DIR=x11; $(MAKE_SURE_DIR) - -$(BUILD_DIR)/x11/%.o: $(SRC_DIR)/%.c - $(MAKE_SURE_x11_DIR) +# FIXME: This rule is pathological because of the seperate sunx driver, +# either merge it into vid_x.c or make a seperate sun target. In either +# case, find the moro^wpeople responsible for this and other stupidities +# in Solaris and "educate" them. +$(BUILD_DIR)/soft/$(addsuffix .@OBJEXT@,$(basename @X11_VID_SRC@ .c)):\ +$(COMMON_DIR)/@X11_VID_SRC@ $(CC) $(CFLAGS) $(X11_CFLAGS) -o $@ -c $< -$(BUILD_DIR)/x11/%.o: $(SRC_DIR)/%.s - $(MAKE_SURE_x11_DIR) - $(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< +$(X11QUAKE): soft_DIR $(BUILD_DIR)/../$(X11QUAKE) -$(BUILD_DIR)/x11/%.o: $(COMMON_DIR)/%.c - $(MAKE_SURE_x11_DIR) - $(CC) $(CFLAGS) $(X11_CFLAGS) -o $@ -c $< +$(BUILD_DIR)/../$(X11QUAKE): $(ALL_X11_OBJS) + $(CC) $(CFLAGS) $(ALL_X11_OBJS) $(X11_LDFLAGS) $(LDFLAGS) \ + -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 -$(BUILD_DIR)/x11/%.o: $(COMMON_DIR)/%.s - $(MAKE_SURE_x11_DIR) - $(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< +# SVGALib software target -$(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),) -ALL_SVGA_SRC = $(GENERAL_SRC) $(SW_REND_SRC) $(SVGA_VID_SRC) model.c -OBJSquake-svga= $(patsubst %,$(BUILD_DIR)/svga/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_SVGA_SRC) .c .s))) - +ALL_SVGA_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) vid_svgalib.c\ + 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_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... -$(BUILD_DIR)/svga/vid_svgalib.o: $(COMMON_DIR)/vid_svgalib.c - $(MAKE_SURE_svga_DIR) +$(BUILD_DIR)/soft/vid_svgalib.@OBJEXT@: $(COMMON_DIR)/vid_svgalib.c $(CC) -O $(CFLAGS) $(SVGA_CFLAGS) -o $@ -c $< -$(BUILD_DIR)/svga/%.o: $(SRC_DIR)/%.c - $(MAKE_SURE_svga_DIR) - $(CC) $(CFLAGS) $(SVGA_CFLAGS) -o $@ -c $< - -$(BUILD_DIR)/svga/%.o: $(SRC_DIR)/%.s - $(MAKE_SURE_svga_DIR) +$(BUILD_DIR)/soft/d_copy.@OBJEXT@: $(COMMON_DIR)/d_copy.s $(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< -$(BUILD_DIR)/svga/%.o: $(COMMON_DIR)/%.c - $(MAKE_SURE_svga_DIR) - $(CC) $(CFLAGS) $(SVGA_CFLAGS) -o $@ -c $< +$(SVGAQUAKE): soft_DIR $(BUILD_DIR)/../$(SVGAQUAKE) + +$(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 -$(BUILD_DIR)/svga/%.o: $(COMMON_DIR)/%.s - $(MAKE_SURE_svga_DIR) - $(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< +# GGI software target -$(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),) # 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 -OBJSquake-ggi = $(patsubst %,$(BUILD_DIR)/ggi/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_GGI_SRC) .c .s))) +ALL_GGI_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) vid_ggi.c\ + 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_LDFLAGS = @GGI_LIBS@ -GGI_VID_SRC = vid_ggi.c -# This can be thought of as a macro that makes sure that the ggi -# sub-directory is created -ggi_DIR: - @DIR=ggi; $(MAKE_SURE_DIR) - -$(BUILD_DIR)/ggi/%.o: $(SRC_DIR)/%.c +$(BUILD_DIR)/soft/vid_ggi.@OBJEXT@: $(COMMON_DIR)/vid_ggi.c $(CC) $(CFLAGS) $(GGI_CFLAGS) -o $@ -c $< -$(BUILD_DIR)/ggi/%.o: $(SRC_DIR)/%.s - $(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< +$(GGIQUAKE): soft_DIR $(BUILD_DIR)/../$(GGIQUAKE) -$(BUILD_DIR)/ggi/%.o: $(COMMON_DIR)/%.c - $(CC) $(CFLAGS) $(GGI_CFLAGS) -o $@ -c $< +$(BUILD_DIR)/../$(GGIQUAKE): $(ALL_GGI_OBJS) + $(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 -$(BUILD_DIR)/ggi/%.o: $(COMMON_DIR)/%.s - $(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< +# SDL software target -$(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 +# mingw32 GL target +# FIXME: Rewrite this entire section! -########################################################################### -# -# qw-client-mgl -# ifneq ($(MGLQUAKE),) # 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))) MGL_CFLAGS = -DMGL @MGL_CFLAGS@ 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) $(BUILD_DIR)/mgl/%.o: $(SRC_DIR)/%.c @@ -410,12 +386,6 @@ $(BUILD_DIR)/mgl/%.o: $(COMMON_DIR)/%.c $(MAKE_SURE_mgl_DIR) $(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 $(MAKE_SURE_mgl_DIR) $(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $< @@ -424,156 +394,69 @@ $(MGLQUAKE): $(BUILD_DIR)/../$(MGLQUAKE) $(BUILD_DIR)/../$(MGLQUAKE): $(OBJSquake-mgl) $(CC) $(CFLAGS) $(OBJSquake-mgl) $(MGL_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(MGLQUAKE) -# XXX - Can this be automated? -clean-$(MGLQUAKE): - rm -rf $(BUILD_DIR)/mgl + endif +# X11 GL target -########################################################################### -# -# qw-client-gl -# 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_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 -# sub-directory is created -gl_DIR: - @DIR=gl; $(MAKE_SURE_DIR) - -$(BUILD_DIR)/gl/%.o: $(SRC_DIR)/%.c +$(BUILD_DIR)/gl/vid_linuxglx.o: $(COMMON_DIR)/vid_linuxglx.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) -$(BUILD_DIR)/../$(GLQUAKE): $(OBJSquake-gl) - $(CC) $(CFLAGS) $(OBJSquake-gl) $(GL_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(GLQUAKE) +$(BUILD_DIR)/../$(GLQUAKE): $(ALL_GL_OBJS) + $(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 -########################################################################### -# -# qw-client-3dfx -# +# 3Dfx GL MCD target + 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_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 -# sub-directory is created -3dfx_DIR: - @DIR=3dfx; $(MAKE_SURE_DIR) - -$(BUILD_DIR)/3dfx/%.o: $(SRC_DIR)/%.c +$(BUILD_DIR)/gl/gl_vidlinux_3dfx.@OBJEXT@: $(COMMON_DIR)/gl_vidlinux_3dfx.c $(CC) $(CFLAGS) $(TDFX_CFLAGS) -o $@ -c $< -$(BUILD_DIR)/3dfx/%.o: $(SRC_DIR)/%.s - $(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< +$(TDFXQUAKE): gl_DIR $(BUILD_DIR)/../$(TDFXQUAKE) -$(BUILD_DIR)/3dfx/%.o: $(COMMON_DIR)/%.c - $(CC) $(CFLAGS) $(TDFX_CFLAGS) -o $@ -c $< +$(BUILD_DIR)/../$(TDFXQUAKE): $(ALL_TDFX_OBJS) + $(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 ########################################################################### # -# 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 - rm -f config.cache config.log config.status Makefile + rm -f Makefile -clean: $(CLEAN_TARGETS) - for i in $(targets); do \ - rm -f $(BUILD_DIR)/../$$i; \ - done +$(CLEAN_TARGETS): + rm -f $(BUILD_DIR)/../$(subst clean-,,$@) + +clean-soft clean-gl: + rm -rf $(BUILD_DIR)/$(subst clean-,,$@) + +clean: clean-soft clean-gl $(CLEAN_TARGETS) -rmdir $(BUILD_DIR) install: $(targets) @@ -585,3 +468,4 @@ install: $(targets) check: @echo check not implemented + diff --git a/uquake/Makefile.in b/uquake/Makefile.in index 00744d2..c45f293 100644 --- a/uquake/Makefile.in +++ b/uquake/Makefile.in @@ -86,9 +86,11 @@ else OPTFLAGS = -g 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)) -.PHONY: $(targets) ($CLEAN_TARGETS) +.PHONY: $(targets) $(CLEAN_TARGETS) clean-soft clean-gl all: $(targets) @@ -98,7 +100,9 @@ all: $(targets) # ifeq ($(INTEL_ARCH),yes) + # Source file the Intel archictecture only + UQ_GENERAL_SRC = worlda.s UQ_SWREND_SRC_PLAT = dosasm.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 XTRA_SND_SRC = snd_mixa.s else + # Source files for non-Intel platforms + SWREND_SRC_PLAT = nonintel.c endif -# # System specific source files -# CD_AUDIO_SRC = cd_wrapper.c -# sound +# Sound source SND_STYLE = @SND_STYLE@ SND_SRC = snd_null.c @@ -140,58 +144,46 @@ endif SND_SRC += snd_mem.c snd_mix.c $(XTRA_SND_SRC) -# x11 vid - -X11_VID_SRC = @X11_VID_SRC@ - SYS_SRC = @SYS_SRC@ -# # Networking source files -# -# XXX - Should not assume UNIX +# FIXME: Should not assume UNIX + 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) -# # Common source files -# -MISC_SRC = common.c crc.c cvar.c cmd.c mathlib.c register_check.c wad.c zone.c -# -# Rendering source files -# +MISC_SRC = common.c crc.c cvar.c cmd.c mathlib.c register_check.c \ + 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_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 \ 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 \ 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 -# # Client source files -# + 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 -# # Server source files -# -# Server-related source used by all + 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) SRV_PR_SRC = pr_cmds.c pr_edict.c pr_exec.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_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@ CFLAGS = @CFLAGS@ $(OPTFLAGS) $(DEFS) -I. $(SRC_DIR_INC) \ -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) \ $(SYS_SRC) chasecam.c world.c $(SRV_PR_SRC) \ $(UQ_NET_SRC) $(UQ_SRV_SRC) \ $(UQ_GENERAL_SRC) $(UQ_SWREND_SRC_PLAT) -# XXX - add dos/win specific source +# FIXME: add dos/win specific source ########################################################################### # # 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),) -# Map the list of source files into a list of object files -OBJSquake-x11 = $(patsubst %,$(BUILD_DIR)/x11/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_X11_SRC) .c .s))) +ALL_X11_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) @X11_VID_SRC@\ + model.c +ALL_X11_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\ + $(basename $(ALL_X11_SRC) .c .s))) X11_CFLAGS = -DX11 @X_CFLAGS@ 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 -# sub-directory is created -x11_DIR: - DIR=x11; $(MAKE_SURE_DIR) - -$(BUILD_DIR)/x11/%.o: $(SRC_DIR)/%.c +# FIXME: This rule is pathological because of the seperate sunx driver, +# either merge it into vid_x.c or make a seperate sun target. In either +# case, find the moro^wpeople responsible for this and other stupidities +# in Solaris and "educate" them. +$(BUILD_DIR)/soft/$(addsuffix .@OBJEXT@,$(basename @X11_VID_SRC@ .c)):\ +$(COMMON_DIR)/@X11_VID_SRC@ $(CC) $(CFLAGS) $(X11_CFLAGS) -o $@ -c $< -$(BUILD_DIR)/x11/%.o: $(SRC_DIR)/%.s - $(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< +$(X11QUAKE): soft_DIR $(BUILD_DIR)/../$(X11QUAKE) -$(BUILD_DIR)/x11/%.o: $(COMMON_DIR)/%.c - $(CC) $(CFLAGS) $(X11_CFLAGS) -o $@ -c $< +$(BUILD_DIR)/../$(X11QUAKE): $(ALL_X11_OBJS) + $(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 +# SVGALib software target -########################################################################### -# -# quake-svga -# ifneq ($(SVGAQUAKE),) -ALL_SVGA_SRC = $(GENERAL_SRC) $(SW_REND_SRC) $(SVGA_VID_SRC) model.c -OBJSquake-svga= $(patsubst %,$(BUILD_DIR)/svga/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_SVGA_SRC) .c .s))) +ALL_SVGA_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) vid_svgalib.c\ + 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_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... -$(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 $< -$(BUILD_DIR)/svga/%.o: $(SRC_DIR)/%.c - $(CC) $(CFLAGS) $(SVGA_CFLAGS) -o $@ -c $< - -$(BUILD_DIR)/svga/%.o: $(SRC_DIR)/%.s +$(BUILD_DIR)/soft/d_copy.@OBJEXT@: $(COMMON_DIR)/d_copy.s $(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< -$(BUILD_DIR)/svga/%.o: $(COMMON_DIR)/%.c - $(CC) $(CFLAGS) $(SVGA_CFLAGS) -o $@ -c $< +$(SVGAQUAKE): soft_DIR $(BUILD_DIR)/../$(SVGAQUAKE) -$(BUILD_DIR)/svga/%.o: $(COMMON_DIR)/%.s - $(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< +$(BUILD_DIR)/../$(SVGAQUAKE): $(ALL_SVGA_OBJS) + $(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 +# GGI software target -########################################################################### -# -# quake-ggi -# ifneq ($(GGIQUAKE),) # 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 -OBJSquake-ggi = $(patsubst %,$(BUILD_DIR)/ggi/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_GGI_SRC) .c .s))) +ALL_GGI_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) vid_ggi.c\ + 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_LDFLAGS = @GGI_LIBS@ -GGI_VID_SRC = vid_ggi.c -# This can be thought of as a macro that makes sure that the ggi -# sub-directory is created -ggi_DIR: - DIR=ggi; $(MAKE_SURE_DIR) - -$(BUILD_DIR)/ggi/%.o: $(SRC_DIR)/%.c +$(BUILD_DIR)/soft/vid_ggi.@OBJEXT@: $(COMMON_DIR)/vid_ggi.c $(CC) $(CFLAGS) $(GGI_CFLAGS) -o $@ -c $< -$(BUILD_DIR)/ggi/%.o: $(SRC_DIR)/%.s - $(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< +$(GGIQUAKE): soft_DIR $(BUILD_DIR)/../$(GGIQUAKE) -$(BUILD_DIR)/ggi/%.o: $(COMMON_DIR)/%.c - $(CC) $(CFLAGS) $(GGI_CFLAGS) -o $@ -c $< +$(BUILD_DIR)/../$(GGIQUAKE): $(ALL_GGI_OBJS) + $(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 +# 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),) # 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))) MGL_CFLAGS = -DMGL @MGL_CFLAGS@ MGL_LDFLAGS = @MGL_LIBS@ -lm 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) $(BUILD_DIR)/mgl/%.o: $(SRC_DIR)/%.c @@ -379,141 +384,69 @@ $(MGLQUAKE): $(BUILD_DIR)/../$(MGLQUAKE) $(BUILD_DIR)/../$(MGLQUAKE): $(OBJSquake-mgl) $(CC) $(CFLAGS) $(OBJSquake-mgl) $(MGL_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(MGLQUAKE) -# XXX - Can this be automated? -clean-$(MGLQUAKE): - rm -rf $(BUILD_DIR)/mgl + endif +# X11 GL target -########################################################################### -# -# quake-gl -# 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_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 -# sub-directory is created -gl_DIR: - DIR=gl; $(MAKE_SURE_DIR) - -$(BUILD_DIR)/gl/%.o: $(SRC_DIR)/%.c +$(BUILD_DIR)/gl/vid_linuxglx.o: $(COMMON_DIR)/vid_linuxglx.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) -$(BUILD_DIR)/../$(GLQUAKE): $(OBJSquake-gl) - $(CC) $(CFLAGS) $(OBJSquake-gl) $(GL_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(GLQUAKE) +$(BUILD_DIR)/../$(GLQUAKE): $(ALL_GL_OBJS) + $(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 -########################################################################### -# -# quake-3dfx -# +# 3Dfx GL MCD target + 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_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 -# sub-directory is created -3dfx_DIR: - DIR=3dfx; $(MAKE_SURE_DIR) - -$(BUILD_DIR)/3dfx/%.o: $(SRC_DIR)/%.c +$(BUILD_DIR)/gl/gl_vidlinux_3dfx.@OBJEXT@: $(COMMON_DIR)/gl_vidlinux_3dfx.c $(CC) $(CFLAGS) $(TDFX_CFLAGS) -o $@ -c $< -$(BUILD_DIR)/3dfx/%.o: $(SRC_DIR)/%.s - $(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< +$(TDFXQUAKE): gl_DIR $(BUILD_DIR)/../$(TDFXQUAKE) -$(BUILD_DIR)/3dfx/%.o: $(COMMON_DIR)/%.c - $(CC) $(CFLAGS) $(TDFX_CFLAGS) -o $@ -c $< +$(BUILD_DIR)/../$(TDFXQUAKE): $(ALL_TDFX_OBJS) + $(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 ########################################################################### # -# 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 - rm -f config.cache config.log config.status Makefile + rm -f Makefile -clean: $(CLEAN_TARGETS) - for i in $(targets); do \ - rm -f $(BUILD_DIR)/../$$i; \ - done +$(CLEAN_TARGETS): + rm -f $(BUILD_DIR)/../$(subst clean-,,$@) + +clean-soft clean-gl: + rm -rf $(BUILD_DIR)/$(subst clean-,,$@) + +clean: clean-soft clean-gl $(CLEAN_TARGETS) -rmdir $(BUILD_DIR) install: $(targets)