Files
libretro-puzzlescript/Makefile.common
T

57 lines
1.5 KiB
Makefile

SRC_DIR = $(CORE_DIR)/src
LIBRETRO_DIR = $(SRC_DIR)/libretro
QUICKJS_SRC_DIR = $(SRC_DIR)/quickjs-ng
INCFLAGS := \
-I$(SRC_DIR) \
-I$(LIBRETRO_DIR)/include \
-I$(QUICKJS_SRC_DIR)
ifneq (,$(findstring msvc2003,$(platform)))
INCFLAGS += -I$(LIBRETRO_DIR)/include/compat/msvc
endif
COREDEFINES = \
-D__LIBRETRO__
SOURCES_CXX := $(foreach dir,$(SRC_DIR),$(wildcard $(dir)/*.cpp))
CXXFLAGS += -DUSE_PRECOMPILED_BUNDLE
SOURCES_C += \
$(QUICKJS_SRC_DIR)/quickjs.c \
$(QUICKJS_SRC_DIR)/libbf.c \
$(QUICKJS_SRC_DIR)/libregexp.c \
$(QUICKJS_SRC_DIR)/libunicode.c \
$(QUICKJS_SRC_DIR)/cutils.c
CFLAGS += -D_GNU_SOURCE -DCONFIG_VERSION=\"2024-01-13\"
# Add pthread to everything but msvc
ifeq (,$(findstring msvc,$(platform)))
CXXFLAGS += -lpthread
CFLAGS += -lpthread
LDFLAGS += -lpthread -ldl
endif
# QuickJS-ng needs pthreads and 64-bit atomics for JS Atomics, which these
# platforms lack. EMSCRIPTEN is its only switch to build without them.
ifneq (,$(filter $(platform), ngc wii wiiu ctr psp1 ps2 gcw0 retrofw miyoo))
CFLAGS += -DEMSCRIPTEN
endif
# int32_t is long on these platforms, and QuickJS-ng passes int* in places
ifneq (,$(filter $(platform), psp1 ps2 ctr))
CFLAGS += -Wno-incompatible-pointer-types
endif
# No std::thread or std::mutex, so run the game loop on the main thread
ifneq (,$(filter $(platform), ctr))
CFLAGS += -DPZ_NO_THREADS
CXXFLAGS += -DPZ_NO_THREADS
endif
# uClibc does not provide malloc_usable_size()
ifneq (,$(filter $(platform), gcw0 retrofw miyoo))
SOURCES_C += $(SRC_DIR)/malloc_usable_size.c
endif