forked from hissorii/px68k
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.libretro
executable file
·159 lines (133 loc) · 3.76 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
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
arch = intel
ifeq ($(shell uname -p),powerpc)
arch = ppc
endif
else ifneq ($(findstring MINGW,$(shell uname -a)),)
system_platform = win
endif
ifeq ($(platform), win)
INCLUDES += -I Windows
endif
TARGET_NAME := px68k
ENDIANNESS_DEFINES :=
CORE_DIR := .
ifeq ($(platform), unix)
CFLAGS = -g -O2
CXXFLAGS = -g -O2 -fno-merge-constants
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
FLAGS += -D__LINUX__
else ifneq (,$(findstring osx,$(platform)))
TARGET := $(TARGET_NAME)_libretro.dylib
fpic = -fPIC
SHARED := -dynamiclib
else ifneq (,$(findstring ios,$(platform)))
TARGET := $(TARGET_NAME)_libretro_ios.dylib
fpic = -fPIC
SHARED := -dynamiclib
ifeq ($(IOSSDK),)
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
endif
DEFINES := -DIOS
CC = cc -arch armv7 -isysroot $(IOSSDK)
CXX = c++ -arch armv7 -isysroot $(IOSSDK)
ifeq ($(platform),ios9)
CC += -miphoneos-version-min=8.0
CXXFLAGS += -miphoneos-version-min=8.0
else
CC += -miphoneos-version-min=5.0
CXXFLAGS += -miphoneos-version-min=5.0
endif
# android arm
else ifneq (,$(findstring android,$(platform)))
TARGET := $(TARGET_NAME)_libretro_android.so
fpic = -fPIC
SHARED := -lstdc++ -llog -shared -Wl,--version-script=link.T -Wl,--no-undefined
CFLAGS += -g -O2
CXXFLAGS = -g -O2 -fno-merge-constants
CC = arm-linux-androideabi-gcc
CXX = arm-linux-androideabi-g++
FLAGS += -D__LINUX__ -DARM -marm
# crosspi arm
else ifneq (,$(findstring crosspi,$(platform)))
CC = arm-linux-gnueabihf-gcc
CXX = arm-linux-gnueabihf-g++
CC_AS = arm-linux-gnueabihf-as
CPU_FLAGS += -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard
CFLAGS += -g -O2
CXXFLAGS += -g -O2 -fno-merge-constants
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
FLAGS += -D__LINUX__ -DARM -marm
# cross Windows
else ifeq ($(platform), wincross64)
TARGET := $(TARGET_NAME)_libretro.dll
AR = x86_64-w64-mingw32-ar
CC = x86_64-w64-mingw32-gcc
CXX = x86_64-w64-mingw32-g++
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
LDFLAGS += -static-libgcc -static-libstdc++
EXTRA_LDF := -lwinmm -Wl,--export-all-symbols
else
TARGET := $(TARGET_NAME)_libretro.dll
CC = gcc
CXX = g++
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
LDFLAGS += -static-libgcc -static-libstdc++
EXTRA_LDF = -lwinmm -Wl,--export-all-symbols
endif
CDEBUGFLAGS+= -DNO_MERCURY
CDEBUGFLAGS+=-DPX68K_VERSION=0.15
FLAGS += $(CDEBUGFLAGS)
include $(CORE_DIR)/Makefile.common
OBJECTS := $(SOURCES_CXX:.cpp=.o) $(SOURCES_C:.c=.o) $(SOURCES_S:.s=.o)
all: $(TARGET)
ifeq ($(DEBUG), 0)
FLAGS += -O3 -ffast-math -fomit-frame-pointer
else
FLAGS += -O0 -g
endif
LDFLAGS += $(fpic) $(SHARED) $(EXTRA_LDF)
FLAGS += $(INCFLAGS)
FLAGS += -DC68K_NO_JUMP_TABLE
WARNINGS :=
FLAGS += -D__LIBRETRO__ $(ENDIANNESS_DEFINES) $(WARNINGS) $(fpic)
CXXFLAGS += $(FLAGS) -fpermissive $(CPU_FLAGS)
CFLAGS += $(FLAGS) -std=gnu99 $(CPU_FLAGS)
ifdef CYCLONE
CFLAGS += -DCYCLONE
CXXFLAGS += -DCYCLONE
endif
$(TARGET): $(OBJECTS)
$(CXX) -o $@ $^ $(LDFLAGS)
%.o: %.cpp
$(CXX) -c -o $@ $< $(CXXFLAGS)
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)
%.o: %.s
$(CXX) $(CFLAGS) -c $^ -o $@
clean:
rm -f $(TARGET) $(OBJECTS)
.PHONY: clean