2016-08-29 00:14:42 +00:00
|
|
|
TARGET := retroarch.js
|
2013-07-18 00:26:01 +00:00
|
|
|
|
2016-09-21 20:10:05 +00:00
|
|
|
EOPT = USE_ZLIB=1 USE_SDL=2 # Emscripten specific options
|
2016-08-29 05:23:58 +00:00
|
|
|
EOPTS = $(addprefix -s $(EMPTY), $(EOPT)) # Add '-s ' to each option
|
|
|
|
|
2016-09-22 21:37:41 +00:00
|
|
|
PTHREAD = 0
|
2014-09-14 01:38:36 +00:00
|
|
|
OS = Emscripten
|
2014-09-13 22:04:42 +00:00
|
|
|
OBJ :=
|
2016-09-22 21:37:41 +00:00
|
|
|
DEFINES := -DRARCH_INTERNAL -DHAVE_OVERLAY -DHAVE_MAIN -s USE_PTHREADS=$(PTHREAD)
|
2016-09-21 20:10:05 +00:00
|
|
|
DEFINES += -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DHAVE_EGL -DHAVE_OVERLAY -DHAVE_GLSL -DHAVE_FILTERS_BUILTIN
|
2013-07-18 00:26:01 +00:00
|
|
|
|
2016-12-12 11:48:04 +00:00
|
|
|
HAVE_CC_RESAMPLER = 1
|
2015-11-20 16:41:50 +00:00
|
|
|
HAVE_EGL = 1
|
2016-09-16 22:38:35 +00:00
|
|
|
HAVE_OPENGLES = 1
|
2016-09-17 07:01:59 +00:00
|
|
|
HAVE_RJPEG = 0
|
2016-08-01 14:25:02 +00:00
|
|
|
HAVE_RPNG = 1
|
2014-09-14 01:22:04 +00:00
|
|
|
HAVE_EMSCRIPTEN = 1
|
2013-07-18 00:26:01 +00:00
|
|
|
HAVE_RGUI = 1
|
2013-09-11 00:21:48 +00:00
|
|
|
HAVE_SDL = 0
|
2016-08-29 05:23:58 +00:00
|
|
|
HAVE_SDL2 = 1
|
2013-07-18 00:26:01 +00:00
|
|
|
HAVE_ZLIB = 1
|
|
|
|
HAVE_FBO = 1
|
2015-03-14 04:24:57 +00:00
|
|
|
WANT_ZLIB = 1
|
2016-09-24 17:59:10 +00:00
|
|
|
MEMORY = 536870912
|
2016-09-29 00:32:14 +00:00
|
|
|
|
2013-12-29 21:19:07 +00:00
|
|
|
# XXX: setting this to 1/2 currently crashes Firefox nightly
|
2014-07-07 00:02:44 +00:00
|
|
|
PRECISE_F32 = 2
|
2013-07-18 00:26:01 +00:00
|
|
|
|
2013-07-27 18:17:22 +00:00
|
|
|
ifneq ($(NATIVE_ZLIB),)
|
2015-03-14 04:24:57 +00:00
|
|
|
WANT_ZLIB = 0
|
2013-07-27 18:17:22 +00:00
|
|
|
endif
|
|
|
|
|
2016-08-01 14:29:56 +00:00
|
|
|
ifeq ($(HAVE_SDL2), 1)
|
2016-10-04 05:33:57 +00:00
|
|
|
DEFINES += -DHAVE_SDL2
|
2016-08-01 14:29:56 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
#if you compile with SDL2 flag add this Emscripten flag "-s USE_SDL=2" to LDFLAGS:
|
2016-07-31 15:09:56 +00:00
|
|
|
|
2016-08-29 05:23:58 +00:00
|
|
|
LIBS := -s USE_SDL=2 -s USE_ZLIB=1
|
2016-09-24 00:48:50 +00:00
|
|
|
LDFLAGS := -L. --no-heap-copy -s USE_ZLIB=1 -s TOTAL_MEMORY=$(MEMORY) \
|
2015-07-26 22:08:14 +00:00
|
|
|
-s EXPORTED_FUNCTIONS="['_main', '_malloc', '_cmd_savefiles', '_cmd_save_state', '_cmd_load_state', '_cmd_take_screenshot']" \
|
|
|
|
--js-library emscripten/library_rwebaudio.js \
|
|
|
|
--js-library emscripten/library_rwebinput.js \
|
|
|
|
--js-library emscripten/library_rwebcam.js
|
2016-09-23 15:16:45 +00:00
|
|
|
ifneq ($(PTHREAD), 0)
|
2016-09-24 00:48:50 +00:00
|
|
|
LDFLAGS += -s USE_PTHREADS=$(PTHREAD) -s PTHREAD_POOL_SIZE=2
|
|
|
|
endif
|
|
|
|
|
2016-09-29 00:32:14 +00:00
|
|
|
ifeq ($(ASYNC), 1)
|
2016-09-24 00:48:50 +00:00
|
|
|
LDFLAGS += -s ASYNCIFY=$(ASYNC)
|
2016-09-23 15:16:45 +00:00
|
|
|
endif
|
2014-09-13 22:55:17 +00:00
|
|
|
|
2014-09-13 22:11:08 +00:00
|
|
|
include Makefile.common
|
|
|
|
|
2015-04-19 18:58:44 +00:00
|
|
|
OBJ += gfx/video_filters/2xsai.o
|
|
|
|
OBJ += gfx/video_filters/super2xsai.o
|
|
|
|
OBJ += gfx/video_filters/supereagle.o
|
|
|
|
OBJ += gfx/video_filters/2xbr.o
|
|
|
|
OBJ += gfx/video_filters/darken.o
|
|
|
|
OBJ += gfx/video_filters/epx.o
|
|
|
|
OBJ += gfx/video_filters/scale2x.o
|
|
|
|
OBJ += gfx/video_filters/blargg_ntsc_snes.o
|
|
|
|
OBJ += gfx/video_filters/lq2x.o
|
|
|
|
OBJ += gfx/video_filters/phosphor2x.o
|
|
|
|
|
|
|
|
OBJ += audio/audio_filters/echo.o
|
|
|
|
OBJ += audio/audio_filters/eq.o
|
|
|
|
OBJ += audio/audio_filters/chorus.o
|
|
|
|
OBJ += audio/audio_filters/iir.o
|
|
|
|
OBJ += audio/audio_filters/panning.o
|
|
|
|
OBJ += audio/audio_filters/phaser.o
|
|
|
|
OBJ += audio/audio_filters/reverb.o
|
|
|
|
OBJ += audio/audio_filters/wahwah.o
|
|
|
|
|
|
|
|
CFLAGS += -Ideps/zlib/
|
2013-08-18 06:50:10 +00:00
|
|
|
libretro = libretro_emscripten.bc
|
2013-07-18 00:26:01 +00:00
|
|
|
|
|
|
|
ifneq ($(V), 1)
|
|
|
|
Q := @
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(DEBUG), 1)
|
2013-07-27 18:17:22 +00:00
|
|
|
LDFLAGS += -O0 -g
|
2013-08-18 06:50:10 +00:00
|
|
|
CFLAGS += -O0 -g
|
2013-07-18 00:26:01 +00:00
|
|
|
else
|
2013-08-18 06:50:10 +00:00
|
|
|
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)
|
2013-08-18 06:50:10 +00:00
|
|
|
ifeq ($(LTO), 1)
|
|
|
|
LDFLAGS += --llvm-lto 3
|
|
|
|
endif
|
|
|
|
CFLAGS += -O2
|
2013-07-18 00:26:01 +00:00
|
|
|
endif
|
|
|
|
|
2016-09-17 08:12:22 +00:00
|
|
|
CFLAGS += -DHAVE_RPNG -Wall -Wno-unused-result -Wno-unused-variable -I. -Ilibretro-common/include -std=gnu99 -s USE_ZLIB=1 \
|
2015-07-26 22:08:14 +00:00
|
|
|
-s EXPORTED_FUNCTIONS="['_main', '_malloc', '_cmd_savefiles', '_cmd_save_state', '_cmd_take_screenshot']"
|
2013-07-18 00:26:01 +00:00
|
|
|
|
|
|
|
all: $(TARGET)
|
|
|
|
|
|
|
|
$(TARGET): $(OBJ)
|
|
|
|
@$(if $(Q), $(shell echo echo LD $@),)
|
2013-08-18 06:50:10 +00:00
|
|
|
$(Q)$(LD) -o $@ $(OBJ) $(libretro) $(LIBS) $(LDFLAGS)
|
2013-07-18 00:26:01 +00:00
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
@$(if $(Q), $(shell echo echo CC $<),)
|
2016-08-29 05:23:58 +00:00
|
|
|
$(Q)$(CC) $(CFLAGS) $(DEFINES) $(EOPTS) -c -o $@ $<
|
2013-07-18 00:26:01 +00:00
|
|
|
|
|
|
|
%.o: %.cpp
|
|
|
|
@$(if $(Q), $(shell echo echo CXX $<),)
|
2016-08-29 05:23:58 +00:00
|
|
|
$(Q)$(CXX) $(CXXFLAGS) $(DEFINES) $(EOPTS) -c -o $@ $<
|
2013-07-18 00:26:01 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f *.o
|
2015-03-06 00:47:09 +00:00
|
|
|
rm -f deps/zlib/*.o
|
2013-07-18 00:26:01 +00:00
|
|
|
rm -f frontend/*.o
|
2014-10-28 18:54:23 +00:00
|
|
|
rm -f menu/*.o
|
|
|
|
rm -f menu/disp/*.o
|
2013-07-18 00:26:01 +00:00
|
|
|
rm -f audio/*.o
|
|
|
|
rm -f compat/*.o
|
|
|
|
rm -f compat/rxml/*.o
|
|
|
|
rm -f conf/*.o
|
|
|
|
rm -f gfx/scaler/*.o
|
|
|
|
rm -f gfx/*.o
|
2014-09-14 04:45:47 +00:00
|
|
|
rm -f gfx/d3d/*.o
|
2015-01-12 21:19:31 +00:00
|
|
|
rm -f gfx/drivers_context/*.o
|
2013-07-18 00:26:01 +00:00
|
|
|
rm -f gfx/math/*.o
|
2015-01-12 22:38:21 +00:00
|
|
|
rm -f gfx/drivers_font/*.o
|
|
|
|
rm -f gfx/drivers_font_renderer/*.o
|
2013-07-18 00:26:01 +00:00
|
|
|
rm -f gfx/py_state/*.o
|
|
|
|
rm -f gfx/rpng/*.o
|
2013-08-28 04:03:25 +00:00
|
|
|
rm -f gfx/glsym/*.o
|
2013-07-18 00:26:01 +00:00
|
|
|
rm -f record/*.o
|
|
|
|
rm -f input/*.o
|
|
|
|
rm -f tools/*.o
|
2015-02-18 23:04:03 +00:00
|
|
|
rm -f libretro-common/*/*.o
|
2013-08-07 22:37:05 +00:00
|
|
|
rm -f $(TARGET)
|
2014-11-18 15:01:36 +00:00
|
|
|
rm -f *.d
|
2013-07-18 00:26:01 +00:00
|
|
|
|
|
|
|
.PHONY: all clean
|