2012-07-01 17:15:22 +00:00
|
|
|
DEBUG = 0
|
|
|
|
|
|
|
|
ifeq ($(platform),)
|
|
|
|
platform = unix
|
|
|
|
ifeq ($(shell uname -a),)
|
|
|
|
platform = win
|
|
|
|
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
|
|
|
platform = win
|
|
|
|
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
|
|
|
platform = osx
|
|
|
|
else ifneq ($(findstring win,$(shell uname -a)),)
|
|
|
|
platform = win
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
LIBRETRO_DIR := libretro
|
|
|
|
|
|
|
|
ifeq ($(platform), unix)
|
|
|
|
TARGET := libretro.so
|
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -shared -Wl,-version-script=libretro/link.T
|
|
|
|
else ifeq ($(platform), osx)
|
|
|
|
TARGET := libretro.dylib
|
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -dynamiclib
|
|
|
|
else ifeq ($(platform), ps3)
|
|
|
|
TARGET := libretro.a
|
|
|
|
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__
|
|
|
|
else ifeq ($(platform), sncps3)
|
2012-08-11 12:59:39 +00:00
|
|
|
TARGET := libretro_ps3.a
|
2012-07-01 17:15:22 +00:00
|
|
|
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__
|
2012-07-01 17:17:34 +00:00
|
|
|
else ifeq ($(platform), psl1ght)
|
|
|
|
TARGET := libretro_psl1ght.a
|
|
|
|
CC = $(PS3DEV)/ppu/bin/ppu-gcc
|
|
|
|
CXX = $(PS3DEV)/ppu/bin/ppu-g++
|
|
|
|
AR = $(PS3DEV)/ppu/bin/ppu-ar
|
|
|
|
PLATFORM_DEFINES := -D__CELLOS_LV2__
|
2012-07-01 17:15:22 +00:00
|
|
|
else ifeq ($(platform), xenon)
|
2012-08-11 12:59:39 +00:00
|
|
|
TARGET := libretro_xenon360.a
|
2012-07-01 17:15:22 +00:00
|
|
|
CC = xenon-gcc
|
|
|
|
CXX = xenon-g++
|
|
|
|
AR = xenon-ar
|
|
|
|
PLATFORM_DEFINES := -D__LIBXENON__
|
|
|
|
else ifeq ($(platform), wii)
|
2012-08-11 12:59:39 +00:00
|
|
|
TARGET := libretro_wii.a
|
2012-08-12 04:32:45 +00:00
|
|
|
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc
|
|
|
|
CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++
|
|
|
|
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar
|
2012-07-01 17:15:22 +00:00
|
|
|
PLATFORM_DEFINES += -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float
|
|
|
|
else
|
|
|
|
TARGET := retro.dll
|
|
|
|
CC = gcc
|
|
|
|
CXX = g++
|
|
|
|
SHARED := -shared -static-libgcc -static-libstdc++ -Wl,-no-undefined -Wl,-version-script=libretro/link.T
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(DEBUG), 1)
|
|
|
|
CFLAGS += -O0 -g
|
|
|
|
CXXFLAGS += -O0 -g
|
|
|
|
else
|
|
|
|
CFLAGS += -O3
|
|
|
|
CXXFLAGS += -O3 -fno-exceptions -fno-rtti -DHAVE_STDINT_H
|
|
|
|
endif
|
|
|
|
|
|
|
|
RESAMPLER_DIR := ../common/resample/src
|
|
|
|
EMU_DIR := src
|
|
|
|
LIBRETRO_DIR := libretro
|
|
|
|
|
|
|
|
CXXSRCS := $(EMU_DIR)/bitmap_font.cpp $(EMU_DIR)/cpu.cpp $(EMU_DIR)/gambatte.cpp $(EMU_DIR)/initstate.cpp $(EMU_DIR)/interrupter.cpp $(EMU_DIR)/interruptrequester.cpp $(EMU_DIR)/memory.cpp $(EMU_DIR)/sound.cpp $(EMU_DIR)/state_osd_elements.cpp $(EMU_DIR)/statesaver.cpp $(EMU_DIR)/tima.cpp $(EMU_DIR)/video.cpp $(EMU_DIR)/file/file.cpp $(EMU_DIR)/mem/cartridge.cpp $(EMU_DIR)/mem/memptrs.cpp $(EMU_DIR)/mem/rtc.cpp $(EMU_DIR)/sound/channel1.cpp $(EMU_DIR)/sound/channel2.cpp $(EMU_DIR)/sound/channel3.cpp $(EMU_DIR)/sound/channel4.cpp $(EMU_DIR)/sound/duty_unit.cpp $(EMU_DIR)/sound/envelope_unit.cpp $(EMU_DIR)/sound/length_counter.cpp $(EMU_DIR)/video/ly_counter.cpp $(EMU_DIR)/video/lyc_irq.cpp $(EMU_DIR)/video/next_m0_time.cpp $(EMU_DIR)/video/ppu.cpp $(EMU_DIR)/video/sprite_mapper.cpp libretro/libretro.cpp $(RESAMPLER_DIR)/chainresampler.cpp $(RESAMPLER_DIR)/i0.cpp $(RESAMPLER_DIR)/makesinckernel.cpp $(RESAMPLER_DIR)/resamplerinfo.cpp $(RESAMPLER_DIR)/u48div.cpp
|
|
|
|
|
|
|
|
CXXOBJ := $(CXXSRCS:.cpp=.o)
|
|
|
|
|
|
|
|
OBJS := $(CXXOBJ)
|
|
|
|
|
|
|
|
DEFINES := -D__LIBRETRO__ $(PLATFORM_DEFINES) -DHAVE_STDINT_H -DHAVE_INTTYPES_H -DINLINE=inline
|
|
|
|
|
|
|
|
ifeq ($(platform), sncps3)
|
|
|
|
CODE_DEFINES =
|
|
|
|
else
|
|
|
|
CODE_DEFINES = -std=gnu99
|
|
|
|
endif
|
|
|
|
|
|
|
|
CFLAGS += $(CODE_DEFINES) $(fpic) $(DEFINES)
|
|
|
|
CXXFLAGS += $(fpic) $(DEFINES)
|
|
|
|
|
|
|
|
INCDIRS := -I$(EMU_DIR) -Iinclude -I../common -I../common/resample -Ilibretro
|
|
|
|
LIBS :=
|
|
|
|
|
|
|
|
$(TARGET): $(OBJS)
|
|
|
|
ifeq ($(platform), ps3)
|
|
|
|
$(AR) rcs $@ $(OBJS)
|
|
|
|
else ifeq ($(platform), sncps3)
|
|
|
|
$(AR) rcs $@ $(OBJS)
|
2012-07-01 17:17:34 +00:00
|
|
|
else ifeq ($(platform), psl1ght)
|
|
|
|
$(AR) rcs $@ $(OBJS)
|
2012-07-01 17:15:22 +00:00
|
|
|
else ifeq ($(platform), xenon)
|
|
|
|
$(AR) rcs $@ $(OBJS)
|
|
|
|
else ifeq ($(platform), wii)
|
|
|
|
$(AR) rcs $@ $(OBJS)
|
|
|
|
else
|
|
|
|
$(CXX) -o $@ $(SHARED) $(OBJS) $(LDFLAGS) $(LIBS)
|
|
|
|
endif
|
|
|
|
|
|
|
|
%.o: %.cpp
|
|
|
|
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS)
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(OBJS)
|
|
|
|
rm -f $(TARGET)
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
|