first
Some checks failed
Linux / Build Linux (push) Has been cancelled
Linux / Build Linux-1 (push) Has been cancelled
macOS / Build macOS (push) Has been cancelled
macOS / Build macOS-1 (push) Has been cancelled
Windows (MinGW) / Build MinGW (push) Has been cancelled
Windows (MinGW) / Build MinGW-1 (push) Has been cancelled
Windows (MSVC) / Build Windows (push) Has been cancelled
Windows (MSVC) / Build Windows-1 (push) Has been cancelled

This commit is contained in:
saarsena@gmail.com 2026-03-24 10:46:22 -04:00
commit 8269b17aa7
652 changed files with 273930 additions and 0 deletions

261
Quake/Makefile.emscripten Normal file
View file

@ -0,0 +1,261 @@
# GNU Makefile for QuakeSpasm WASM (Emscripten)
# Contributed by Roman Turchin
# Edit this makefile, if necessary, to suit your environment.
#
# Build depends on external library gl4es:
# https://github.com/ptitSeb/gl4es
### Enable/Disable codecs for streaming music support
USE_CODEC_WAVE=1
USE_CODEC_FLAC=0
USE_CODEC_MP3=0
USE_CODEC_VORBIS=1
USE_CODEC_OPUS=0
# either of xmp (preferred), mikmod or modplug
USE_CODEC_MIKMOD=0
USE_CODEC_XMP=0
USE_CODEC_MODPLUG=0
USE_CODEC_UMX=0
# which library to use for mp3 decoding: mad or mpg123
MP3LIB=mad
# which library to use for ogg/vorbis decoding: vorbis or tremor
VORBISLIB=vorbis
# ---------------------------
# Helper functions
# ---------------------------
check_gcc = $(shell if echo | $(CC) $(1) -Werror -S -o /dev/null -xc - > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;)
# ---------------------------
HOST_OS = $(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]')
DEBUG ?= 0
# ---------------------------
# build variables
# ---------------------------
CC ?= gcc
LINKER = $(CC)
STRIP ?= strip
PKG_CONFIG ?= pkg-config
CPUFLAGS=
LDFLAGS?=
DFLAGS ?=
CFLAGS ?= -Wall -Wno-trigraphs -MMD
#CFLAGS += $(call check_gcc,-std=gnu11,)
CFLAGS += $(CPUFLAGS)
ifneq ($(DEBUG),0)
DFLAGS += -DDEBUG
CFLAGS += -g
do_strip=
else
DFLAGS += -DNDEBUG
CFLAGS += -O2
#CFLAGS += -fno-asynchronous-unwind-tables
CFLAGS += $(call check_gcc,-fweb,)
CFLAGS += $(call check_gcc,-frename-registers,)
cmd_strip=$(STRIP) $(1)
define do_strip
$(call cmd_strip,$(1));
endef
endif
USE_FLAGS=-pthread --use-port=sdl2 --use-port=zlib --use-port=vorbis -O3
CFLAGS+=$(USE_FLAGS) -I/src/deps/gl4es/include -DUSE_SDL2 -DSDL_FRAMEWORK
LDFLAGS+= $(USE_FLAGS) -sFULL_ES2 /src/deps/gl4es/lib/libGL.a \
-sASYNCIFY -sASYNCIFY_STACK_SIZE=32768 -sSTACK_SIZE=512kb \
-sALLOW_MEMORY_GROWTH -sINITIAL_MEMORY=256mb -sMEMORY_GROWTH_LINEAR_STEP=64mb \
-sENVIRONMENT=web,worker -sPTHREAD_POOL_SIZE=4 -Wno-pthreads-mem-growth -sMODULARIZE \
-lidbfs.js -sCASE_INSENSITIVE_FS=1 \
-sEXPORT_ALL -sEXPORTED_RUNTIME_METHODS=callMain,addRunDependency,removeRunDependency \
-sEXIT_RUNTIME
ifneq ($(VORBISLIB),vorbis)
ifneq ($(VORBISLIB),tremor)
$(error Invalid VORBISLIB setting)
endif
endif
ifneq ($(MP3LIB),mpg123)
ifneq ($(MP3LIB),mad)
$(error Invalid MP3LIB setting)
endif
endif
ifeq ($(MP3LIB),mad)
mp3_obj=snd_mp3
lib_mp3dec=-lmad
endif
ifeq ($(MP3LIB),mpg123)
mp3_obj=snd_mpg123
lib_mp3dec=-lmpg123
endif
ifeq ($(VORBISLIB),vorbis)
cpp_vorbisdec=
#lib_vorbisdec=-lvorbisfile -lvorbis -logg
endif
ifeq ($(VORBISLIB),tremor)
cpp_vorbisdec=-DVORBIS_USE_TREMOR
lib_vorbisdec=-lvorbisidec -logg
endif
CODECLIBS =
ifeq ($(USE_CODEC_WAVE),1)
CFLAGS+= -DUSE_CODEC_WAVE
endif
ifeq ($(USE_CODEC_FLAC),1)
CFLAGS+= -DUSE_CODEC_FLAC
CODECLIBS+= -lFLAC
endif
ifeq ($(USE_CODEC_OPUS),1)
# opus and opusfile put their *.h under <includedir>/opus,
# but they include the headers without the opus directory
# prefix and rely on pkg-config. ewww...
CFLAGS+= -DUSE_CODEC_OPUS
CFLAGS+= $(shell $(PKG_CONFIG) --cflags opusfile)
CODECLIBS+= $(shell $(PKG_CONFIG) --libs opusfile)
endif
ifeq ($(USE_CODEC_VORBIS),1)
CFLAGS+= -DUSE_CODEC_VORBIS $(cpp_vorbisdec)
CODECLIBS+= $(lib_vorbisdec)
endif
ifeq ($(USE_CODEC_MP3),1)
CFLAGS+= -DUSE_CODEC_MP3
CODECLIBS+= $(lib_mp3dec)
endif
ifeq ($(USE_CODEC_MIKMOD),1)
CFLAGS+= -DUSE_CODEC_MIKMOD
CODECLIBS+= -lmikmod
endif
ifeq ($(USE_CODEC_XMP),1)
CFLAGS+= -DUSE_CODEC_XMP
CODECLIBS+= -lxmp
endif
ifeq ($(USE_CODEC_MODPLUG),1)
CFLAGS+= -DUSE_CODEC_MODPLUG
CODECLIBS+= -lmodplug
endif
ifeq ($(USE_CODEC_UMX),1)
CFLAGS+= -DUSE_CODEC_UMX
endif
COMMON_LIBS= -lGL -lm
LIBS = $(COMMON_LIBS) $(NET_LIBS) $(CODECLIBS)
# ---------------------------
# objects
# ---------------------------
MUSIC_OBJS= bgmusic.o \
snd_codec.o \
snd_flac.o \
snd_wave.o \
snd_vorbis.o \
snd_opus.o \
$(mp3_obj).o \
snd_mp3tag.o \
snd_mikmod.o \
snd_modplug.o \
snd_xmp.o \
snd_umx.o
COMOBJ_SND = snd_dma.o snd_mix.o snd_mem.o $(MUSIC_OBJS)
SYSOBJ_SND = snd_sdl.o
SYSOBJ_CDA = cd_sdl.o
SYSOBJ_INPUT = in_sdl.o
SYSOBJ_GL_VID= gl_vidsdl.o
SYSOBJ_NET = net_bsd.o net_udp.o
SYSOBJ_SYS = pl_linux.o sys_sdl_unix.o
SYSOBJ_MAIN= main_sdl.o
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 = strlcat.o \
strlcpy.o \
$(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 \
miniz.o \
crc.o \
cvar.o \
cfgfile.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 \
zone.o \
$(SYSOBJ_SYS) $(SYSOBJ_MAIN)
# ---------------------------
# targets / rules
# ---------------------------
.PHONY: clean debug release
DEFAULT_TARGET = quakespasm
all: $(DEFAULT_TARGET)
%.o: %.c
$(CC) $(DFLAGS) -c $(CFLAGS) $(SDL_CFLAGS) -o $@ $<
quakespasm: $(OBJS)
$(LINKER) $(OBJS) $(LDFLAGS) $(LIBS) $(SDL_LIBS) -o $@.js
release: quakespasm
clean:
$(RM) *.o *.d $(DEFAULT_TARGET).js $(DEFAULT_TARGET).wasm
install: quakespasm
echo "not impletemented"
sinclude $(OBJS:.o=.d)