forked from ps2homebrew/Fceumm-PS2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.libretro
139 lines (122 loc) · 3.87 KB
/
Makefile.libretro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
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
# system platform
system_platform = unix
ifeq ($(shell uname -a),)
EXE_EXT = .exe
system_platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
system_platform = osx
else ifneq ($(findstring MINGW,$(shell uname -a)),)
system_platform = win
endif
ifeq ($(platform), unix)
TARGET := libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--version-script=src/drivers/libretro/link.T -Wl,-no-undefined
ENDIANNESS_DEFINES = -DLSB_FIRST -DLOCAL_LE=1
ZLIB_DIR := ./src/zlib
else ifeq ($(platform), osx)
TARGET := libretro.dylib
fpic := -fPIC
SHARED := -dynamiclib
ENDIANNESS_DEFINES = -DLSB_FIRST -DLOCAL_LE=1
CFLAGS += -DHAVE_ASPRINTF
else ifeq ($(platform), ps3)
TARGET := libretro_ps3.a
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
PLATFORM_DEFINES := -D__CELLOS_LV2
else ifeq ($(platform), sncps3)
TARGET := libretro_ps3.a
CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
PLATFORM_DEFINES := -D__CELLOS_LV2
else ifeq ($(platform), psl1ght)
TARGET := libretro_psl1ght.a
CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
PLATFORM_DEFINES := -D__CELLOS_LV2 -DHAVE_ASPRINTF
else ifeq ($(platform), xenon)
TARGET := libretro_xenon360.a
CC = xenon-gcc$(EXE_EXT)
AR = xenon-ar$(EXE_EXT)
PLATFORM_DEFINES := -D__LIBXENON__
CFLAGS += -DHAVE_ASPRINTF
else ifeq ($(platform), ngc)
TARGET := libretro_ngc.a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
PLATFORM_DEFINES := -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float
CFLAGS += -DHAVE_ASPRINTF
else ifeq ($(platform), wii)
TARGET := libretro_wii.a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
PLATFORM_DEFINES := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float
CFLAGS += -DHAVE_ASPRINTF
else
TARGET := retro.dll
CC = gcc
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=src/drivers/libretro/link.T
ENDIANNESS_DEFINES = -DLSB_FIRST -DLOCAL_LE=1
ZLIB_DIR := ./src/zlib
endif
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g
else
CFLAGS += -O3 -DNDEBUG
endif
LIBRETRO_DIR := ./src/drivers/libretro
FCEU_DIR := ./src
FCEU_SRC_DIRS := $(LIBRETRO_DIR) $(FCEU_DIR) $(FCEU_DIR)/boards $(FCEU_DIR)/input $(FCEU_DIR)/mappers $(ZLIB_DIR)
FCEU_CSRCS := $(foreach dir,$(FCEU_SRC_DIRS),$(wildcard $(dir)/*.c))
FCEU_COBJ := $(FCEU_CSRCS:.c=.o)
OBJS := $(FCEU_COBJ)
FCEU_DEFINES := -D__LIBRETRO__ -DSOUND_QUALITY=0 -DPATH_MAX=1024 -DINLINE=inline -DPSS_STYLE=1 -DFCEU_VERSION_NUMERIC=9813 $(PLATFORM_DEFINES)
ifeq ($(platform), sncps3)
CODE_DEFINES =
WARNING_DEFINES =
else
CODE_DEFINES = -std=gnu99
WARNING_DEFINES = -Wno-write-strings
endif
CFLAGS += $(CODE_DEFINES) $(fpic) $(WARNING_DEFINES) $(FCEU_DEFINES) $(ENDIANNESS_DEFINES)
LDFLAGS += -lm
INCDIRS := -I$(LIBRETRO_DIR) -I$(FCEU_DIR) -I$(FCEU_DIR)/input -I$(FCEU_DIR)/boards -I$(FCEU_DIR)/mappers
LIBS :=
$(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), ngc)
$(AR) rcs $@ $(OBJS)
else ifeq ($(platform), wii)
$(AR) rcs $@ $(OBJS)
else
$(CC) -o $@ $(SHARED) $(OBJS) $(CFLAGS) $(LDFLAGS) $(LIBS)
endif
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS)
clean-objs:
rm -f $(OBJS)
clean:
rm -f $(OBJS)
rm -f $(TARGET)
.PHONY: clean clean-objs