diff --git a/.gitignore b/.gitignore index 48ce6d22..874e1c61 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,6 @@ rom lsnes *.util /core +/bsnes src/fonts/font.cpp src/core/version.cpp diff --git a/Makefile b/Makefile index 7b83b196..1223e912 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,8 @@ include $(OPTIONS) REALCC = $(CROSS_PREFIX)$(CC) REALLD = $(CROSS_PREFIX)$(LD) +BSNES_PATH=$(shell pwd)/bsnes + #Flags. HOSTCCFLAGS = -std=gnu++0x CFLAGS = -I$(BSNES_PATH) -std=gnu++0x $(USER_CFLAGS) @@ -36,7 +38,24 @@ export all: src/__all_files__ -src/__all_files__: src/core/version.cpp forcelook +ifeq ($(BSNES_VERSION), 087) +BSNES_TARGET_STRING=target=libsnes +else +BSNES_TARGET_STRING=ui=ui-libsnes +endif + +ifdef BSNES_IS_COMPAT +BSNES_PROFILE_STRING=profile=compatibility +else +BSNES_PROFILE_STRING=profile=accuracy +endif + +bsnes_compiler=$(subst ++,cc,$(REALCC)) + +bsnes/out/libsnes.$(ARCHIVE_SUFFIX): bsnes/snes/snes.hpp + $(MAKE) -C bsnes OPTIONS=debugger $(BSNES_PROFILE_STRING) $(BSNES_TARGET_STRING) compiler=$(bsnes_compiler) + +src/__all_files__: src/core/version.cpp forcelook bsnes/out/libsnes.$(ARCHIVE_SUFFIX) $(MAKE) -C src precheck $(MAKE) -C src cp src/lsnes$(DOT_EXECUTABLE_SUFFIX) . @@ -48,6 +67,7 @@ src/core/version.cpp: buildaux/version.exe forcelook clean: + $(MAKE) -C bsnes clean $(MAKE) -C src clean forcelook: diff --git a/manual.lyx b/manual.lyx index 6908ae37..6c343241 100644 --- a/manual.lyx +++ b/manual.lyx @@ -143,6 +143,15 @@ G++ 4.6 (bsnes doesn't seem to like 4.7). Building \end_layout +\begin_layout Itemize +Copy bsnes sources to subdirectory 'bsnes' +\end_layout + +\begin_layout Itemize +Patch the bsnes sources with included patches (directory 'bsnes-patches/') +\end_layout + \begin_layout Itemize Edit options.build (or copy of that file) \end_layout diff --git a/manual.txt b/manual.txt index 0b20b6b8..dbe64a2c 100644 --- a/manual.txt +++ b/manual.txt @@ -38,6 +38,11 @@ lsnes is SNES rerecording emulator based on bsnes core. 3 Building +• Copy bsnes sources to subdirectory 'bsnes' + +• Patch the bsnes sources with included patches (directory + 'bsnes-patches/') + • Edit options.build (or copy of that file) • Run make (passing 'OPTIONS=' if using something else diff --git a/options.build b/options.build index 9845dcda..787b6e63 100644 --- a/options.build +++ b/options.build @@ -1,25 +1,36 @@ -# Prefix to apply to commands for building stuff for target architecture. +# +# Target system: +# - The system the built lsnes will run on. +# Host system: +# - The system lsnes is being built on. +# + + +# Prefix to apply to compiler commands for the target system. CROSS_PREFIX= # Postfix for object files OBJECT_SUFFIX=o # Postfix for archive files -OBJECT_SUFFIX=a +ARCHIVE_SUFFIX=a # Postfix (including possible '.') for executable files. +# Usually blank for any unix-type system, '.exe' for Windows. DOT_EXECUTABLE_SUFFIX= # C++ compiler (GCC 4.6) -# CROSS_PREFIX is prepended. +# CROSS_PREFIX is prepended to this. CC=g++-4.6 -# Linker -# CROSS_PREFIX is prepended. +# Linker for target system. +# CROSS_PREFIX is prepended to this. LD=ld -# Host C++ compiler -HOSTCC=CC +# Host system C++ compiler. +# If not crosscompiling, build host system and target system are one and the same. +# $(CC) means the same compiler as main C++ compiler to use (but without prefix). Otherwise, set to host C++ compiler. +HOSTCC=$(CC) # Host C++ compiler/linker flags. USER_HOSTCCFLAGS= @@ -79,11 +90,6 @@ JOYSTICK=DUMMY # Set to non-blank (e.g. 'yes') to enable. SECRET_RABBIT_CODE= -# Path to bsnes for includes/library. -# Edit this to whatever is appropriate (it needs to point to the bsnes directory that was alongside other top-level -# bsnes directories, but those directories themselves are not needed). -BSNES_PATH=bsnes/bsnes - # Bsnes version used. # 087 has different layout from the rest. BSNES_VERSION=085 diff --git a/src/video/Makefile b/src/video/Makefile index b1d13c2a..5f45b6c9 100644 --- a/src/video/Makefile +++ b/src/video/Makefile @@ -1,4 +1,4 @@ -OBJECTS=$(patsubst %.cpp,%.$(OBJECT_SUFFIX),$(wildcard *.cpp)) avi/__all__.o +OBJECTS=$(patsubst %.cpp,%.$(OBJECT_SUFFIX),$(wildcard *.cpp)) avi/__all__.$(OBJECT_SUFFIX) ifdef SECRET_RABBIT_CODE AVI_CFLAGS=-DWITH_SECRET_RABBIT_CODE diff --git a/src/video/avi/Makefile b/src/video/avi/Makefile index 5cb6b457..8f148aa6 100644 --- a/src/video/avi/Makefile +++ b/src/video/avi/Makefile @@ -1,11 +1,11 @@ -OBJECTS=$(patsubst %.cpp,%.$(OBJECT_SUFFIX),$(wildcard *.cpp)) codec/__all__.o +OBJECTS=$(patsubst %.cpp,%.$(OBJECT_SUFFIX),$(wildcard *.cpp)) codec/__all__.$(OBJECT_SUFFIX) .PRECIOUS: %.$(OBJECT_SUFFIX) -__all__.o: $(OBJECTS) +__all__.$(OBJECT_SUFFIX): $(OBJECTS) $(REALLD) -r -o $@ $^ -codec/__all__.o: forcelook +codec/__all__.$(OBJECT_SUFFIX): forcelook $(MAKE) -C codec %.$(OBJECT_SUFFIX): %.cpp diff --git a/src/video/avi/codec/audio/Makefile b/src/video/avi/codec/audio/Makefile index 3a34de28..34b0230c 100644 --- a/src/video/avi/codec/audio/Makefile +++ b/src/video/avi/codec/audio/Makefile @@ -2,7 +2,7 @@ OBJECTS=$(patsubst %.cpp,%.$(OBJECT_SUFFIX),$(wildcard *.cpp)) .PRECIOUS: %.$(OBJECT_SUFFIX) -__all__.o: $(OBJECTS) +__all__.$(OBJECT_SUFFIX): $(OBJECTS) $(REALLD) -r -o $@ $^ %.$(OBJECT_SUFFIX): %.cpp diff --git a/src/video/avi/codec/video/Makefile b/src/video/avi/codec/video/Makefile index 3a34de28..34b0230c 100644 --- a/src/video/avi/codec/video/Makefile +++ b/src/video/avi/codec/video/Makefile @@ -2,7 +2,7 @@ OBJECTS=$(patsubst %.cpp,%.$(OBJECT_SUFFIX),$(wildcard *.cpp)) .PRECIOUS: %.$(OBJECT_SUFFIX) -__all__.o: $(OBJECTS) +__all__.$(OBJECT_SUFFIX): $(OBJECTS) $(REALLD) -r -o $@ $^ %.$(OBJECT_SUFFIX): %.cpp