2 EXECUTABLE_SUFFIX
= exe
5 FONT_SRC
:= unifontfull-5.1
.20080820.hex
9 REALCC
= $(CROSS_PREFIX
)$(CC
)
12 HOSTCCFLAGS
= -std
=gnu
++0x
13 CFLAGS
= -I
$(BSNES_PATH
) -Iinclude
-Iavi
-std
=gnu
++0x
14 LDFLAGS
= -lboost_iostreams
-lboost_filesystem
-lboost_system
-lz
23 #Core objects and what to build.
24 CORE_OBJECTS
= $(patsubst %.
cpp,%.
$(OBJECT_SUFFIX
),$(wildcard src
/core
/*.
cpp)) \
25 $(patsubst %.
cpp,%.
$(OBJECT_SUFFIX
),$(wildcard avi
/*.
cpp)) \
26 src
/fonts
/font.
$(OBJECT_SUFFIX
)
27 PROGRAMS
= lsnes.
$(EXECUTABLE_SUFFIX
) movieinfo.
$(EXECUTABLE_SUFFIX
) lsnes-dumpavi.
$(EXECUTABLE_SUFFIX
) sdmp2sox.
$(EXECUTABLE_SUFFIX
)
37 CORE_OBJECTS
+= $(patsubst %.
cpp,%.
$(OBJECT_SUFFIX
),$(wildcard src
/lua
/*.
cpp))
38 CFLAGS
+= $(shell $(CROSS_PREFIX
)pkg-config
$(LUA
) --cflags)
39 LDFLAGS
+= $(shell $(CROSS_PREFIX
)pkg-config
$(LUA
) --libs
)
44 ifeq ($(THREADS
), YES
)
45 CFLAGS
+= -DUSE_THREADS
48 CFLAGS
+= -DNO_THREADS
50 $(error
"Bad value for THREADS (expected YES or NO)")
58 CFLAGS
+= -DBSNES_IS_COMPAT
62 ifeq ($(JOYSTICK
), SDL
)
63 ifneq ($(GRAPHICS
), SDL
)
64 $(error
"SDL Joystick requires SDL graphics")
66 PLATFORM_OBJECTS
+= src
/plat-sdl
/joystick.
$(OBJECT_SUFFIX
)
68 ifeq ($(JOYSTICK
), DUMMY
)
69 CFLAGS
+= -DSDL_NO_JOYSTICK
70 PLATFORM_OBJECTS
+= src
/plat-dummy
/joystick.
$(OBJECT_SUFFIX
)
72 ifeq ($(JOYSTICK
), EVDEV
)
73 CFLAGS
+= -DSDL_NO_JOYSTICK
74 PLATFORM_OBJECTS
+= $(patsubst %.
cpp,%.
$(OBJECT_SUFFIX
),$(wildcard src
/plat-evdev
/*.
cpp))
76 $(error
"Unsupported joystick type")
83 ifneq ($(GRAPHICS
), SDL
)
84 $(error
"SDL Sound requires SDL graphics")
86 PLATFORM_OBJECTS
+= src
/plat-sdl
/sound.
$(OBJECT_SUFFIX
)
88 ifeq ($(SOUND
), PORTAUDIO
)
89 PLATFORM_OBJECTS
+= src
/plat-portaudio
/sound.
$(OBJECT_SUFFIX
)
90 PLATFORM_CFLAGS
+= $(shell $(CROSS_PREFIX
)pkg-config portaudio-2.0
--cflags)
91 PLATFORM_LDFLAGS
+= $(shell $(CROSS_PREFIX
)pkg-config portaudio-2.0
--libs
)
93 ifeq ($(SOUND
), DUMMY
)
94 PLATFORM_OBJECTS
+= src
/plat-dummy
/sound.
$(OBJECT_SUFFIX
)
96 $(error
"Unsupported sound type")
102 ifeq ($(GRAPHICS
), SDL
)
103 PLATFORM_OBJECTS
+= src
/plat-sdl
/main.
$(OBJECT_SUFFIX
) src
/plat-sdl
/graphics.
$(OBJECT_SUFFIX
) src
/plat-sdl
/paint.
$(OBJECT_SUFFIX
)
104 PLATFORM_CFLAGS
+= $(shell $(CROSS_PREFIX
)sdl-config
--cflags)
105 PLATFORM_LDFLAGS
+= $(shell $(CROSS_PREFIX
)sdl-config
--libs
)
107 ifeq ($(GRAPHICS
), WXWIDGETS
)
108 PLATFORM_OBJECTS
+= $(patsubst %.
cpp,%.
$(OBJECT_SUFFIX
),$(wildcard src
/plat-wxwidgets
/*.
cpp))
109 PLATFORM_CFLAGS
+= $(shell $(CROSS_PREFIX
)wx-config
--cxxflags) $(shell $(CROSS_PREFIX
)pkg-config libswscale
--cflags)
110 PLATFORM_LDFLAGS
+= $(shell $(CROSS_PREFIX
)wx-config
--libs
) $(shell $(CROSS_PREFIX
)pkg-config libswscale
--libs
)
112 $(error
"Unsupported graphics type")
116 CORE_CFLAGS
=$(CFLAGS
) $(USER_CFLAGS
)
117 SUPPORT_CFLAGS
=$(CORE_CFLAGS
) $(PLATFORM_CFLAGS
) $(USER_PLATFORM_CFLAGS
)
118 CORE_LDFLAGS
=$(BSNES_PATH
)/out
/libsnes.
$(ARCHIVE_SUFFIX
) $(LDFLAGS
) $(USER_LDFLAGS
)
119 SUPPORT_LDFLAGS
=$(CORE_LDFLAGS
) $(PLATFORM_LDFLAGS
) $(USER_PLATFORM_LDFLAGS
)
120 PLAT_DUMMY_OBJECTS
=$(patsubst %.
cpp,%.
$(OBJECT_SUFFIX
),$(wildcard src
/plat-dummy
/*.
cpp))
121 HOST_CFLAGS
=$(HOSTCCFLAGS
) $(USER_HOSTCCFLAGS
)
122 HOST_LDFLAGS
=$(HOSTLDFLAGS
) $(USER_HOSTLDFLAGS
)
126 #Stuff compiled with core CFLAGS.
127 avi
/%.
$(OBJECT_SUFFIX
): avi
/%.
cpp
128 $(REALCC
) -c
-o
$@
$< $(CORE_CFLAGS
)
129 src
/core
/%.
$(OBJECT_SUFFIX
): src
/core
/%.
cpp
130 $(REALCC
) -c
-o
$@
$< $(CORE_CFLAGS
)
131 src
/lua
/%.
$(OBJECT_SUFFIX
): src
/lua
/%.
cpp
132 $(REALCC
) -c
-o
$@
$< $(CORE_CFLAGS
)
133 src
/plat-dummy
/%.
$(OBJECT_SUFFIX
): src
/plat-dummy
/%.
cpp
134 $(REALCC
) -c
-o
$@
$< $(CORE_CFLAGS
)
135 src
/util
/%.
$(OBJECT_SUFFIX
): src
/util
/%.
cpp
136 $(REALCC
) -c
-o
$@
$< $(CORE_CFLAGS
)
138 #Platform stuff to be compiled with support CFLAGS.
139 src
/plat-evdev
/%.
$(OBJECT_SUFFIX
): src
/plat-evdev
/%.
cpp
140 $(REALCC
) -c
-o
$@
$< $(SUPPORT_CFLAGS
)
141 src
/plat-portaudio
/%.
$(OBJECT_SUFFIX
): src
/plat-portaudio
/%.
cpp
142 $(REALCC
) -c
-o
$@
$< $(SUPPORT_CFLAGS
)
143 src
/plat-sdl
/%.
$(OBJECT_SUFFIX
): src
/plat-sdl
/%.
cpp
144 $(REALCC
) -c
-o
$@
$< $(SUPPORT_CFLAGS
)
145 src
/plat-wxwidgets
/%.
$(OBJECT_SUFFIX
): src
/plat-wxwidgets
/%.
cpp
146 $(REALCC
) -c
-o
$@
$< $(SUPPORT_CFLAGS
)
148 #lsnes main executable.
149 lsnes.
$(EXECUTABLE_SUFFIX
): $(CORE_OBJECTS
) $(PLATFORM_OBJECTS
)
150 $(REALCC
) -o
$@
$^
$(SUPPORT_LDFLAGS
)
153 %.
$(EXECUTABLE_SUFFIX
): src
/util
/%.
$(OBJECT_SUFFIX
) $(CORE_OBJECTS
) $(PLAT_DUMMY_OBJECTS
)
154 $(REALCC
) -o
$@
$^
$(CORE_LDFLAGS
)
157 src
/fonts
/font.
$(OBJECT_SUFFIX
): src
/fonts
/$(FONT_SRC
)
158 echo
"extern const char* font_hex_data = " >src
/fonts
/font.
cpp
159 sed
-E
-f src
/fonts
/fonttransform.sed
<$^
>>src
/fonts
/font.
cpp
160 echo
";" >>src
/fonts
/font.
cpp
161 $(REALCC
) $(CORE_CFLAGS
) -c
-o
$@ src
/fonts
/font.
cpp
164 rm -f
$(PROGRAMS
) src
/*.
$(OBJECT_SUFFIX
) src
/*/*.
$(OBJECT_SUFFIX
) avi
/*.
$(OBJECT_SUFFIX
) src
/fonts
/font.o src
/fonts
/font.
cpp