From 89751f29467b359339a8c8b57c218cc3328bae43 Mon Sep 17 00:00:00 2001 From: spicyjpeg <88942473+spicyjpeg@users.noreply.github.com> Date: Tue, 17 Aug 2021 11:36:56 +0000 Subject: Rewritten all Makefiles, set up proper GCC options, added iso.xml to template --- template/iso.xml | 27 +++++++++++++++ template/makefile | 83 ++++++++++++++++++++++++++------------------- template/psn00bsdk-setup.mk | 68 ------------------------------------- template/system.cnf | 4 +++ 4 files changed, 80 insertions(+), 102 deletions(-) create mode 100644 template/iso.xml delete mode 100644 template/psn00bsdk-setup.mk create mode 100644 template/system.cnf (limited to 'template') diff --git a/template/iso.xml b/template/iso.xml new file mode 100644 index 0000000..ba2b29d --- /dev/null +++ b/template/iso.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + diff --git a/template/makefile b/template/makefile index 42ff370..707a8d7 100644 --- a/template/makefile +++ b/template/makefile @@ -1,54 +1,69 @@ -include psn00bsdk-setup.mk +# PSn00bSDK makefile template +# Part of the PSn00bSDK Project +# 2019 - 2021 Lameguy64 / Meido-Tek Productions + +## Settings + +# You can edit these here or pass them as environment variables. +#PREFIX = +#GCC_VERSION = +#PSN00BSDK_TC = +#PSN00BSDK_LIBS = + +# Edit this to point to psn00bsdk-setup.mk, or copy that over to your project's +# root folder (it only depends on environment variables). +include ../psn00bsdk-setup.mk # Project target name -TARGET = template.elf +TARGET = template + +## Files # Searches for C, C++ and S (assembler) files in local directory -CFILES = $(notdir $(wildcard *.c)) -CPPFILES = $(notdir $(wildcard *.cpp)) -AFILES = $(notdir $(wildcard *.s)) +CFILES = $(notdir $(wildcard *.c)) +CPPFILES= $(notdir $(wildcard *.cpp)) +AFILES = $(notdir $(wildcard *.s)) # Create names for object files -OFILES = $(addprefix build/,$(CFILES:.c=.o)) \ - $(addprefix build/,$(CPPFILES:.cpp=.o)) \ - $(addprefix build/,$(AFILES:.s=.o)) +OFILES = $(addprefix build/,$(CFILES:.c=.o)) \ + $(addprefix build/,$(CPPFILES:.cpp=.o)) \ + $(addprefix build/,$(AFILES:.s=.o)) -# Project specific include and library directories -# (use -I for include dirs, -L for library dirs) -INCLUDE += -LIBDIRS += +# Project specific includes and libraries +# (use -I for include dirs, -L for library dirs, -l for static libraries) +INCLUDE += +LIBDIRS += +LIBS += -# Libraries to link -LIBS = -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc +## Build rules -# C compiler flags -CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections +all: iso +#all: build/$(TARGET) -# C++ compiler flags -CPPFLAGS = $(CFLAGS) -fno-exceptions +iso: build/$(TARGET) resources + $(MKPSXISO) -y -q iso.xml -# Assembler flags -AFLAGS = -g +resources: + # Add commands to build/convert your assets here + #$(LZPACK) data.xml -# Linker flags (-Ttext specifies the program text address) -LDFLAGS = -g -Ttext=0x80010000 -gc-sections \ - -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x +build/$(TARGET): $(OFILES) + @mkdir -p $(dir $@) + $(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@ + $(NM) -f posix -l -n $@ >$@.map + $(ELF2X) -q $@ $@.exe -all: $(OFILES) - $(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET) - elf2x -q $(TARGET) - build/%.o: %.c @mkdir -p $(dir $@) - $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ - + $(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@ + build/%.o: %.cpp @mkdir -p $(dir $@) - $(CXX) $(AFLAGS) $(INCLUDE) -c $< -o $@ - + $(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@ + build/%.o: %.s @mkdir -p $(dir $@) - $(CC) $(AFLAGS) $(INCLUDE) -c $< -o $@ - + $(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@ + clean: - rm -rf build $(TARGET) $(TARGET:.elf=.exe) + rm -rf build diff --git a/template/psn00bsdk-setup.mk b/template/psn00bsdk-setup.mk deleted file mode 100644 index 6ba23ae..0000000 --- a/template/psn00bsdk-setup.mk +++ /dev/null @@ -1,68 +0,0 @@ -# PSn00bSDK project setup file -# Part of the PSn00bSDK Project -# 2019 - 2020 Lameguy64 / Meido-Tek Productions -# -# This file may be copied for use with your projects, see the template -# directory for a makefile template - -ifndef PREFIX - -PREFIX = mipsel-unknown-elf - -endif # PREFIX - -ifndef GCC_VERSION - -GCC_VERSION = 7.4.0 - -endif # GCC_VERSION - -# PSn00bSDK library/include path setup -ifndef PSN00BSDK_LIBS - -# Default assumes PSn00bSDK is in the same parent dir as this project - -LIBDIRS = -L../psn00bsdk/libpsn00b -INCLUDE = -I../psn00bsdk/libpsn00b/include - -else - -LIBDIRS = -L$(PSN00BSDK_LIBS) -INCLUDE = -I$(PSN00BSDK_LIBS)/include - -endif # PSN00BSDK_LIBS - -# PSn00bSDK toolchain path setup -ifndef GCC_BASE - -ifndef PSN00BSDK_TC - -# Default assumes GCC toolchain is in root of C drive or /usr/local - -ifeq "$(OS)" "Windows_NT" - -GCC_BASE = /c/mipsel-unknown-elf -GCC_BIN = - -else - -GCC_BASE = /usr/local/mipsel-unknown-elf -GCC_BIN = - -endif - -else - -GCC_BASE = $(PSN00BSDK_TC) -GCC_BIN = $(PSN00BSDK_TC)/bin/ - -endif # PSN00BSDK_TC - -endif # GCC_BASE - -CC = $(GCC_BIN)$(PREFIX)-gcc -CXX = $(GCC_BIN)$(PREFIX)-g++ -AS = $(GCC_BIN)$(PREFIX)-as -AR = $(GCC_BIN)$(PREFIX)-ar -LD = $(GCC_BIN)$(PREFIX)-ld -RANLIB = $(GCC_BIN)$(PREFIX)-ranlib \ No newline at end of file diff --git a/template/system.cnf b/template/system.cnf new file mode 100644 index 0000000..e221726 --- /dev/null +++ b/template/system.cnf @@ -0,0 +1,4 @@ +BOOT=cdrom:\template.exe;1 +TCB=4 +EVENT=10 +STACK=801FFFF0 -- cgit v1.2.3