mirror of https://github.com/n64decomp/mk64.git
Shiftability fix and documentation (#723)
* Shiftability fix and documentation * Allow setting `AVOID_UB=1` directly while building * Set `AVOID_UB` when building with DEBUG. * Document options for enabling shiftability * Document `make clean` * Delete HTML file * Update compiling.md --------- Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
This commit is contained in:
parent
3288752b47
commit
184f5939f2
8
Makefile
8
Makefile
|
@ -32,6 +32,9 @@ $(eval $(call validate-option,COMPILER,ido gcc))
|
||||||
# Run make clean first
|
# Run make clean first
|
||||||
DEBUG ?= 0
|
DEBUG ?= 0
|
||||||
|
|
||||||
|
# Avoid undefined behavior. Enables shiftability when making changes
|
||||||
|
AVOID_UB ?= 0
|
||||||
|
|
||||||
# Compile with GCC
|
# Compile with GCC
|
||||||
GCC ?= 0
|
GCC ?= 0
|
||||||
|
|
||||||
|
@ -55,9 +58,14 @@ endif
|
||||||
|
|
||||||
ifeq ($(DEBUG),1)
|
ifeq ($(DEBUG),1)
|
||||||
DEFINES += DEBUG=1
|
DEFINES += DEBUG=1
|
||||||
|
DEFINES += AVOID_UB=1
|
||||||
COMPARE ?= 0
|
COMPARE ?= 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(AVOID_UB),1)
|
||||||
|
DEFINES += AVOID_UB=1
|
||||||
|
endif
|
||||||
|
|
||||||
TARGET := mk64.$(VERSION)
|
TARGET := mk64.$(VERSION)
|
||||||
|
|
||||||
BASEROM := baserom.$(VERSION).z64
|
BASEROM := baserom.$(VERSION).z64
|
||||||
|
|
|
@ -105,3 +105,25 @@ First-diff/diff commands for EU
|
||||||
python3 first-diff.py --eu
|
python3 first-diff.py --eu
|
||||||
./diff <function> -eu
|
./diff <function> -eu
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Handling Changes
|
||||||
|
Certain changes may result in unexpected behaviour (frequently related to physics) due to the games obnoxious linker setup. This is resolved by compiling with the AVOID_UB flag.
|
||||||
|
|
||||||
|
This will require a rebuild, run
|
||||||
|
```bash
|
||||||
|
make clean
|
||||||
|
```
|
||||||
|
|
||||||
|
Then compile like so
|
||||||
|
``
|
||||||
|
make -j AVOID_UB=1
|
||||||
|
or
|
||||||
|
make -j DEBUG=1 // Enables debug mode and avoid_ub
|
||||||
|
``
|
||||||
|
|
||||||
|
Recompiling `.inc.c` files requires saving the root `.c` file for makefile to recognize that the file requires a rebuild. This is because at compile time a `inc.c` file is essentially copy/pasted into its associated `.c` file. Therefore makefile does not recognize changes to `.inc.c` files, only `.c` files. This may be resolved in the following ways:
|
||||||
|
1) Search for `#include "my_file.inc.c` to find the root file and then save it with ctrl+s.
|
||||||
|
2) `make clean` and rebuild
|
||||||
|
3) `make my_file.c`
|
||||||
|
4) Find help in the Discord
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue