diff options
| author | John "Lameguy" Wilbert Villamor <lameguy64@gmail.com> | 2021-08-31 13:23:20 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-31 13:23:20 +0800 |
| commit | ffa679d4d24b891cb59aba10946368f2ec00c391 (patch) | |
| tree | 0cf6061915ebf48acdedf6d77b0c1b76eec5b8c3 /libpsn00b/psxspu | |
| parent | 317dc2b91d3afcdbaddb035f38611d12af161970 (diff) | |
| parent | f2fc18f82dd7900465d6ab3ae2080726d5589d39 (diff) | |
| download | psn00bsdk-ffa679d4d24b891cb59aba10946368f2ec00c391.tar.gz | |
Merge pull request #36 from spicyjpeg/dynlink
Dynamic linker, gp-relative addressing, ldscripts and more
Diffstat (limited to 'libpsn00b/psxspu')
| -rw-r--r-- | libpsn00b/psxspu/makefile | 61 | ||||
| -rw-r--r-- | libpsn00b/psxspu/transfer.s | 3 |
2 files changed, 39 insertions, 25 deletions
diff --git a/libpsn00b/psxspu/makefile b/libpsn00b/psxspu/makefile index 7948f34..5710f39 100644 --- a/libpsn00b/psxspu/makefile +++ b/libpsn00b/psxspu/makefile @@ -1,46 +1,59 @@ -# Run using make (Linux) or gmake (BSD) +# PSn00bSDK library makefile # Part of the PSn00bSDK Project -# 2019 - 2020 Lameguy64 / Meido-Tek Productions +# 2019 - 2021 Lameguy64 / Meido-Tek Productions -include ../../template/psn00bsdk-setup.mk +## Settings -TARGET = libpsxspu.a +PSN00BSDK_LIBS ?= .. -INCLUDE = -I../include +include ../../psn00bsdk-setup.mk -CFILES = $(notdir $(wildcard ./*.c)) -AFILES = $(notdir $(wildcard ./*.s)) -OFILES = $(addprefix build/,$(CFILES:.c=.o) $(AFILES:.s=.o)) +# Project target name +TARGET = libpsxspu.a -CFLAGS = -g -O2 -msoft-float -fdata-sections -ffunction-sections \ - -Wa,--strip-local-absolute -AFLAGS = -g -msoft-float -strip-local-absolute +## Files -ifndef PSN00BSDK_LIBS +# Searches for C, C++ and S (assembler) files in local directory +CFILES = $(notdir $(wildcard *.c)) +CXXFILES= $(notdir $(wildcard *.cxx)) +AFILES = $(notdir $(wildcard *.s)) -PSN00BSDK_LIBS = .. +# Create names for object files +OFILES = $(addprefix build/,$(CFILES:.c=.o)) \ + $(addprefix build/,$(CXXFILES:.cxx=.o)) \ + $(addprefix build/,$(AFILES:.s=.o)) -endif +# Project specific includes and libraries +# (use -I for include dirs, -L for library dirs, -l for static libraries) +INCLUDE += +LIBDIRS += +LIBS += + +## Build rules -all: $(TARGET) +all: build/$(TARGET) -$(TARGET): $(OFILES) - $(AR) cr $(TARGET) $(OFILES) - $(RANLIB) $(TARGET) +build/$(TARGET): $(OFILES) + @mkdir -p $(dir $@) + $(AR) crs $@ $(OFILES) build/%.o: %.c @mkdir -p $(dir $@) - $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ + $(CC) $(CFLAGS_LIB) $(INCLUDE) -c $< -o $@ + +build/%.o: %.cxx + @mkdir -p $(dir $@) + $(CXX) $(CPPFLAGS_LIB) $(INCLUDE) -c $< -o $@ build/%.o: %.s @mkdir -p $(dir $@) - $(AS) $(AFLAGS) $(INCLUDE) $< -o $@ - + $(CC) $(AFLAGS_LIB) $(INCLUDE) -c $< -o $@ + install: ifneq ($(PSN00BSDK_LIBS), "..") @mkdir -p $(PSN00BSDK_LIBS) endif - cp $(TARGET) $(PSN00BSDK_LIBS)/$(TARGET) - + cp build/$(TARGET) $(PSN00BSDK_LIBS)/$(TARGET) + clean: - rm -Rf build $(TARGET) + rm -rf build diff --git a/libpsn00b/psxspu/transfer.s b/libpsn00b/psxspu/transfer.s index 086bb3b..5b62c28 100644 --- a/libpsn00b/psxspu/transfer.s +++ b/libpsn00b/psxspu/transfer.s @@ -20,7 +20,8 @@ SpuSetTransferStartAddr: li $v0, 0x1000 # Check if value is valid blt $a0, $v0, .Lbad_value nop - li $v0, 0xffff + lui $v0, 8 # 0x7ffff = (8<<16)-1 + addiu $v0, -1 bgt $a0, $v0, .Lbad_value nop |
