forked from dmitrysmagin/snes9x4d-rzx50
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile.gcw0
95 lines (72 loc) · 2.02 KB
/
Makefile.gcw0
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
UNZIP = 1
C4_OLD = 0
SRTC = 0
CHEATS = 0
SDLMENU = 1
SETA_DSP = 0
SNAPSHOT_OLD = 0
SPC7110 = 0
include Makefile.common
PREFIX = mipsel-linux
CXX = $(PREFIX)-g++
CC = $(PREFIX)-gcc
STRIP = $(PREFIX)-strip
AS = $(PREFIX)-as
SYSROOT := $(shell $(CC) --print-sysroot)
SDL_CFLAGS := $(shell $(SYSROOT)/usr/bin/sdl-config --cflags)
SDL_LIBS := $(shell $(SYSROOT)/usr/bin/sdl-config --libs)
LDFLAGS = -lz -lm $(SDL_LIBS) -Wl,--as-needed -Wl,--gc-sections -s
OFLAGS = -Ofast -fomit-frame-pointer -mips32r2 \
-fdata-sections -ffunction-sections \
-fno-stack-protector -fomit-frame-pointer \
-fno-strict-aliasing \
-Wall
ifeq ($(PGO), GENERATE)
OFLAGS += -fprofile-generate -fprofile-dir=/media/data/local/home/profile/snes9x4d
LDFLAGS += -lgcov
else ifeq ($(PGO), APPLY)
OFLAGS += -fprofile-use -fprofile-dir=./profile -fbranch-probabilities -fno-unroll-loops
else ifeq ($(PGO), FORCE-APPLY)
OFLAGS += -fprofile-use -fprofile-dir=./profile -fbranch-probabilities -Wno-error=coverage-mismatch
else
OFLAGS += -falign-functions=1 -falign-jumps=1 -falign-loops=1 \
-fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops \
-fmerge-all-constants
endif
CCFLAGS += $(OFLAGS) \
-DBILINEAR_SCALE \
-DFAST_ALIGNED_LSB_WORD_ACCESS \
-DFOREVER_16_BIT \
-DFOREVER_16_BIT_SOUND \
-DLAGFIX \
-DGCW0 \
-DVIDEO_MODE=1 \
-DZLIB \
CXXFLAGS = --std=gnu++14 $(CCFLAGS) \
-fno-exceptions -fno-rtti -fno-threadsafe-statics
CFLAGS = --std=gnu11 $(CCFLAGS)
.SUFFIXES: .o .cpp .c .cc .h .m .i .S .asm .obj
.PHONY: format
all: snes9x4d
opk: snes9x4d
opk/make_opk.sh
format:
find . -regex '.*\.\(c\|h\|cpp\|hpp\|cc\|cxx\)' -exec clang-format -style=file -i {} \;
snes9x4d: $(OBJECTS)
$(CXX) -o $@ $(OBJECTS) $(LDFLAGS)
$(STRIP) $@
.cpp.o:
$(CXX) -c $(CXXFLAGS) $*.cpp -o $@
.c.o:
$(CC) -c $(CFLAGS) $*.c -o $@
.cpp.S:
$(CXX) -S $(CXXFLAGS) $*.cpp -o $@
.cpp.i:
$(CXX) -E $(CXXFLAGS) $*.cpp -o $@
.S.o:
$(CXX) -c $(CXXFLAGS) $*.S -o $@
.S.i:
$(CXX) -c -E $(CXXFLAGS) $*.S -o $@
clean:
rm -f $(OBJECTS)
release: clean all