Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
128 lines (111 sloc) 3.46 KB
DEBUG=0
ifeq ($(platform),)
platform = unix
ifeq ($(shell uname -a),)
platform = win
else ifneq ($(findstring MINGW,$(shell uname -a)),)
platform = win
else ifneq ($(findstring win,$(shell uname -a)),)
platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
platform = osx
endif
endif
ifeq ($(platform), unix)
TARGET := libretro.so
fpic := -fPIC
PLATFORM_DEFINES := -DLOCAL_LE=1 -DLSB_FIRST=1
SHARED := -shared -Wl,--version-script=libretro-fceux/link.T
else ifeq ($(platform), osx)
TARGET := libretro.dylib
fpic := -fPIC
PLATFORM_DEFINES := -DLOCAL_LE=1 -DLSB_FIRST=1
SHARED := -dynamiclib
else ifeq ($(platform), ps3)
TARGET := libretro_ps3.a
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
CXX = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-g++.exe
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
PLATFORM_DEFINES := -D__CELLOS_LV2
CFLAGS += -DHAVE_ASPRINTF
CXXFLAGS += -DHAVE_ASPRINTF
else ifeq ($(platform), sncps3)
TARGET := libretro_ps3.a
CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
CXX = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
PLATFORM_DEFINES := -D__CELLOS_LV2
CFLAGS += -DHAVE_ASPRINTF
CXXFLAGS += -DHAVE_ASPRINTF
else ifeq ($(platform), psl1ght)
TARGET := libretro_psl1ght.a
CC = $(PS3DEV)/ppu/bin/ppu-gcc
CC = $(PS3DEV)/ppu/bin/ppu-g++
AR = $(PS3DEV)/ppu/bin/ppu-ar
PLATFORM_DEFINES := -D__CELLOS_LV2
CFLAGS += -DHAVE_ASPRINTF
CXXFLAGS += -DHAVE_ASPRINTF
else ifeq ($(platform), xenon)
TARGET := libretro_xenon360.a
CC = xenon-gcc
CXX = xenon-g++
AR = xenon-ar
PLATFORM_DEFINES := -D__LIBXENON__
CFLAGS += -DHAVE_ASPRINTF
else ifeq ($(platform), wii)
TARGET := libretro_wii.a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar
PLATFORM_DEFINES := -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float
CFLAGS += -DHAVE_ASPRINTF
CXXFLAGS += -DHAVE_ASPRINTF
else
TARGET := libretro.dll
CC = gcc
CXX = g++
PLATFORM_DEFINES := -DLOCAL_LE=1 -DLSB_FIRST=1
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=libretro-fceux/link.T
endif
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g
CXXFLAGS += -O0 -g
else
CFLAGS += -O3
CXXFLAGS += -O3
endif
LIBRETRO_DIR := ./libretro-fceux
FCEU_DIR := ./src-fceux
UTILS_DIR := ./utils
FCEU_SRC_DIRS := $(LIBRETRO_DIR) $(FCEU_DIR) $(FCEU_DIR)/boards $(FCEU_DIR)/input $(FCEU_DIR)/mappers $(FCEU_DIR)/utils
FCEU_CXXSRCS := $(foreach dir,$(FCEU_SRC_DIRS),$(wildcard $(dir)/*.cpp))
FCEU_CXXOBJ := $(FCEU_CXXSRCS:.cpp=.o)
FCEU_CSRCS := $(foreach dir,$(FCEU_SRC_DIRS),$(wildcard $(dir)/*.c))
FCEU_COBJ := $(FCEU_CSRCS:.c=.o)
OBJS := $(FCEU_COBJ) $(FCEU_CXXOBJ)
FCEU_DEFINES := -D__LIBRETRO__ -DSOUND_QUALITY=0 -DPATH_MAX=1024 -DINLINE=inline -DPSS_STYLE=1 $(PLATFORM_DEFINES)
CFLAGS += -std=gnu99 $(fpic) -Wno-write-strings $(FCEU_DEFINES)
CXXFLAGS += $(fpic) -Wno-write-strings $(FCEU_DEFINES)
LDFLAGS += -Wl,-no-undefined
INCDIRS := -I$(FCEU_DIR)
$(TARGET): $(OBJS)
ifeq ($(platform), ps3)
$(AR) rcs $@ $(OBJS)
else ifeq ($(platform), sncps3)
$(AR) rcs $@ $(OBJS)
else ifeq ($(platform), psl1ght)
$(AR) rcs $@ $(OBJS)
else ifeq ($(platform), xenon)
$(AR) rcs $@ $(OBJS)
else ifeq ($(platform), wii)
$(AR) rcs $@ $(OBJS)
else
$(CXX) -o $@ $(SHARED) $(OBJS) $(LDFLAGS)
endif
%.o: %.cpp
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS)
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS)
clean:
rm -f $(OBJS)
rm -f $(TARGET)
.PHONY: clean
Something went wrong with that request. Please try again.