mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
Makefile.w64: now that native amd64 builds work, added a Win64 makefile for
cross-compilation using mingw-w64. git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@41 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
46326769ae
commit
a03bcdf451
1 changed files with 103 additions and 0 deletions
103
quakespasm/Quake/Makefile.w64
Normal file
103
quakespasm/Quake/Makefile.w64
Normal file
|
@ -0,0 +1,103 @@
|
|||
# GNU Makefile for cross-compiling fitzquake.exe (Win64 : MinGW-w64)
|
||||
# using cross-toolchains on a linux host / Feb. 17, 2010
|
||||
# "make DEBUG=1" builds debug client
|
||||
# "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
|
||||
|
||||
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
|
||||
#STRIP_CMD := @echo "not stripping"
|
||||
STRIP_CMD := @/bin/true
|
||||
else
|
||||
DFLAGS += -DNDEBUG
|
||||
CFLAGS += -O2
|
||||
CFLAGS += $(call check_gcc,-fweb,)
|
||||
CFLAGS += $(call check_gcc,-frename-registers,)
|
||||
STRIP_CMD := $(STRIP)
|
||||
endif
|
||||
|
||||
SDL_CONFIG ?= sdl-config
|
||||
SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
|
||||
SDL_LFLAGS := $(shell $(SDL_CONFIG) --libs)
|
||||
|
||||
SDL_LIBS := SDL_net
|
||||
|
||||
COMMON_LIBS:= m opengl32 ws2_32
|
||||
|
||||
LIBS := $(patsubst %,-l%,$(COMMON_LIBS) $(SDL_LIBS))
|
||||
|
||||
# ---------------------------
|
||||
# targets
|
||||
# ---------------------------
|
||||
|
||||
.PHONY: clean debug release
|
||||
|
||||
DEFAULT_TARGET := fitzquake.exe
|
||||
|
||||
# ---------------------------
|
||||
# rules
|
||||
# ---------------------------
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(DFLAGS) -c $(CFLAGS) $(SDL_CFLAGS) -o $@ $^
|
||||
%.res: ../Windows/%.rc
|
||||
$(WINDRES) --output-format=coff -I../Windows -o $@ $^
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# FitzQuake SDL objects
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
OBJS := \
|
||||
cd_sdl.o console.o gl_rmain.o host.o net_main.o r_part.o sv_move.o \
|
||||
chase.o crc.o gl_rmisc.o image.o net_sdlnet.o r_sprite.o sv_phys.o \
|
||||
cl_demo.o cvar.o gl_screen.o in_sdl.o net_sdl.o r_world.o sv_user.o \
|
||||
cl_input.o gl_draw.o gl_sky.o keys.o pl_win.o sbar.o sys_sdl.o \
|
||||
cl_main.o gl_fog.o gl_test.o main.o pr_cmds.o snd_dma.o view.o \
|
||||
cl_parse.o gl_mesh.o gl_texmgr.o mathlib.o pr_edict.o snd_mem.o wad.o \
|
||||
cl_tent.o gl_model.o gl_vidsdl.o menu.o pr_exec.o snd_mix.o world.o \
|
||||
cmd.o gl_refrag.o gl_warp.o net_dgrm.o r_alias.o snd_sdl.o zone.o \
|
||||
common.o gl_rlight.o host_cmd.o net_loop.o r_brush.o sv_main.o Fitzquake.res
|
||||
|
||||
# ------------------------
|
||||
# build rules for mingw :
|
||||
# ------------------------
|
||||
|
||||
fitzquake.exe: $(OBJS)
|
||||
$(CC) $(CFLAGS) -o fitzquake.exe $(OBJS) $(SDL_LFLAGS) $(LIBS)
|
||||
$(STRIP_CMD) fitzquake.exe
|
||||
|
||||
release: fitzquake.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)
|
||||
|
Loading…
Reference in a new issue