mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-14 00:50:38 +00:00
d098087606
* sys_sdl_win.c: Copied from sys_sdl.c. Windows-only. Remove unix code. (Sys_Init): New procedure. Call AllocConsole() and get input and output handles for dedicated servers. (Sys_ConsoleInput): Add a windows version. (Sys_Error): Adjust for the allocated console and use windows api. Adjust message output. Remove the console timeout, doesn't work somehow. Just display the console for 3 seconds and then exit. Rely on SDL that it redirects/logs the stdout/stderr to files. * sys_sdl_unix.c: Rename from sys_sdl.c. Unix-only. Remove windows code. (Sys_Init): New procedure. (Sys_Error): Remove Windows-oriented dedicated server specific code. Adjust message output. * sys_sdl.c: Delete. * sys.h (Sys_Init): Add prototype. * main_sdl.c (main): Call Sys_Init(). * pl_linux.c (PL_ErrorDialog): Remove terminal printing which Sys_Error already does. * pl_osx.m (PL_ErrorDialog): Update from uhexen2. * pl_win.c: Make icon handle static. whitespace and formatting tidy-up. * Makefile, Makefile.darwin, Makefile.w32, Makefile.w64: Adjust for the sys_sdl.c name change to sys_sdl_unix.c and sys_sdl_win.c. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@223 af15c1b1-3010-417e-b628-4374ebc0bcbd
190 lines
3.9 KiB
Text
190 lines
3.9 KiB
Text
# GNU Makefile for cross-compiling quakespasm.exe (Win64 : MinGW-w64)
|
|
# using cross-toolchains on a linux host / June 21, 2010.
|
|
# "make DEBUG=1" builds debug client
|
|
# "make WINSOCK2=0" to use the old WinSock 1.1 api when not using SDL_net.
|
|
# otherwise, WinSock2 api will be used.
|
|
# "make SDLNET=1" to enable SDL_net. otherwise, the WinSock api will be
|
|
# used directly.
|
|
# "make SDL_CONFIG=/path/to/sdl-config" for sdl-config from cross-compiled SDL
|
|
|
|
# ============================================================================
|
|
# Helper functions
|
|
# ============================================================================
|
|
|
|
check_gcc = $(shell if echo | $(CC) $(1) -S -o /dev/null -xc - > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;)
|
|
|
|
# ============================================================================
|
|
|
|
DEBUG ?= 0
|
|
WINSOCK2 ?= 1
|
|
SDLNET ?= 0
|
|
|
|
TOPDIR := $(shell pwd)
|
|
|
|
# ---------------------------------------
|
|
# Define some build variables
|
|
# ---------------------------------------
|
|
|
|
CC = x86_64-w64-mingw32-gcc
|
|
WINDRES = x86_64-w64-mingw32-windres
|
|
STRIP = x86_64-w64-mingw32-strip
|
|
|
|
#CPUFLAGS= -mtune=k8
|
|
#CPUFLAGS= -march=atom
|
|
CPUFLAGS=
|
|
DFLAGS ?=
|
|
CFLAGS ?= -Wall -Wno-trigraphs
|
|
# CFLAGS += -Werror
|
|
CFLAGS += $(CPUFLAGS)
|
|
|
|
ifneq ($(DEBUG),0)
|
|
DFLAGS += -DDEBUG
|
|
CFLAGS += -g
|
|
do_strip=
|
|
else
|
|
DFLAGS += -DNDEBUG
|
|
CFLAGS += -O2
|
|
CFLAGS += $(call check_gcc,-fweb,)
|
|
CFLAGS += $(call check_gcc,-frename-registers,)
|
|
cmd_strip=$(STRIP) $(1)
|
|
define do_strip
|
|
$(call cmd_strip,$(1));
|
|
endef
|
|
endif
|
|
|
|
SDL_CONFIG ?= sdl-config
|
|
SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
|
|
SDL_LFLAGS := $(shell $(SDL_CONFIG) --libs)
|
|
|
|
ifeq ($(WINSOCK2),1)
|
|
DEFWINSOCK :=-D_USE_WINSOCK2
|
|
LIBWINSOCK := ws2_32
|
|
else
|
|
DEFWINSOCK :=
|
|
LIBWINSOCK := wsock32
|
|
endif
|
|
|
|
ifeq ($(SDLNET),1)
|
|
NET_LIBS := SDL_net
|
|
CFLAGS +=-D_USE_SDLNET
|
|
else
|
|
CFLAGS += $(DEFWINSOCK)
|
|
NET_LIBS := $(LIBWINSOCK)
|
|
endif
|
|
|
|
COMMON_LIBS:= m opengl32
|
|
|
|
LIBS := $(patsubst %,-l%,$(COMMON_LIBS) $(NET_LIBS))
|
|
|
|
# ---------------------------
|
|
# targets
|
|
# ---------------------------
|
|
|
|
.PHONY: clean debug release
|
|
|
|
DEFAULT_TARGET := quakespasm.exe
|
|
|
|
# ---------------------------
|
|
# rules
|
|
# ---------------------------
|
|
|
|
%.o: %.c
|
|
$(CC) $(DFLAGS) -c $(CFLAGS) $(SDL_CFLAGS) -o $@ $^
|
|
%.res: ../Windows/%.rc
|
|
$(WINDRES) --output-format=coff -I../Windows -o $@ $^
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# objects
|
|
# ----------------------------------------------------------------------------
|
|
|
|
COMOBJ_SND := snd_dma.o snd_mix.o snd_mem.o
|
|
SYSOBJ_SND := snd_sdl.o
|
|
SYSOBJ_CDA := cd_sdl.o
|
|
SYSOBJ_INPUT := in_sdl.o
|
|
SYSOBJ_GL_VID:= gl_vidsdl.o
|
|
ifeq ($(SDLNET),1)
|
|
SYSOBJ_NET := net_sdl.o net_sdlnet.o
|
|
else
|
|
SYSOBJ_NET := net_win.o net_wins.o net_wipx.o
|
|
endif
|
|
SYSOBJ_SYS := pl_win.o sys_sdl_win.o
|
|
SYSOBJ_MAIN:= main_sdl.o
|
|
SYSOBJ_RES := QuakeSpasm.res
|
|
|
|
GLOBJS = \
|
|
gl_refrag.o \
|
|
gl_rlight.o \
|
|
gl_rmain.o \
|
|
gl_fog.o \
|
|
gl_rmisc.o \
|
|
r_part.o \
|
|
r_world.o \
|
|
gl_screen.o \
|
|
gl_sky.o \
|
|
gl_warp.o \
|
|
$(SYSOBJ_GL_VID) \
|
|
gl_draw.o \
|
|
image.o \
|
|
gl_texmgr.o \
|
|
gl_mesh.o \
|
|
r_sprite.o \
|
|
r_alias.o \
|
|
r_brush.o \
|
|
gl_model.o
|
|
|
|
OBJS := \
|
|
$(GLOBJS) \
|
|
$(SYSOBJ_INPUT) \
|
|
$(COMOBJ_SND) \
|
|
$(SYSOBJ_SND) \
|
|
$(SYSOBJ_CDA) \
|
|
$(SYSOBJ_NET) \
|
|
net_dgrm.o \
|
|
net_loop.o \
|
|
net_main.o \
|
|
chase.o \
|
|
cl_demo.o \
|
|
cl_input.o \
|
|
cl_main.o \
|
|
cl_parse.o \
|
|
cl_tent.o \
|
|
console.o \
|
|
keys.o \
|
|
menu.o \
|
|
sbar.o \
|
|
view.o \
|
|
wad.o \
|
|
cmd.o \
|
|
common.o \
|
|
crc.o \
|
|
cvar.o \
|
|
host.o \
|
|
host_cmd.o \
|
|
mathlib.o \
|
|
pr_cmds.o \
|
|
pr_edict.o \
|
|
pr_exec.o \
|
|
sv_main.o \
|
|
sv_move.o \
|
|
sv_phys.o \
|
|
sv_user.o \
|
|
world.o \
|
|
conback.o \
|
|
zone.o \
|
|
$(SYSOBJ_SYS) $(SYSOBJ_MAIN) $(SYSOBJ_RES)
|
|
|
|
# ------------------------
|
|
# build rules for mingw-w64 :
|
|
# ------------------------
|
|
|
|
quakespasm.exe: $(OBJS)
|
|
$(CC) $(CFLAGS) -o quakespasm.exe $(OBJS) $(SDL_LFLAGS) $(LIBS)
|
|
$(call do_strip,$@)
|
|
|
|
release: quakespasm.exe
|
|
debug:
|
|
$(error Use "make DEBUG=1")
|
|
|
|
clean:
|
|
rm -f $(shell find . \( -name '*~' -o -name '#*#' -o -name '*.o' -o -name '*.res' -o -name $(DEFAULT_TARGET) \) -print)
|
|
|