RetroArch/Makefile.emscripten

128 lines
3.0 KiB
Makefile
Raw Normal View History

TARGET = retroarch.js
OBJ :=
2014-09-13 22:11:08 +00:00
DEFINES := -DRARCH_INTERNAL -DHAVE_CC_RESAMPLER
HAVE_OPENGL = 1
2014-09-14 01:22:04 +00:00
HAVE_EMSCRIPTEN = 1
HAVE_RGUI = 1
HAVE_SDL = 0
HAVE_ZLIB = 1
HAVE_FBO = 1
WANT_MINIZ = 1
MEMORY = 67108864
LTO = 0
2013-12-29 21:19:07 +00:00
# XXX: setting this to 1/2 currently crashes Firefox nightly
PRECISE_F32 = 2
ifneq ($(NATIVE_ZLIB),)
WANT_MINIZ = 0
endif
2014-09-14 00:52:30 +00:00
LIBS :=
2014-09-13 22:55:17 +00:00
LDFLAGS := -L. -s TOTAL_MEMORY=$(MEMORY) -s OUTLINING_LIMIT=50000 --js-library emscripten/library_rwebaudio.js --js-library emscripten/library_rwebinput.js --js-library emscripten/library_rwebcam.js --no-heap-copy
2014-09-13 22:11:08 +00:00
include Makefile.common
OBJ += frontend/platform/platform_emscripten.o \
input/rwebinput_input.o \
audio/rwebaudio.o \
camera/rwebcam.o
libretro = libretro_emscripten.bc
ifeq ($(HAVE_OPENGL), 1)
OBJ += gfx/gl.o gfx/math/matrix.o gfx/fonts/gl_font.o gfx/fonts/gl_raster_font.o gfx/gfx_context.o gfx/context/emscriptenegl_ctx.o gfx/shader_glsl.o gfx/glsym/rglgen.o gfx/glsym/glsym_es2.o
DEFINES += -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DHAVE_EGL -DHAVE_OVERLAY -DHAVE_GLSL
endif
ifeq ($(HAVE_ZLIB), 1)
OBJ += gfx/rpng/rpng.o file_extract.o
DEFINES += -DHAVE_ZLIB
ifeq ($(WANT_MINIZ), 1)
2014-09-14 00:15:41 +00:00
OBJ += deps/rzlib/adler32.o \
deps/rzlib/compress.o \
deps/rzlib/crc32.o \
deps/rzlib/deflate.o \
deps/rzlib/gzclose.o \
deps/rzlib/gzlib.o \
deps/rzlib/gzread.o \
deps/rzlib/gzwrite.o \
deps/rzlib/inffast.o \
deps/rzlib/inflate.o \
deps/rzlib/inftrees.o \
deps/rzlib/trees.o \
deps/rzlib/uncompr.o \
deps/rzlib/zutil.o \
deps/rzlib/ioapi.o \
deps/rzlib/unzip.o \
decompress/zip_support.o
DEFINES += -DWANT_MINIZ
else
OBJ += deps/rzlib/ioapi.o deps/rzlib/unzip.o decompress/zip_support.o
LIBS += -lz
DEFINES += -DHAVE_ZLIB_DEFLATE
endif
endif
ifneq ($(V), 1)
Q := @
endif
ifeq ($(DEBUG), 1)
LDFLAGS += -O0 -g
CFLAGS += -O0 -g
else
LDFLAGS += -O2
# WARNING: some optimizations can break some cores (ex: LTO breaks tyrquake)
2013-12-29 21:19:07 +00:00
LDFLAGS += -s PRECISE_F32=$(PRECISE_F32)
ifeq ($(LTO), 1)
LDFLAGS += --llvm-lto 3
endif
CFLAGS += -O2
endif
CFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I. -std=gnu99
all: $(TARGET)
$(TARGET): $(OBJ)
@$(if $(Q), $(shell echo echo LD $@),)
$(Q)$(LD) -o $@ $(OBJ) $(libretro) $(LIBS) $(LDFLAGS)
%.o: %.c
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
%.o: %.cpp
@$(if $(Q), $(shell echo echo CXX $<),)
$(Q)$(CXX) $(CXXFLAGS) $(DEFINES) -c -o $@ $<
clean:
rm -f *.o
2014-09-13 23:58:57 +00:00
rm -f deps/rzlib/*.o
rm -f frontend/*.o
rm -f frontend/menu/*.o
2013-12-29 21:19:07 +00:00
rm -f frontend/menu/disp/*.o
rm -f audio/*.o
rm -f audio/xaudio-c/*.o
rm -f compat/*.o
rm -f compat/rxml/*.o
rm -f conf/*.o
rm -f gfx/scaler/*.o
rm -f gfx/*.o
rm -f gfx/d3d9/*.o
rm -f gfx/context/*.o
rm -f gfx/math/*.o
rm -f gfx/fonts/*.o
rm -f gfx/py_state/*.o
rm -f gfx/rpng/*.o
rm -f gfx/glsym/*.o
rm -f record/*.o
rm -f input/*.o
rm -f tools/*.o
2013-08-07 22:37:05 +00:00
rm -f $(TARGET)
.PHONY: all clean