forked from m45t3r/PocketSNES
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.osx_lib
73 lines (56 loc) · 1.7 KB
/
Makefile.osx_lib
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
# Define the applications properties here:
TARGET = PocketSNES.dylib
CC := $(CROSS_COMPILE)clang
CXX := $(CROSS_COMPILE)clang++
STRIP := $(CROSS_COMPILE)strip
SDL_CFLAGS := `sdl-config --cflags`
SDL_LIBS := `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 \
-I /Library/Frameworks/SDL.framework/headers
CFLAGS = $(INCLUDE) -DRC_OPTIMIZED -D__LINUX__ -D__DINGUX__ \
# -g -O3 -pipe -ffast-math \
$(SDL_CFLAGS) -flto
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti -std=c++0x -stdlib=libc++
LDFLAGS = -dynamiclib $(CXXFLAGS) -lpthread -lz -lpng -lm $(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) $^ -o $@ $(LDFLAGS)
$(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) $(CXXFLAGS) -c $< -o $@
.PHONY : clean
clean :
$(SUM) " CLEAN ."
$(CMD)rm -f $(OBJS) $(TARGET)
$(CMD)rm -rf .opk_data $(TARGET).opk