######################################################################## # # Quake general stuff # PROJECT_DIR = @top_srcdir@ PROJECT_ODIR = .. SRC_DIR = @srcdir@ COMMON_DIR = $(PROJECT_DIR)/common COMMON_ODIR = $(PROJECT_ODIR)/common BIN_PREFIX = quake DESTDIR = prefix = @prefix@ bindir = @bindir@ mandir = @mandir@ BUILD_DIR = $(PROJECT_ODIR)/targets/uquake LDFLAGS = @LDFLAGS@ @SND_LIBS@ @NET_LIBS@ -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 ######################################################################## # # Client targets # ifeq ($(HAS_OGL),yes) GLQUAKE =$(BIN_PREFIX)-gl endif ifeq ($(HAS_TDFXGL),yes) TDFXQUAKE= $(BIN_PREFIX)-3dfx endif ifeq ($(HAS_X11),yes) X11QUAKE = $(BIN_PREFIX)-x11 endif ifeq ($(HAS_SVGA),yes) SVGAQUAKE = $(BIN_PREFIX)-svga endif ifeq ($(HAS_MGL),yes) MGLQUAKE = $(BIN_PREFIX)-mgl endif ifeq ($(HAS_GGI),yes) GGIQUAKE = $(BIN_PREFIX)-ggi endif ifeq ($(HAS_SDL),yes) SDLQUAKE = $(BIN_PREFIX)-sdl endif RELEASE = @RELEASE@ ifeq ($(RELEASE),yes) OPTFLAGS = @RELEASE_CFLAGS@ else OPTFLAGS = -g endif 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) clean-soft clean-gl all: $(targets) ######################################################################## # # Source files # 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 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 \ 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 source SND_STYLE = @SND_STYLE@ SND_SRC = snd_null.c ifeq ($(SND_STYLE),ALSA) SND_SRC = snd_alsa.c alsa.c endif ifeq ($(SND_STYLE),OSS) SND_SRC = snd_dma.c snd_oss.c endif ifeq ($(SND_STYLE),Solaris) SND_SRC = snd_dma.c snd_sun.c endif ifeq ($(SND_STYLE),MME) SND_SRC = snd_dma.c snd_mme.c endif ifeq ($(SND_STYLE),Windows) SND_SRC = snd_dma.c snd_win.c endif SND_SRC += snd_mem.c snd_mix.c $(XTRA_SND_SRC) SYS_SRC = @SYS_SRC@ # Networking source files # 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 # GL renderer source 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 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 SRV_SRC = sv_main.c sv_user.c sv_move.c sv_phys.c 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 QW/UQuake CL_COMMON_SRC = $(MISC_SRC) $(CL_GUI_SRC) $(CL_SRC) \ $(CL_ADDITIONAL_GENERAL_SRC) $(SND_SRC) r_part.c ######################################################################## # # Directory specific stuff # DEFS = @DEFS@ CFLAGS = @CFLAGS@ $(OPTFLAGS) $(DEFS) -I. $(SRC_DIR_INC) \ -I$(COMMON_ODIR) -I$(COMMON_DIR) 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) # 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 $< ########################################################################### # # Specific target rules # # X11 software target ifneq ($(X11QUAKE),) 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@ # 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 $< $(X11QUAKE): soft_DIR $(BUILD_DIR)/../$(X11QUAKE) $(BUILD_DIR)/../$(X11QUAKE): $(ALL_X11_OBJS) $(CC) $(CFLAGS) $(ALL_X11_OBJS) $(X11_LDFLAGS) $(LDFLAGS) $(LIBS) \ -o $(BUILD_DIR)/../$(X11QUAKE) endif # SVGALib software target ifneq ($(SVGAQUAKE),) 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@ # Not sure why this -O is needed, but it is... $(BUILD_DIR)/soft/vid_svgalib.@OBJEXT@: $(COMMON_DIR)/vid_svgalib.c $(CC) -O $(CFLAGS) $(SVGA_CFLAGS) -o $@ -c $< $(BUILD_DIR)/soft/d_copy.@OBJEXT@: $(COMMON_DIR)/d_copy.s $(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< $(SVGAQUAKE): soft_DIR $(BUILD_DIR)/../$(SVGAQUAKE) $(BUILD_DIR)/../$(SVGAQUAKE): $(ALL_SVGA_OBJS) $(CC) $(CFLAGS) $(ALL_SVGA_OBJS) $(SVGA_LDFLAGS) $(LDFLAGS) $(LIBS) \ -o $(BUILD_DIR)/../$(SVGAQUAKE) endif # GGI software target ifneq ($(GGIQUAKE),) # Map the list of source files into a list of object files 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@ $(BUILD_DIR)/soft/vid_ggi.@OBJEXT@: $(COMMON_DIR)/vid_ggi.c $(CC) $(CFLAGS) $(GGI_CFLAGS) -o $@ -c $< $(GGIQUAKE): soft_DIR $(BUILD_DIR)/../$(GGIQUAKE) $(BUILD_DIR)/../$(GGIQUAKE): $(ALL_GGI_OBJS) $(CC) $(CFLAGS) $(ALL_GGI_OBJS) $(GGI_LDFLAGS) $(LDFLAGS) $(LIBS) \ -o $(BUILD_DIR)/../$(GGIQUAKE) 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) $(LIBS) \ -o $(BUILD_DIR)/../$(SDLQUAKE) endif # mingw32 GL target # FIXME: Rewrite this entire section! ifneq ($(MGLQUAKE),) # Map the list of source files into a list of object files 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 MAKE_SURE_mgl_DIR = @DIR=mgl; $(MAKE_SURE_DIR) $(BUILD_DIR)/mgl/%.o: $(SRC_DIR)/%.c $(MAKE_SURE_mgl_DIR) $(CC) $(CFLAGS) $(MGL_CFLAGS) -o $@ -c $< $(BUILD_DIR)/mgl/%.o: $(SRC_DIR)/%.s $(MAKE_SURE_mgl_DIR) $(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $< $(BUILD_DIR)/mgl/%.o: $(COMMON_DIR)/%.c $(MAKE_SURE_mgl_DIR) $(CC) $(CFLAGS) $(MGL_CFLAGS) -o $@ -c $< $(BUILD_DIR)/mgl/%.o: $(COMMON_DIR)/%.s $(MAKE_SURE_mgl_DIR) $(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $< $(MGLQUAKE): $(BUILD_DIR)/../$(MGLQUAKE) $(BUILD_DIR)/../$(MGLQUAKE): $(OBJSquake-mgl) $(CC) $(CFLAGS) $(OBJSquake-mgl) $(MGL_LDFLAGS) $(LDFLAGS) $(LIBS) \ -o $(BUILD_DIR)/../$(MGLQUAKE) endif # X11 GL target ifneq ($(GLQUAKE),) 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@ $(BUILD_DIR)/gl/vid_linuxglx.o: $(COMMON_DIR)/vid_linuxglx.c $(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $< $(GLQUAKE): gl_DIR $(BUILD_DIR)/../$(GLQUAKE) $(BUILD_DIR)/../$(GLQUAKE): $(ALL_GL_OBJS) $(CC) $(CFLAGS) $(ALL_GL_OBJS) $(GL_LDFLAGS) $(LDFLAGS) $(LIBS) \ -o $(BUILD_DIR)/../$(GLQUAKE) endif # 3Dfx GL MCD target ifneq ($(TDFXQUAKE),) 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@ $(BUILD_DIR)/gl/gl_vidlinux_3dfx.@OBJEXT@: $(COMMON_DIR)/gl_vidlinux_3dfx.c $(CC) $(CFLAGS) $(TDFX_CFLAGS) -o $@ -c $< $(TDFXQUAKE): gl_DIR $(BUILD_DIR)/../$(TDFXQUAKE) $(BUILD_DIR)/../$(TDFXQUAKE): $(ALL_TDFX_OBJS) $(CC) $(CFLAGS) $(ALL_TDFX_OBJS) $(TDFX_LDFLAGS) $(LDFLAGS) $(LIBS) \ -o $(BUILD_DIR)/../$(TDFXQUAKE) endif ########################################################################### # # Misc targets # distclean: clean rm -f Makefile $(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) $(PROJECT_DIR)/mkinstalldirs $(DESTDIR)$(prefix)$(bindir) for i in $(targets); do \ $(PROJECT_DIR)/install-sh -m 755 $(BUILD_DIR)/../$$i \ $(DESTDIR)$(prefix)$(bindir)/$$i; \ done check: @echo check not implemented