More build system work

This commit is contained in:
Ilari Liusvaara 2012-05-12 13:16:27 +03:00
parent d5187c8c85
commit 280d3f8627
9 changed files with 60 additions and 19 deletions

1
.gitignore vendored
View file

@ -9,5 +9,6 @@ rom
lsnes lsnes
*.util *.util
/core /core
/bsnes
src/fonts/font.cpp src/fonts/font.cpp
src/core/version.cpp src/core/version.cpp

View file

@ -6,6 +6,8 @@ include $(OPTIONS)
REALCC = $(CROSS_PREFIX)$(CC) REALCC = $(CROSS_PREFIX)$(CC)
REALLD = $(CROSS_PREFIX)$(LD) REALLD = $(CROSS_PREFIX)$(LD)
BSNES_PATH=$(shell pwd)/bsnes
#Flags. #Flags.
HOSTCCFLAGS = -std=gnu++0x HOSTCCFLAGS = -std=gnu++0x
CFLAGS = -I$(BSNES_PATH) -std=gnu++0x $(USER_CFLAGS) CFLAGS = -I$(BSNES_PATH) -std=gnu++0x $(USER_CFLAGS)
@ -36,7 +38,24 @@ export
all: src/__all_files__ 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 precheck
$(MAKE) -C src $(MAKE) -C src
cp src/lsnes$(DOT_EXECUTABLE_SUFFIX) . cp src/lsnes$(DOT_EXECUTABLE_SUFFIX) .
@ -48,6 +67,7 @@ src/core/version.cpp: buildaux/version.exe forcelook
clean: clean:
$(MAKE) -C bsnes clean
$(MAKE) -C src clean $(MAKE) -C src clean
forcelook: forcelook:

View file

@ -143,6 +143,15 @@ G++ 4.6 (bsnes doesn't seem to like 4.7).
Building Building
\end_layout \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/<version
>')
\end_layout
\begin_layout Itemize \begin_layout Itemize
Edit options.build (or copy of that file) Edit options.build (or copy of that file)
\end_layout \end_layout

View file

@ -38,6 +38,11 @@ lsnes is SNES rerecording emulator based on bsnes core.
3 Building 3 Building
• Copy bsnes sources to subdirectory 'bsnes'
• Patch the bsnes sources with included patches (directory
'bsnes-patches/<version>')
• Edit options.build (or copy of that file) • Edit options.build (or copy of that file)
• Run make (passing 'OPTIONS=<filename>' if using something else • Run make (passing 'OPTIONS=<filename>' if using something else

View file

@ -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= CROSS_PREFIX=
# Postfix for object files # Postfix for object files
OBJECT_SUFFIX=o OBJECT_SUFFIX=o
# Postfix for archive files # Postfix for archive files
OBJECT_SUFFIX=a ARCHIVE_SUFFIX=a
# Postfix (including possible '.') for executable files. # Postfix (including possible '.') for executable files.
# Usually blank for any unix-type system, '.exe' for Windows.
DOT_EXECUTABLE_SUFFIX= DOT_EXECUTABLE_SUFFIX=
# C++ compiler (GCC 4.6) # C++ compiler (GCC 4.6)
# CROSS_PREFIX is prepended. # CROSS_PREFIX is prepended to this.
CC=g++-4.6 CC=g++-4.6
# Linker # Linker for target system.
# CROSS_PREFIX is prepended. # CROSS_PREFIX is prepended to this.
LD=ld LD=ld
# Host C++ compiler # Host system C++ compiler.
HOSTCC=CC # 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. # Host C++ compiler/linker flags.
USER_HOSTCCFLAGS= USER_HOSTCCFLAGS=
@ -79,11 +90,6 @@ JOYSTICK=DUMMY
# Set to non-blank (e.g. 'yes') to enable. # Set to non-blank (e.g. 'yes') to enable.
SECRET_RABBIT_CODE= 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. # Bsnes version used.
# 087 has different layout from the rest. # 087 has different layout from the rest.
BSNES_VERSION=085 BSNES_VERSION=085

View file

@ -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 ifdef SECRET_RABBIT_CODE
AVI_CFLAGS=-DWITH_SECRET_RABBIT_CODE AVI_CFLAGS=-DWITH_SECRET_RABBIT_CODE

View file

@ -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) .PRECIOUS: %.$(OBJECT_SUFFIX)
__all__.o: $(OBJECTS) __all__.$(OBJECT_SUFFIX): $(OBJECTS)
$(REALLD) -r -o $@ $^ $(REALLD) -r -o $@ $^
codec/__all__.o: forcelook codec/__all__.$(OBJECT_SUFFIX): forcelook
$(MAKE) -C codec $(MAKE) -C codec
%.$(OBJECT_SUFFIX): %.cpp %.$(OBJECT_SUFFIX): %.cpp

View file

@ -2,7 +2,7 @@ OBJECTS=$(patsubst %.cpp,%.$(OBJECT_SUFFIX),$(wildcard *.cpp))
.PRECIOUS: %.$(OBJECT_SUFFIX) .PRECIOUS: %.$(OBJECT_SUFFIX)
__all__.o: $(OBJECTS) __all__.$(OBJECT_SUFFIX): $(OBJECTS)
$(REALLD) -r -o $@ $^ $(REALLD) -r -o $@ $^
%.$(OBJECT_SUFFIX): %.cpp %.$(OBJECT_SUFFIX): %.cpp

View file

@ -2,7 +2,7 @@ OBJECTS=$(patsubst %.cpp,%.$(OBJECT_SUFFIX),$(wildcard *.cpp))
.PRECIOUS: %.$(OBJECT_SUFFIX) .PRECIOUS: %.$(OBJECT_SUFFIX)
__all__.o: $(OBJECTS) __all__.$(OBJECT_SUFFIX): $(OBJECTS)
$(REALLD) -r -o $@ $^ $(REALLD) -r -o $@ $^
%.$(OBJECT_SUFFIX): %.cpp %.$(OBJECT_SUFFIX): %.cpp