forked from Nebuleon/PocketSNES
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathMakefile.gcw0
75 lines (58 loc) · 2.17 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
#
# PocketSNES for the RetroFW
#
# by pingflood; 2019
#
# Define the applications properties here:
TARGET = pocketsnes/pocketsnes.elf
CHAINPREFIX := /opt/gcw0-toolchain
CROSS_COMPILE := $(CHAINPREFIX)/usr/bin/mipsel-linux-
CC := $(CROSS_COMPILE)gcc
CXX := $(CROSS_COMPILE)g++
STRIP := $(CROSS_COMPILE)strip
SYSROOT := $(shell $(CC) --print-sysroot)
SDL_CFLAGS := $(shell $(SYSROOT)/usr/bin/sdl-config --cflags)
SDL_LIBS := $(shell $(SYSROOT)/usr/bin/sdl-config --libs)
INCLUDE = -I src \
-I sal/linux/include -I sal/include \
-I src/include \
-I menu -I src/linux -I src/snes9x
CFLAGS = --std=gnu11 $(INCLUDE) -DRC_OPTIMIZED -DGCW_ZERO -D__LINUX__ -D__DINGUX__ -DFOREVER_16_BIT $(SDL_CFLAGS)
# CFLAGS = --std=gnu11 $(INCLUDE) -DRC_OPTIMIZED -D__LINUX__ -D__DINGUX__ $(SDL_CFLAGS)
CFLAGS += -O3 -fdata-sections -ffunction-sections -mips32 -march=mips32 -mno-mips16 -fomit-frame-pointer -fno-builtin
CFLAGS += -fno-common -Wno-write-strings -Wno-sign-compare -ffast-math -ftree-vectorize
CFLAGS += -funswitch-loops -fno-strict-aliasing
CFLAGS += -DMIPS_XBURST -DFAST_LSB_WORD_ACCESS
CFLAGS += -fprofile-use -fprofile-dir=./profile
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti -fno-math-errno -fno-threadsafe-statics
LDFLAGS = $(CXXFLAGS) -lpthread -lz -lpng $(SDL_LIBS) -Wl,--as-needed -Wl,--gc-sections -s
# Find all source files
SOURCE = src/snes9x menu sal/linux sal
SRC_CPP = $(foreach dir, $(SOURCE), $(wildcard $(dir)/*.cpp))
SRC_C = $(foreach dir, $(SOURCE), $(wildcard $(dir)/*.c))
OBJ_CPP = $(patsubst %.cpp, %.o, $(SRC_CPP))
OBJ_C = $(patsubst %.c, %.o, $(SRC_C))
OBJS = $(OBJ_CPP) $(OBJ_C)
.PHONY : all
all : $(TARGET)
$(TARGET) : $(OBJS)
$(CMD)$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@
%.o: %.c
$(CMD)$(CC) $(CFLAGS) -c $< -o $@
%.o: %.cpp
$(CMD)$(CXX) $(CFLAGS) -c $< -o $@
.PHONY : clean
opk: all
mksquashfs \
pocketsnes/default.gcw0.desktop \
pocketsnes/default.retrofw.desktop \
pocketsnes/snes.retrofw.desktop \
pocketsnes/pocketsnes.elf \
pocketsnes/pocketsnes.dge \
pocketsnes/pocketsnes.man.txt \
pocketsnes/pocketsnes.png \
pocketsnes/backdrop.png \
pocketsnes/pocketsnes.opk \
-all-root -noappend -no-exports -no-xattrs
clean :
$(CMD)rm -f $(OBJS)