forked from Nebuleon/PocketSNES
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
74 lines (57 loc) · 1.77 KB
/
Makefile
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
# Define the applications properties here:
TARGET = PocketSNES
CC := gcc
CXX := g++
STRIP := strip
SYSROOT := $(shell $(CC) --print-sysroot)
SDL_CFLAGS := $(shell $(SYSROOT)/usr/bin/sdl-config --cflags)
SDL_LIBS := $(shell $(SYSROOT)/usr/bin/sdl-config --libs)
ifdef V
CMD:=
SUM:=@\#
else
CMD:=@
SUM:=@echo
endif
INCLUDE = -I pocketsnes \
-I sal/linux/include -I sal/include \
-I pocketsnes/include \
-I menu -I pocketsnes/linux -I pocketsnes/snes9x
CFLAGS = $(INCLUDE) -DRC_OPTIMIZED -D__LINUX__ -D__DINGUX__ -DNO_ROM_BROWSER \
-DGCW_ZERO \
-g -O3 -pipe -ffast-math $(SDL_CFLAGS) \
-flto -fomit-frame-pointer -fexpensive-optimizations -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
LDFLAGS = $(CXXFLAGS) -lpthread -lz -lpng -lm -lgcc $(SDL_LIBS)
# Find all source files
SOURCE = pocketsnes/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)
.PHONY: opk
opk: $(TARGET).opk
$(TARGET) : $(OBJS)
$(SUM) " LD $@"
$(CMD)$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@
$(TARGET).opk: $(TARGET)
$(SUM) " OPK $@"
$(CMD)rm -rf .opk_data
$(CMD)cp -r data .opk_data
$(CMD)cp $< .opk_data/pocketsnes.gcw0
$(CMD)$(STRIP) .opk_data/pocketsnes.gcw0
$(CMD)mksquashfs .opk_data $@ -all-root -noappend -no-exports -no-xattrs -no-progress >/dev/null
%.o: %.c
$(SUM) " CC $@"
$(CMD)$(CC) $(CFLAGS) -c $< -o $@
%.o: %.cpp
$(SUM) " CXX $@"
$(CMD)$(CXX) $(CFLAGS) -c $< -o $@
.PHONY : clean
clean :
$(SUM) " CLEAN ."
$(CMD)rm -f $(OBJS) $(TARGET)
$(CMD)rm -rf .opk_data $(TARGET).opk