mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-08 06:47:23 -04:00
Xbox: Fix not using built in fabsf/fsqrtf
This commit is contained in:
parent
5d0c9295ca
commit
4eb7eb412c
@ -1,17 +1,25 @@
|
||||
BUILD_DIR := build/ps1
|
||||
SOURCE_DIRS := src
|
||||
TARGET := ClassiCube-ps1
|
||||
|
||||
S_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
|
||||
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
|
||||
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o)))
|
||||
|
||||
ifeq ($(strip $(PSN00BSDK_ROOT)),)
|
||||
$(warning Please set PSN00BSDK_ROOT path in your environment. For example:)
|
||||
$(warning export PSN00BSDK_ROOT=/usr/local/lib/psn00bsdk)
|
||||
$(error Failed to find PSN00BSDK installation path)
|
||||
endif
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Configurable options
|
||||
#---------------------------------------------------------------------------------
|
||||
BUILD_DIR := build/ps1
|
||||
SOURCE_DIRS := src
|
||||
TARGET := ClassiCube-ps1
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
S_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
|
||||
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
|
||||
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o)))
|
||||
|
||||
CINCLUDES := -I$(PSN00BSDK_ROOT)/include/libpsn00b
|
||||
|
||||
CFLAGS := -DPLAT_PS1 -DPSN00BSDK=1 -g -Wa,--strip-local-absolute -ffreestanding -fno-builtin -nostdlib -fdata-sections -ffunction-sections -fsigned-char -fno-strict-overflow -msoft-float -march=r3000 -mtune=r3000 -mabi=32 -mno-mt -mno-llsc -Og -mdivide-breaks -G8 -fno-pic -mno-abicalls -mgpopt -mno-extern-sdata
|
||||
@ -59,7 +67,10 @@ $(TARGET).bin: $(TARGET).exe
|
||||
$(BUILD_DIR)/%.o: src/%.c
|
||||
$(PSN00BSDK_ROOT)/bin/mipsel-none-elf-gcc $(CFLAGS) $(CINCLUDES) $(DEPFLAGS) -c $< -o $@
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Dependency tracking
|
||||
#---------------------------------------------------------------------------------
|
||||
$(DEPFILES):
|
||||
|
||||
include $(wildcard $(DEPFILES))
|
||||
|
@ -1,9 +1,19 @@
|
||||
ifeq ($(strip $(PS2SDK)),)
|
||||
$(error "PS2SDK must be set in your environment")
|
||||
endif
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Configurable options
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCE_DIRS := src third_party/bearssl/src misc/ps2
|
||||
BUILD_DIR = build-ps2
|
||||
TARGET = ClassiCube-ps2
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
S_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
|
||||
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
|
||||
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o)))
|
||||
@ -12,9 +22,8 @@ OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.
|
||||
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
|
||||
DEPFILES := $(OBJS:%.o=%.d)
|
||||
|
||||
IOP_MODS:= DEV9_irx.o NETMAN_irx.o SMAP_irx.o USBD_irx.o BDM_irx.o BDMFS_FATFS_irx.o USBMASS_BD_irx.o USBHDFSD_irx.o USBMOUSE_irx.o USBKBD_irx.o
|
||||
IOP_MODS := DEV9_irx.o NETMAN_irx.o SMAP_irx.o USBD_irx.o BDM_irx.o BDMFS_FATFS_irx.o USBMASS_BD_irx.o USBHDFSD_irx.o USBMOUSE_irx.o USBKBD_irx.o
|
||||
|
||||
TARGET = ClassiCube-ps2
|
||||
EE_OBJS = $(OBJS) $(patsubst %.o, $(BUILD_DIR)/%.o, $(IOP_MODS))
|
||||
EE_LIBS = -lpatches -lpad -lpacket -ldma -lgraph -ldraw -lc -lps2ip -lnetman -lmc -lmouse -lkbd
|
||||
|
||||
@ -23,6 +32,10 @@ EE_CFLAGS := -D_EE -G0 -O2 -Wall -gdwarf-2 -gz -DPLAT_PS2
|
||||
EE_LDFLAGS := -L$(PS2SDK)/ee/lib -Wl,-zmax-page-size=128
|
||||
EE_LINKFILE := $(PS2SDK)/ee/startup/linkfile
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
all: $(BUILD_DIR) $(TARGET)-min.elf
|
||||
|
||||
clean:
|
||||
@ -32,7 +45,11 @@ $(BUILD_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
include $(PS2SDK)/samples/Makefile.pref
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# IRX modules
|
||||
#---------------------------------------------------------------------------------
|
||||
# Networking IRX modules
|
||||
$(BUILD_DIR)/DEV9_irx.c: $(PS2SDK)/iop/irx/ps2dev9.irx
|
||||
bin2c $< $@ DEV9_irx
|
||||
@ -92,7 +109,10 @@ $(BUILD_DIR)/%.o: misc/ps2/%.S
|
||||
$(BUILD_DIR)/%.o: $(BUILD_DIR)/%.c # IOP modules
|
||||
$(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Dependency tracking
|
||||
#---------------------------------------------------------------------------------
|
||||
$(DEPFILES):
|
||||
|
||||
include $(wildcard $(DEPFILES))
|
||||
|
@ -19,7 +19,7 @@ S_FILES = $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
|
||||
C_FILES = $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
|
||||
OBJS = $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o)))
|
||||
|
||||
CFLAGS = -Ithird_party/bearssl/inc -O1 \
|
||||
CFLAGS = -Ithird_party/bearssl/inc -O1 -fno-math-errno -Wno-builtin-macro-redefined \
|
||||
-I$(NXDK_DIR)/lib/net/lwip/src/include \
|
||||
-I$(NXDK_DIR)/lib/net/nforceif/include \
|
||||
-I$(NXDK_DIR)/lib/net/nvnetdrv \
|
||||
@ -44,16 +44,10 @@ DEPFILES := $(OBJS:%.o=%.d)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Tools finder
|
||||
# Tools
|
||||
#---------------------------------------------------------------------------------
|
||||
UNAME_M := $(shell uname -m)
|
||||
|
||||
ifneq ($(UNAME_M),x86_64)
|
||||
CGC = $(NXDK_DIR)/tools/cg/linux/cgc.i386
|
||||
else
|
||||
CGC = $(NXDK_DIR)/tools/cg/linux/cgc
|
||||
endif
|
||||
# NOTE: Linux only. Will need to modify for other platforms
|
||||
CGC = $(NXDK_DIR)/tools/cg/linux/cgc
|
||||
# NOTE: Linux only. Would need changing for other platforms
|
||||
|
||||
CXBE = $(NXDK_DIR)/tools/cxbe/cxbe
|
||||
VP20COMPILER = $(NXDK_DIR)/tools/vp20compiler/vp20compiler
|
||||
|
@ -96,7 +96,7 @@ float sqrtf(float x) {
|
||||
fp_x = SquareRoot12(fp_x);
|
||||
return (float)fp_x / (1 << 12);
|
||||
}
|
||||
#elif defined __GNUC__
|
||||
#elif defined __GNUC__ || defined NXDK
|
||||
/* Defined in .h using builtins */
|
||||
#elif defined __TINYC__
|
||||
/* Older versions of TinyC don't support fabsf or sqrtf */
|
||||
|
@ -26,6 +26,9 @@ CC_BEGIN_HEADER
|
||||
/* (sqrtf is only when -fno-math-errno though) */
|
||||
#define Math_AbsF(x) __builtin_fabsf(x)
|
||||
#define Math_SqrtF(x) __builtin_sqrtf(x)
|
||||
#elif defined NXDK
|
||||
#define Math_AbsF(x) __builtin_fabsf(x)
|
||||
#define Math_SqrtF(x) __builtin_sqrtf(x)
|
||||
#else
|
||||
float Math_AbsF(float x);
|
||||
float Math_SqrtF(float x);
|
||||
|
Loading…
x
Reference in New Issue
Block a user