2010-02-18 12:14:51 +00:00
|
|
|
# GNU Makefile for cross-compiling quakespasm.exe (Win64 : MinGW-w64)
|
2010-08-17 19:30:35 +00:00
|
|
|
# using cross-toolchains on a linux host / Aug. 17, 2010.
|
2010-02-17 16:40:41 +00:00
|
|
|
# "make DEBUG=1" builds debug client
|
* Makefile, Makefile.darwin, Makefile.w32, Makefile.w64: Build changes:
The SDL_net driver is now disabled by default and platform-specific network
drivers will be used. To compile for SDL_net, a command like "make SDLNET=1"
must be used, in which case a new preprocessor macro _USE_SDLNET will be
defined in the CFLAGS. For windows targets when not using SDL_net, WINSOCK2
is added as another option: A command line like "make WINSOCK2=1" will enable
WinSock2 api and a new preprocessor macro _USE_WINSOCK2 will be defined in
the CFLAGS. Or, a command line like "make WINSOCK2=0" will disable WinSock2
api and the old WinSock 1.1 api will be used instead. For Win64, WinSock2 is
enabled by default. For Win32, WinSock 1.1 is the default api.
* net_bsd.c, net_dgrm.c, net_loop.c, net_main.c, net_sdl.c, net_sdlnet.c,
net_udp.c, net_win.c, net_wins.c, net_wipx.c: Use the newly added net_sys.h
header. The sys_socket_t type is not in use, yet.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@215 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-06-21 11:10:38 +00:00
|
|
|
# "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.
|
2010-02-17 16:40:41 +00:00
|
|
|
# "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
|
* Makefile, Makefile.darwin, Makefile.w32, Makefile.w64: Build changes:
The SDL_net driver is now disabled by default and platform-specific network
drivers will be used. To compile for SDL_net, a command like "make SDLNET=1"
must be used, in which case a new preprocessor macro _USE_SDLNET will be
defined in the CFLAGS. For windows targets when not using SDL_net, WINSOCK2
is added as another option: A command line like "make WINSOCK2=1" will enable
WinSock2 api and a new preprocessor macro _USE_WINSOCK2 will be defined in
the CFLAGS. Or, a command line like "make WINSOCK2=0" will disable WinSock2
api and the old WinSock 1.1 api will be used instead. For Win64, WinSock2 is
enabled by default. For Win32, WinSock 1.1 is the default api.
* net_bsd.c, net_dgrm.c, net_loop.c, net_main.c, net_sdl.c, net_sdlnet.c,
net_udp.c, net_win.c, net_wins.c, net_wipx.c: Use the newly added net_sys.h
header. The sys_socket_t type is not in use, yet.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@215 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-06-21 11:10:38 +00:00
|
|
|
WINSOCK2 ?= 1
|
|
|
|
SDLNET ?= 0
|
2010-02-17 16:40:41 +00:00
|
|
|
|
|
|
|
TOPDIR := $(shell pwd)
|
|
|
|
|
|
|
|
# ---------------------------------------
|
|
|
|
# Define some build variables
|
|
|
|
# ---------------------------------------
|
|
|
|
|
2010-08-17 19:30:35 +00:00
|
|
|
TARGET=x86_64-w64-mingw32
|
|
|
|
|
|
|
|
CROSS_COMPILE=1
|
|
|
|
|
|
|
|
ifeq ($(CROSS_COMPILE),1)
|
|
|
|
TOOLCHAIN_PREFIX=$(TARGET)-
|
|
|
|
else
|
|
|
|
TOOLCHAIN_PREFIX=
|
|
|
|
endif
|
|
|
|
|
|
|
|
CC = $(TOOLCHAIN_PREFIX)gcc
|
|
|
|
WINDRES = $(TOOLCHAIN_PREFIX)windres
|
|
|
|
STRIP = $(TOOLCHAIN_PREFIX)strip
|
2010-02-17 16:40:41 +00:00
|
|
|
|
|
|
|
#CPUFLAGS= -mtune=k8
|
|
|
|
#CPUFLAGS= -march=atom
|
|
|
|
CPUFLAGS=
|
|
|
|
DFLAGS ?=
|
|
|
|
CFLAGS ?= -Wall -Wno-trigraphs
|
|
|
|
# CFLAGS += -Werror
|
|
|
|
CFLAGS += $(CPUFLAGS)
|
|
|
|
|
|
|
|
ifneq ($(DEBUG),0)
|
|
|
|
DFLAGS += -DDEBUG
|
|
|
|
CFLAGS += -g
|
2010-04-24 14:50:18 +00:00
|
|
|
do_strip=
|
2010-02-17 16:40:41 +00:00
|
|
|
else
|
|
|
|
DFLAGS += -DNDEBUG
|
|
|
|
CFLAGS += -O2
|
|
|
|
CFLAGS += $(call check_gcc,-fweb,)
|
|
|
|
CFLAGS += $(call check_gcc,-frename-registers,)
|
2010-04-24 14:50:18 +00:00
|
|
|
cmd_strip=$(STRIP) $(1)
|
|
|
|
define do_strip
|
|
|
|
$(call cmd_strip,$(1));
|
|
|
|
endef
|
2010-02-17 16:40:41 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
SDL_CONFIG ?= sdl-config
|
|
|
|
SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
|
|
|
|
SDL_LFLAGS := $(shell $(SDL_CONFIG) --libs)
|
|
|
|
|
* Makefile, Makefile.darwin, Makefile.w32, Makefile.w64: Build changes:
The SDL_net driver is now disabled by default and platform-specific network
drivers will be used. To compile for SDL_net, a command like "make SDLNET=1"
must be used, in which case a new preprocessor macro _USE_SDLNET will be
defined in the CFLAGS. For windows targets when not using SDL_net, WINSOCK2
is added as another option: A command line like "make WINSOCK2=1" will enable
WinSock2 api and a new preprocessor macro _USE_WINSOCK2 will be defined in
the CFLAGS. Or, a command line like "make WINSOCK2=0" will disable WinSock2
api and the old WinSock 1.1 api will be used instead. For Win64, WinSock2 is
enabled by default. For Win32, WinSock 1.1 is the default api.
* net_bsd.c, net_dgrm.c, net_loop.c, net_main.c, net_sdl.c, net_sdlnet.c,
net_udp.c, net_win.c, net_wins.c, net_wipx.c: Use the newly added net_sys.h
header. The sys_socket_t type is not in use, yet.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@215 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-06-21 11:10:38 +00:00
|
|
|
ifeq ($(WINSOCK2),1)
|
|
|
|
DEFWINSOCK :=-D_USE_WINSOCK2
|
|
|
|
LIBWINSOCK := ws2_32
|
|
|
|
else
|
|
|
|
DEFWINSOCK :=
|
|
|
|
LIBWINSOCK := wsock32
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(SDLNET),1)
|
2010-06-20 10:03:05 +00:00
|
|
|
NET_LIBS := SDL_net
|
* Makefile, Makefile.darwin, Makefile.w32, Makefile.w64: Build changes:
The SDL_net driver is now disabled by default and platform-specific network
drivers will be used. To compile for SDL_net, a command like "make SDLNET=1"
must be used, in which case a new preprocessor macro _USE_SDLNET will be
defined in the CFLAGS. For windows targets when not using SDL_net, WINSOCK2
is added as another option: A command line like "make WINSOCK2=1" will enable
WinSock2 api and a new preprocessor macro _USE_WINSOCK2 will be defined in
the CFLAGS. Or, a command line like "make WINSOCK2=0" will disable WinSock2
api and the old WinSock 1.1 api will be used instead. For Win64, WinSock2 is
enabled by default. For Win32, WinSock 1.1 is the default api.
* net_bsd.c, net_dgrm.c, net_loop.c, net_main.c, net_sdl.c, net_sdlnet.c,
net_udp.c, net_win.c, net_wins.c, net_wipx.c: Use the newly added net_sys.h
header. The sys_socket_t type is not in use, yet.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@215 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-06-21 11:10:38 +00:00
|
|
|
CFLAGS +=-D_USE_SDLNET
|
|
|
|
else
|
|
|
|
CFLAGS += $(DEFWINSOCK)
|
|
|
|
NET_LIBS := $(LIBWINSOCK)
|
|
|
|
endif
|
2010-02-18 22:02:13 +00:00
|
|
|
|
|
|
|
COMMON_LIBS:= m opengl32
|
2010-02-17 16:40:41 +00:00
|
|
|
|
2010-06-20 10:03:05 +00:00
|
|
|
LIBS := $(patsubst %,-l%,$(COMMON_LIBS) $(NET_LIBS))
|
2010-02-17 16:40:41 +00:00
|
|
|
|
|
|
|
# ---------------------------
|
|
|
|
# targets
|
|
|
|
# ---------------------------
|
|
|
|
|
|
|
|
.PHONY: clean debug release
|
|
|
|
|
2010-02-18 12:14:51 +00:00
|
|
|
DEFAULT_TARGET := quakespasm.exe
|
2010-02-17 16:40:41 +00:00
|
|
|
|
|
|
|
# ---------------------------
|
|
|
|
# rules
|
|
|
|
# ---------------------------
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(DFLAGS) -c $(CFLAGS) $(SDL_CFLAGS) -o $@ $^
|
|
|
|
%.res: ../Windows/%.rc
|
|
|
|
$(WINDRES) --output-format=coff -I../Windows -o $@ $^
|
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------
|
2010-02-18 12:14:51 +00:00
|
|
|
# objects
|
2010-02-17 16:40:41 +00:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
2010-04-24 15:55:02 +00:00
|
|
|
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
|
* Makefile, Makefile.darwin, Makefile.w32, Makefile.w64: Build changes:
The SDL_net driver is now disabled by default and platform-specific network
drivers will be used. To compile for SDL_net, a command like "make SDLNET=1"
must be used, in which case a new preprocessor macro _USE_SDLNET will be
defined in the CFLAGS. For windows targets when not using SDL_net, WINSOCK2
is added as another option: A command line like "make WINSOCK2=1" will enable
WinSock2 api and a new preprocessor macro _USE_WINSOCK2 will be defined in
the CFLAGS. Or, a command line like "make WINSOCK2=0" will disable WinSock2
api and the old WinSock 1.1 api will be used instead. For Win64, WinSock2 is
enabled by default. For Win32, WinSock 1.1 is the default api.
* net_bsd.c, net_dgrm.c, net_loop.c, net_main.c, net_sdl.c, net_sdlnet.c,
net_udp.c, net_win.c, net_wins.c, net_wipx.c: Use the newly added net_sys.h
header. The sys_socket_t type is not in use, yet.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@215 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-06-21 11:10:38 +00:00
|
|
|
ifeq ($(SDLNET),1)
|
2010-04-24 15:55:02 +00:00
|
|
|
SYSOBJ_NET := net_sdl.o net_sdlnet.o
|
* Makefile, Makefile.darwin, Makefile.w32, Makefile.w64: Build changes:
The SDL_net driver is now disabled by default and platform-specific network
drivers will be used. To compile for SDL_net, a command like "make SDLNET=1"
must be used, in which case a new preprocessor macro _USE_SDLNET will be
defined in the CFLAGS. For windows targets when not using SDL_net, WINSOCK2
is added as another option: A command line like "make WINSOCK2=1" will enable
WinSock2 api and a new preprocessor macro _USE_WINSOCK2 will be defined in
the CFLAGS. Or, a command line like "make WINSOCK2=0" will disable WinSock2
api and the old WinSock 1.1 api will be used instead. For Win64, WinSock2 is
enabled by default. For Win32, WinSock 1.1 is the default api.
* net_bsd.c, net_dgrm.c, net_loop.c, net_main.c, net_sdl.c, net_sdlnet.c,
net_udp.c, net_win.c, net_wins.c, net_wipx.c: Use the newly added net_sys.h
header. The sys_socket_t type is not in use, yet.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@215 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-06-21 11:10:38 +00:00
|
|
|
else
|
|
|
|
SYSOBJ_NET := net_win.o net_wins.o net_wipx.o
|
|
|
|
endif
|
2010-06-22 11:01:24 +00:00
|
|
|
SYSOBJ_SYS := pl_win.o sys_sdl_win.o
|
2010-04-24 15:55:02 +00:00
|
|
|
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
|
|
|
|
|
2010-02-17 16:40:41 +00:00
|
|
|
OBJS := \
|
2010-04-24 15:55:02 +00:00
|
|
|
$(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)
|
2010-02-17 16:40:41 +00:00
|
|
|
|
|
|
|
# ------------------------
|
2010-02-18 12:14:51 +00:00
|
|
|
# build rules for mingw-w64 :
|
2010-02-17 16:40:41 +00:00
|
|
|
# ------------------------
|
|
|
|
|
2010-02-18 12:14:51 +00:00
|
|
|
quakespasm.exe: $(OBJS)
|
|
|
|
$(CC) $(CFLAGS) -o quakespasm.exe $(OBJS) $(SDL_LFLAGS) $(LIBS)
|
2010-04-24 14:50:18 +00:00
|
|
|
$(call do_strip,$@)
|
2010-02-17 16:40:41 +00:00
|
|
|
|
2010-02-18 12:14:51 +00:00
|
|
|
release: quakespasm.exe
|
2010-02-17 16:40:41 +00:00
|
|
|
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)
|
|
|
|
|