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 --- examples/system/timer/makefile | 76 +++++++++++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 23 deletions(-) (limited to 'examples/system/timer/makefile') diff --git a/examples/system/timer/makefile b/examples/system/timer/makefile index a8defe7..c418af4 100644 --- a/examples/system/timer/makefile +++ b/examples/system/timer/makefile @@ -1,35 +1,65 @@ -include ../../examples-setup.mk +# PSn00bSDK makefile template +# Part of the PSn00bSDK Project +# 2019 - 2021 Lameguy64 / Meido-Tek Productions -TARGET = timer.elf +## Settings -CFILES = $(notdir $(wildcard *.c)) -CPPFILES = $(notdir $(wildcard *.cpp)) -AFILES = $(notdir $(wildcard *.s)) +PSN00BSDK_LIBS ?= ../../../libpsn00b -OFILES = $(addprefix build/,$(CFILES:.c=.o) $(CPPFILES:.cpp=.o) $(AFILES:.s=.o)) +# 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 -INCLUDE += -LIBDIRS += +# Project target name +TARGET = timer -LIBS = -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc +## Files -CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections -CPPFLAGS = $(CFLAGS) -fno-exceptions -AFLAGS = -g -msoft-float -LDFLAGS = -g -Ttext=0x80010000 -gc-sections \ - -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x +# Searches for C, C++ and S (assembler) files in local directory +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)) + +# Project specific includes and libraries +# (use -I for include dirs, -L for library dirs, -l for static libraries) +INCLUDE += +LIBDIRS += +LIBS += + +## Build rules + +#all: iso +all: build/$(TARGET) + +iso: build/$(TARGET) resources + $(MKPSXISO) -y -q iso.xml + +resources: + # Add commands to build/convert your assets here + #$(LZPACK) data.xml + +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) $(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 -- cgit v1.2.3