Build process - aalesv/2boost GitHub Wiki
Project builds with make
command. make
ships with GNUSH tools but you can use GNU make that comes with your system.
Type make
or make help
to see brief help:
make all - Build all CAL IDs. Specify DOPATCH=-yes to patch your ROM. make analyze - Do static analysis with PVS-Studio, must be installed. Specify CALID=CALID. make analyze-clean - Delete files needed for static analysis make CALID - Specify CALID to build only that target, for example 'make A8DK100P' will build files only for A8DK100P. Specify DOPATCH=-yes to patch your ROM. make clean - Clean build directory. make help - This message. make list - List for possible CAL IDs. make tests - Test build for emulator testing only. Specify CALID=CALID for building CALID or CALID=all for build all ROMs.
To override any var including target specific vars set in Makefile
set the var in command line, like
make YOUR-CAL-ID WINDOWS=1
make
determines if it runs on Windows by examining OS
shell variable. Then it sets internal variables. List of all possible CAL Ids to build is based on include\target\*.h
file list. If CAL Id specified i.e. make A2WC420F
, it builds only for that CAL Id. If all
specified i.e. make all
it builds for every CAL Id.
make tests
defines debug symbol and then builds.
During build, all intermediate files are placed into build directory.
Symbols, variables and other settings specific to each Cal Id, contain in corresponding header file include\target\*.h
. This header is included in every source file by -include
GCC parameter at compile time (that's why unused static constants may appear). All src\*.c
files compile and then link into one file named 2Boost-CALID.out
aligned at entry point. Entry point takes from corresponding include\target\CALID.txt
file.
Then all unneeded strips and file converts to true binary named CALID.bin
ready to patch.
Original ROM file copies from ROM
directory (can be changed by setting orig-rom
variable) to build directory and renames to CALID-patched.bin
.
By default, no patching is done and this is indicated by word 'simulating' in command output:
Patching ROM... copy .\ROM\A2WC420F.bin .\build\A2WC420F-patched.bin Files copied: 1. sfkx64 -verbose partcopy .\build\2Boost-A2WC420F.bin -allfrom 0 .\build\A2WC420F-patched.bin 0x0007C000 mapping copy length : 6780 = 6780 - 0 [simulating:] copying 6780 bytes, from input offset 0 to 6780, to target offset 507904 [add -yes to really copy data.]
To patch ROM set DOPATCH=-yes
. Example:
make YOUR-CAL-ID DOPATCH=-yes
Optimization (2Boost ver 3 and later)
Optimization enabled on globally by adding -O
flag in CFLAGS
variable. This is done to optimize out unused static constants,
but this has side effect of reordering variables and functions.
To eliminate this, top level reorder disabled globally by adding -fno-toplevel-reorder
compiler option to CFLAGS
variable
as only few CALIDs have unused static constants. CAL Ids list that have unused static constatnts is contained in TOP_LEVEL_REORDER_TARGET_LIST
Makefile variable and is compiled with -ftoplevel-reorder
compiler option.
Useful variables
BIN
Path to GNUSH tools dir. Override it when path is incorrectly detected. Setting WINDOWS
variable may also help.
CALID
What CAL ID to build. Needed only when you build analyze
and tests
targets. Example:
make tests CALID=A2WC420F
DOPATCH
Controls if ROM will be actually patched. Empty by default, so no patching is done by default. This var passed to sfk
command. To patch ROM set it to -yes
:
make A2WC420F DOPATCH=-yes
orig-rom
Path to ROM that will be copied to build dir and patched. If you whant to use ROM that is not located in .\ROM
dir, set this variable:
make A2WC420F orig-rom=C:\temp\read-image.bin
Do not set orig-rom
when building all targets.
TOP_LEVEL_REORDER_TARGET_LIST
CAL Ids list that will be compiled with -ftoplevel-reorder
compiler option.
USERCFLAGS
User specified compiler flags. Empty by default. Useful to define symbols without modifying code. Example:
make analyze CALID=A2WC420F USERCFLAGS=-DBUILD_TESTS
WINDOWS
Indicates that this is Windows system or not. Equals 1
if Windows, all other values including empty if non-Windows (assuming *nix). Autodetected, but can be overridden. This is useful for environments like Cygwin where OS can not be correctly detected.
Symbols that affect programm behavior
BUILD_TESTS
When BUILD_TESTS
symbol is defined, tests are compiled. Define it if you want analyze your tests when running make analyze
command:
make analyze CALID=YOUR-CAL-ID USERCFLAGS=-DBUILD_TESTS
If you run make tests
, this symbol is defined automatically.